23 #ifndef KFParticleDef_H
24 #define KFParticleDef_H
26 #ifdef __ROOT__ //for the STAR experiment
27 #define HomogeneousField
30 #ifdef HLTCA_STANDALONE
31 #include "RootTypesDef.h"
39 #include <Vc/version.h>
46 using ::Vc::VectorAlignment;
56 #ifdef VC_VERSION_NUMBER
57 #if VC_VERSION_NUMBER < VC_VERSION_CHECK(1,0,0)
58 template <
typename To,
typename From> To simd_cast(From &&
x) {
return static_cast<To
>(
x); }
60 #elif defined(Vc_VERSION_NUMBER)
61 #if Vc_VERSION_NUMBER < Vc_VERSION_CHECK(1,0,0)
62 template <
typename To,
typename From> To simd_cast(From &&
x) {
return static_cast<To
>(
x); }
68 #if defined(HLTCA_STANDALONE)
69 typedef unsigned char UChar_t;
70 typedef UChar_t Byte_t;
72 typedef double Double_t;
82 typedef std::vector<unsigned int, KFPSimdAllocator<unsigned int> >
kfvector_uint;
88 const float_v
pi(3.1415926535897932
f);
89 const float_v nTurnsF = (phi +
pi) / (float_v(2.
f)*
pi);
90 int_v nTurns = simd_cast<int_v>( nTurnsF );
91 nTurns( (nTurns<=int_v(Vc::Zero)) && simd_cast<int_m>(phi<-pi)) -= 1;
93 const float_v&
x = phi - simd_cast<float_v>(nTurns)*(float_v(2.
f)*
pi);
95 const float_v& B = 4.f/
pi;
96 const float_v&
C = -B/
pi;
98 float_v
y = (B + C * Vc::abs(x)) * x;
100 const float_v&
P = 0.218f;
101 y = P * (y * Vc::abs(y) -
y) + y;
105 static inline __attribute__((always_inline)) float_v Cos ( const float_v &
phi )
107 return Sin( phi + 1.570796326795
f );
109 static inline __attribute__((always_inline)) float_v ATan2( const float_v &
y, const float_v &
x )
111 const float_v
pi(3.1415926535897932
f);
112 const float_v
zero(Vc::Zero);
119 const float_v &
absX = Vc::abs(x);
120 const float_v &
absY = Vc::abs(y);
124 const float_m &
gt_tan_pi_8 = (a > float_v(0.4142135623730950
f)) && (!gt_tan_3pi_8);
126 b(gt_tan_3pi_8) = pi/2.f;
127 b(gt_tan_pi_8) = pi/4.f;
128 a(gt_tan_3pi_8) = (-1.f /
a);
129 a(gt_tan_pi_8) = ((absY -
absX) / (absY + absX)) ;
130 const float_v &
a2 = a *
a;
131 b += (((8.05374449538e-2
f * a2
132 - 1.38776856032E-1
f) * a2
133 + 1.99777106478
E-1
f) * a2
134 - 3.33329491539E-1
f) * a2 * a
137 b(xNeg && !yNeg) = (
b+
pi);
138 b(xNeg && yNeg) = (
b-
pi);
139 b(xZero && yZero) =
zero;
140 b(xZero && yNeg) = (-pi/2.f);
143 template<
typename T>
static inline __attribute__((always_inline))
144 typename Vc::
Vector<
T>::Mask Finite(const Vc::
Vector<
T> &x) {
return Vc::isfinite( x ); }
145 template<
typename T>
static inline __attribute__((always_inline))
T Log ( const
T &x ) {
return std::log( x ); }
146 template<
typename T>
static inline __attribute__((always_inline))
T ACos( const
T &x ) {
return (3.1415926535897
f/2.
f - asin( x )); }