22#include "TDatabasePDG.h"
23#include "TParticlePDG.h"
25#ifdef HomogeneousField
27#include "AliVVertex.h"
30#ifdef NonhomogeneousField
31#include "CbmKFTrack.h"
32#include "CbmKFVertex.h"
33#include "CbmKFParticleDatabase.h"
36#ifdef HomogeneousField
37fvec KFParticleSIMD::fgBz = -5.;
40static const fvec Zero = 0;
41static const fvec One = 1;
44#ifdef NonhomogeneousField
54 ConstructGamma(d1, d2);
71 for(
int i=0;
i<21;
i++ ) C[
i] = Cov[
i];
79#ifdef NonhomogeneousField
83 Create(Track, NTracks, qHypo, pdg);
93 for (
int j=0; j<NTracks; j++)
103 for(
int i = 0;
i < 6;
i++)
m[
i][j] = Track[j]->GetTrack()[
i];
104 for(
int i = 0;
i < 15;
i++) V[
i][j] = Track[j]->GetCovMatrix()[
i];
108 fvec a =
m[2], b =
m[3], qp =
m[4];
112 fvec c2 = 1./(1. + a*a + b*b);
118 fvec eE =
sqrt( TrMass*TrMass + p2 );
120 fvec H[3] = { -px*c2, -py*c2, -pz*pq };
132 fvec cxpz = H[0]*V[ 3] + H[1]*V[ 6] + H[2]*V[10];
133 fvec cypz = H[0]*V[ 4] + H[1]*V[ 7] + H[2]*V[11];
134 fvec capz = H[0]*V[ 5] + H[1]*V[ 8] + H[2]*V[12];
135 fvec cbpz = H[0]*V[ 8] + H[1]*V[ 9] + H[2]*V[13];
136 fvec cqpz = H[0]*V[12] + H[1]*V[13] + H[2]*V[14];
137 fvec cpzpz = H[0]*H[0]*V[5] +H[1]*H[1]*V[9] + H[2]*H[2]*V[14]
138 + 2*( H[0]*H[1]*V[8] +H[0]*H[2]*V[12] +H[1]*H[2]*V[13]);
146 fC[ 6] = V[3]*pz + a*cxpz;
147 fC[ 7] = V[4]*pz + a*cypz;
149 fC[ 9] = V[5]*pz*pz + 2*a*pz*capz + a*a*cpzpz;
150 fC[10] = V[6]*pz+b*cxpz;
151 fC[11] = V[7]*pz+b*cypz;
153 fC[13] = V[8]*pz*pz + a*pz*cbpz + b*pz*capz + a*b*cpzpz;
154 fC[14] = V[9]*pz*pz + 2*b*pz*cbpz + b*b*cpzpz;
158 fC[18] = capz*pz + a*cpzpz;
159 fC[19] = cbpz*pz + b*cpzpz;
164 fC[24] = HE*( V[12]*pz + a*cqpz );
165 fC[25] = HE*( V[13]*pz + b*cqpz );
167 fC[27] = HE*HE*V[14];
172 fQ[j] = (qp[j]>0.) ?1 :( (qp[j]<0) ?-1 :0);
191 for(
unsigned int i=0;
i<6;
i++)
193 for(
unsigned int i=0;
i<15;
i++)
201 fvec a =
m[2], b =
m[3], qp =
m[4];
205 fvec c2 = 1./(1. + a*a + b*b);
211 fvec eE =
sqrt( TrMass*TrMass + p2 );
213 fvec H[3] = { -px*c2, -py*c2, -pz*pq };
225 fvec cxpz = H[0]*V[ 3] + H[1]*V[ 6] + H[2]*V[10];
226 fvec cypz = H[0]*V[ 4] + H[1]*V[ 7] + H[2]*V[11];
227 fvec capz = H[0]*V[ 5] + H[1]*V[ 8] + H[2]*V[12];
228 fvec cbpz = H[0]*V[ 8] + H[1]*V[ 9] + H[2]*V[13];
229 fvec cqpz = H[0]*V[12] + H[1]*V[13] + H[2]*V[14];
230 fvec cpzpz = H[0]*H[0]*V[5] +H[1]*H[1]*V[9] + H[2]*H[2]*V[14]
231 + 2*( H[0]*H[1]*V[8] +H[0]*H[2]*V[12] +H[1]*H[2]*V[13]);
239 fC[ 6] = V[3]*pz + a*cxpz;
240 fC[ 7] = V[4]*pz + a*cypz;
242 fC[ 9] = V[5]*pz*pz + 2*a*pz*capz + a*a*cpzpz;
243 fC[10] = V[6]*pz+b*cxpz;
244 fC[11] = V[7]*pz+b*cypz;
246 fC[13] = V[8]*pz*pz + a*pz*cbpz + b*pz*capz + a*b*cpzpz;
247 fC[14] = V[9]*pz*pz + 2*b*pz*cbpz + b*b*cpzpz;
251 fC[18] = capz*pz + a*cpzpz;
252 fC[19] = cbpz*pz + b*cpzpz;
257 fC[24] = HE*( V[12]*pz + a*cqpz );
258 fC[25] = HE*( V[13]*pz + b*cqpz );
260 fC[27] = HE*HE*V[14];
265 fQ[j] = (qp[j]>0.) ?1 :( (qp[j]<0) ?-1 :0);
281 for( Int_t
i=0;
i<6;
i++)
293#ifdef HomogeneousField
301 for(Int_t iPart = 0; iPart<
fvecLen; iPart++)
303 track[iPart].XvYvZv(r);
304 for(Int_t
i=0;
i<3;
i++)
306 track[iPart].PxPyPz(r);
307 for(Int_t
i=0;
i<3;
i++)
308 fP[
i+3][iPart] = r[
i];
309 fQ[iPart] = track[iPart].Charge();
310 track[iPart].GetCovarianceXYZPxPyPz( C );
311 for(Int_t
i=0;
i<21;
i++)
325 for(Int_t
i=0;
i<3;
i++)
327 vertex.GetCovarianceMatrix( C );
328 for(Int_t
i=0;
i<21;
i++)
330 fChi2 = vertex.GetChi2();
331 fNDF = 2*vertex.GetNContributors() - 3;
343 fvec pt =
sqrt(cosA*cosA + sinA*sinA);
346 pti = (!mask) & (One/pt);
347 cosA =
if3(mask, One, cosA*pti);
348 sinA =
if3(mask, One, sinA*pti);
350 fvec AlphaSIMD = atan2SIMD(sinA,cosA);
353 PSIMD[0]= p.
GetY()*cosA - p.
GetX()*sinA;
356 PSIMD[3]= p.
GetPz()*pti;
357 PSIMD[4]= p.
GetQ()*pti;
359 for(
int iPart=0; iPart<
fvecLen; iPart++)
361 X[iPart] = XSIMD[iPart];
362 Alpha[iPart] = AlphaSIMD[iPart];
363 P[0][iPart] = PSIMD[0][iPart];
364 P[1][iPart] = PSIMD[1][iPart];
365 P[2][iPart] = PSIMD[2][iPart];
366 P[3][iPart] = PSIMD[3][iPart];
367 P[4][iPart] = PSIMD[4][iPart];
374#ifdef NonhomogeneousField
380 const int nD = (parts[0])->NDaughters();
381 for (
int ie = 1; ie < nPart; ie++ ) {
387 std::cout <<
" void CbmKFParticle_simd::Create(CbmKFParticle *parts[], int N) " << std::endl;
392 fDaughterIds.resize( (parts[0])->NDaughters(),
fvec(-1) );
394 for (
int ie = 0; ie < nPart; ie++ ) {
398 for(
int iD=0; iD<(parts[0])->NDaughters(); iD++)
403 for(
int i = 0;
i < 8; ++
i )
405 for(
int i = 0;
i < 36; ++
i )
410 fQ[ie] = part.
GetQ();
416 fField.SetOneEntry( ie, field, 0 );
421#ifdef NonhomogeneousField
440 for(
int i = 0;
i < 8; ++
i )
442 for(
int i = 0;
i < 36; ++
i )
462 fvec dx = mP[0] - vtx[0];
463 fvec dy = mP[1] - vtx[1];
467 fvec ex=Zero, ey=Zero;
470 pt =
if3(mask, One, pt);
471 ex = (!mask) & (px/pt);
472 ey = (!mask) & (py/pt);
473 val =
if3(mask,
fvec(1.e4), dy*ex - dx*ey);
477 fvec h3 = (dy*ey + dx*ex)*ey/pt;
478 fvec h4 = -(dy*ey + dx*ex)*ex/pt;
487 err+= h0*(h0*Cv[0] + h1*Cv[1] ) + h1*(h0*Cv[1] + h1*Cv[2] );
508#ifdef HomogeneousField
532#ifdef HomogeneousField
547 fvec mP[8], mC[36], mP1[8], mC1[36];
550 fvec dx = mP[0]-mP1[0];
551 fvec dy = mP[1]-mP1[1];
552 return sqrt(dx*dx+dy*dy);
561 fvec mP1[8], mC1[36];
564 fvec d[2]={
fP[0]-mP1[0],
fP[1]-mP1[1] };
567 (mP1[3]*mP1[3]+mP1[4]*mP1[4] ) );
569 fvec h[2] = { mP1[3]*sigmaS, mP1[4]*sigmaS };
588 ret =
if3(mask, ret, val/err);
601#ifdef HomogeneousField
618 fvec mP[8], mC[36], mP1[8], mC1[36];
621 fvec n =
sqrt( mP[3]*mP[3] + mP[4]*mP[4] + mP[5]*mP[5] );
622 fvec n1=
sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] + mP1[5]*mP1[5] );
626 a = ( mP[3]*mP1[3] + mP[4]*mP1[4] + mP[5]*mP1[5] )/n;
640 fvec mP[8], mC[36], mP1[8], mC1[36];
643 fvec n =
sqrt( mP[3]*mP[3] + mP[4]*mP[4] );
644 fvec n1=
sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] );
648 a = ( mP[3]*mP1[3] + mP[4]*mP1[4] )/n;
662 fvec mP[8], mC[36], mP1[8], mC1[36];
665 fvec nr =
sqrt( mP[3]*mP[3] + mP[4]*mP[4] );
666 fvec n1r=
sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] );
667 fvec n =
sqrt( nr*nr + mP[5]*mP[5] );
668 fvec n1=
sqrt( n1r*n1r + mP1[5]*mP1[5] );
672 a = ( nr*n1r +mP[5]*mP1[5])/n;
721 const fvec mipt2 = mass*ipt2;
722 const fvec dx =
X() - pV.
X();
723 const fvec dy =
Y() - pV.
Y();
734 const fvec f0 =
Px()*mipt2;
735 const fvec f1 =
Py()*mipt2;
736 const fvec mipt2derivative = mipt2*(1-2*
Px()*
Px()*ipt2);
737 const fvec f2 = dx*mipt2derivative;
738 const fvec f3 = -dy*mipt2derivative;
771 return ( dx*
Px() + dy*
Py() )*mipt2;
776 Part.
SetId(
static_cast<int>(
Id()[iPart]));
785 for(
int iP=0; iP<8; iP++)
787 for(
int iC=0; iC<36; iC++)
790 Part.
NDF() =
static_cast<int>(
GetNDF()[iPart]);
792 Part.
Q() =
GetQ()[iPart];
809 for(
int i=0;
i<nPart;
i++)
const Float_t d
Z-ccordinate of the first GEM-station.
friend F32vec4 sqrt(const F32vec4 &a)
friend F32vec4 fabs(const F32vec4 &a)
friend F32vec4 acos(const F32vec4 &a)
static CbmKFParticleDatabase * Instance()
virtual Int_t & GetRefNDF()
Chi^2 after fit.
virtual Double_t GetMass()
virtual Double_t & GetRefChi2()
array[15] of covariance matrix
Double_t * GetTrack()
Is it electron.
Double_t & GetRefChi2()
array[15] of covariance matrix
Int_t & GetRefNDF()
Chi^2 after fit.
Double_t * GetCovMatrix()
array[6] of track parameters(x,y,tx,ty,qp,z)
virtual Double_t & GetRefY()
virtual Double_t & GetRefX()
virtual Double_t & GetRefZ()
virtual Double_t & GetRefChi2()
Array[6] of covariance matrix.
virtual Int_t & GetRefNDF()
Chi^2 after fit.
virtual Double_t * GetCovMatrix()
const int & GetPDG() const
std::vector< fvec > fDaughterIds
std::vector< fvec > & DaughterIds()
Bool_t fAtProductionVertex
const Double_t & GetMassHypo() const
const std::vector< int > & DaughterIds() const
fvec GetDistanceFromParticleXY(const KFParticleSIMD &p) const
fvec GetCovariance(int i) const
fvec GetAngle(const KFParticleSIMD &p) const
fvec GetDeviationFromVertexXY(const fvec v[], const fvec Cv[]=0) const
void GetDStoParticle(const KFParticleSIMD &p, fvec &DS, fvec &DSp) const
fvec GetDStoPoint(const fvec xyz[]) const
void Create(const fvec Param[], const fvec Cov[], Int_t Charge, fvec mass)
static void GetExternalTrackParam(const KFParticleBaseSIMD &p, fvec &X, fvec &Alpha, fvec P[5])
void Transport(fvec dS, fvec P[], fvec C[]) const
fvec GetDeviationFromParticleXY(const KFParticleSIMD &p) const
fvec GetAngleRZ(const KFParticleSIMD &p) const
fvec GetAngleXY(const KFParticleSIMD &p) const
fvec GetPseudoProperDecayTime(const KFParticleSIMD &primVertex, const fvec &mass, fvec *timeErr2=0) const
fvec * CovarianceMatrix()
void GetKFParticle(KFParticle &Part, int iPart=0)
fvec GetDistanceFromVertexXY(const fvec vtx[], fvec &val, fvec &err) const
void GetDStoParticleXY(const KFParticleBaseSIMD &p, fvec &DS, fvec &DSp) const
Double_t * CovarianceMatrix()
void SetAtProductionVertex(Bool_t b)
const Int_t & NDF() const
Bool_t GetAtProductionVertex() const
void SetFieldCoeff(float c, int i)
void SetNDaughters(int n)
const Double_t & Chi2() const