20#include "TDatabasePDG.h"
21#include "TParticlePDG.h"
23#ifdef HomogeneousField
25#include "AliVVertex.h"
28#ifdef NonhomogeneousField
29#include "CbmKFTrack.h"
30#include "CbmKFVertex.h"
33#ifdef HomogeneousField
34Double_t KFParticle::fgBz = -5.;
48void KFParticle::Create(
const Double_t Param[],
const Double_t Cov[], Int_t Charge, Double_t mass )
62 for(
int i=0;
i<21;
i++ ) C[
i] = Cov[
i];
70#ifdef NonhomogeneousField
82 Double_t a =
m[2], b =
m[3], qp =
m[4];
86 double c2 = 1./(1. + a*a + b*b);
88 if(qHypo) pq *= *qHypo;
90 double pz =
sqrt(p2*c2);
93 double H[3] = { -px*c2, -py*c2, -pz*pq };
104 double cxpz = H[0]*V[ 3] + H[1]*V[ 6] + H[2]*V[10];
105 double cypz = H[0]*V[ 4] + H[1]*V[ 7] + H[2]*V[11];
106 double capz = H[0]*V[ 5] + H[1]*V[ 8] + H[2]*V[12];
107 double cbpz = H[0]*V[ 8] + H[1]*V[ 9] + H[2]*V[13];
109 double cpzpz = H[0]*H[0]*V[5] +H[1]*H[1]*V[9] + H[2]*H[2]*V[14]
110 + 2*( H[0]*H[1]*V[8] +H[0]*H[2]*V[12] +H[1]*H[2]*V[13]);
120 C[ 6] = V[3]*pz + a*cxpz;
121 C[ 7] = V[4]*pz + a*cypz;
123 C[ 9] = V[5]*pz*pz + 2*a*pz*capz + a*a*cpzpz;
124 C[10] = V[6]*pz+b*cxpz;
125 C[11] = V[7]*pz+b*cypz;
127 C[13] = V[8]*pz*pz + a*pz*cbpz + b*pz*capz + a*b*cpzpz;
128 C[14] = V[9]*pz*pz + 2*b*pz*cbpz + b*b*cpzpz;
132 C[18] = capz*pz + a*cpzpz;
133 C[19] = cbpz*pz + b*cpzpz;
136 Double_t Charge = (qp>0.) ?1 :( (qp<0) ?-1 :0);
137 if(qHypo) Charge *= *qHypo;
143 TParticlePDG* particlePDG = TDatabasePDG::Instance()->GetParticle(*PID);
144 mass = (particlePDG) ? particlePDG->Mass() :0.13957;
156 for( Int_t
i=0;
i<6;
i++)
168#ifdef HomogeneousField
176 track.GetCovarianceXYZPxPyPz(
fC );
178 TParticlePDG* particlePDG = TDatabasePDG::Instance()->GetParticle(PID);
179 Double_t mass = (particlePDG) ? particlePDG->Mass() :0.13957;
189 vertex.GetCovarianceMatrix(
fC );
190 fChi2 = vertex.GetChi2();
191 fNDF = 2*vertex.GetNContributors() - 3;
203 Double_t pt = TMath::Sqrt(cosA*cosA + sinA*sinA);
213 Alpha = TMath::ATan2(sinA,cosA);
215 P[0]= p.
GetY()*cosA - p.
GetX()*sinA;
237 Double_t dx = mP[0] - vtx[0];
238 Double_t dy = mP[1] - vtx[1];
241 Double_t pt = TMath::Sqrt(px*px + py*py);
255 Double_t h3 = (dy*ey + dx*ex)*ey/pt;
256 Double_t h4 = -(dy*ey + dx*ex)*ex/pt;
265 err+= h0*(h0*Cv[0] + h1*Cv[1] ) + h1*(h0*Cv[1] + h1*Cv[2] );
268 err = TMath::Sqrt(TMath::Abs(err));
286#ifdef HomogeneousField
310#ifdef HomogeneousField
325 Double_t mP[8], mC[36], mP1[8], mC1[36];
328 Double_t dx = mP[0]-mP1[0];
329 Double_t dy = mP[1]-mP1[1];
330 return TMath::Sqrt(dx*dx+dy*dy);
339 Double_t mP1[8], mC1[36];
342 Double_t
d[2]={
fP[0]-mP1[0],
fP[1]-mP1[1] };
344 Double_t sigmaS = .1+10.*TMath::Sqrt( (
d[0]*
d[0]+
d[1]*
d[1] )/
345 (mP1[3]*mP1[3]+mP1[4]*mP1[4] ) );
347 Double_t h[2] = { mP1[3]*sigmaS, mP1[4]*sigmaS };
364 if( problem || err<1.e-20 )
return 1.e4;
377#ifdef HomogeneousField
394 Double_t mP[8], mC[36], mP1[8], mC1[36];
397 Double_t n = TMath::Sqrt( mP[3]*mP[3] + mP[4]*mP[4] + mP[5]*mP[5] );
398 Double_t n1= TMath::Sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] + mP1[5]*mP1[5] );
401 if( n>1.e-8 ) a = ( mP[3]*mP1[3] + mP[4]*mP1[4] + mP[5]*mP1[5] )/n;
402 if (TMath::Abs(a)<1.) a = TMath::ACos(a);
403 else a = (a>=0) ?0 :TMath::Pi();
413 Double_t mP[8], mC[36], mP1[8], mC1[36];
416 Double_t n = TMath::Sqrt( mP[3]*mP[3] + mP[4]*mP[4] );
417 Double_t n1= TMath::Sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] );
420 if( n>1.e-8 ) a = ( mP[3]*mP1[3] + mP[4]*mP1[4] )/n;
421 if (TMath::Abs(a)<1.) a = TMath::ACos(a);
422 else a = (a>=0) ?0 :TMath::Pi();
432 Double_t mP[8], mC[36], mP1[8], mC1[36];
435 Double_t nr = TMath::Sqrt( mP[3]*mP[3] + mP[4]*mP[4] );
436 Double_t n1r= TMath::Sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] );
437 Double_t n = TMath::Sqrt( nr*nr + mP[5]*mP[5] );
438 Double_t n1= TMath::Sqrt( n1r*n1r + mP1[5]*mP1[5] );
441 if( n>1.e-8 ) a = ( nr*n1r +mP[5]*mP1[5])/n;
442 if (TMath::Abs(a)<1.) a = TMath::ACos(a);
443 else a = (a>=0) ?0 :TMath::Pi();
487 const Double_t ipt2 = 1/(
Px()*
Px() +
Py()*
Py() );
488 const Double_t mipt2 = mass*ipt2;
489 const Double_t dx =
X() - pV.
X();
490 const Double_t dy =
Y() - pV.
Y();
501 const Double_t f0 =
Px()*mipt2;
502 const Double_t f1 =
Py()*mipt2;
503 const Double_t mipt2derivative = mipt2*(1-2*
Px()*
Px()*ipt2);
504 const Double_t f2 = dx*mipt2derivative;
505 const Double_t f3 = -dy*mipt2derivative;
506 const Double_t f4 = -f0;
507 const Double_t f5 = -f1;
538 return ( dx*
Px() + dy*
Py() )*mipt2;
const Float_t d
Z-ccordinate of the first GEM-station.
friend F32vec4 sqrt(const F32vec4 &a)
Double_t * GetTrack()
Is it electron.
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()
Bool_t fAtProductionVertex
void ConstructGamma(const KFParticle &daughter1, const KFParticle &daughter2)
void GetDStoParticleXY(const KFParticleBase &p, Double_t &DS, Double_t &DSp) const
Bool_t GetDistanceFromVertexXY(const Double_t vtx[], Double_t &val, Double_t &err) const
static void GetExternalTrackParam(const KFParticleBase &p, Double_t &X, Double_t &Alpha, Double_t P[5])
const Double_t & Px() const
Double_t GetDeviationFromVertexXY(const Double_t v[], const Double_t Cv[]=0) const
Double_t GetDeviationFromParticleXY(const KFParticle &p) const
void Transport(Double_t dS, Double_t P[], Double_t C[]) const
const Double_t & Y() const
const Double_t & Py() const
Double_t GetAngle(const KFParticle &p) const
Double_t GetPseudoProperDecayTime(const KFParticle &primVertex, const Double_t &mass, Double_t *timeErr2=0) const
Double_t GetDistanceFromParticleXY(const KFParticle &p) const
Double_t GetAngleXY(const KFParticle &p) const
Double_t GetAngleRZ(const KFParticle &p) const
const Double_t & X() const
Double_t GetDStoPoint(const Double_t xyz[]) const
void GetDStoParticle(const KFParticle &p, Double_t &DS, Double_t &DSp) const
Double_t GetCovariance(int i) const
void Create(const Double_t Param[], const Double_t Cov[], Int_t Charge, Double_t mass)