]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliKFParticle.cxx
Introducing a new set of classes for secondary vertex fitting based on Kalman filter...
[u/mrichter/AliRoot.git] / STEER / AliKFParticle.cxx
1 //----------------------------------------------------------------------------
2 // Implementation of the AliKFParticle class
3 // .
4 // @author  S.Gorbunov, I.Kisel
5 // @version 1.0
6 // @since   13.05.07
7 // 
8 // Class to reconstruct and store the decayed particle parameters.
9 // The method is described in CBM-SOFT note 2007-003, 
10 // ``Reconstruction of decayed particles based on the Kalman filter'', 
11 // http://www.gsi.de/documents/DOC-2007-May-14-1.pdf
12 //
13 // This class is ALICE interface to general mathematics in AliKFParticleCore
14 // 
15 //  -= Copyright &copy ALICE HLT Group =-
16 //____________________________________________________________________________
17
18
19 #include "AliKFParticle.h"
20 #include "TDatabasePDG.h"
21 #include "TParticlePDG.h"
22 #include "AliExternalTrackParam.h"
23 //#include "TMath.h"
24
25 ClassImp(AliKFParticle)
26
27
28   AliKFParticle::AliKFParticle( const AliExternalTrackParam &track, Double_t bz, Int_t PID ) : fBz(bz)
29 {
30   // Constructor from ALICE track, PID hypothesis can be provided
31
32   TParticlePDG* particlePDG = TDatabasePDG::Instance()->GetParticle(PID);
33   Double_t mass = (particlePDG) ? particlePDG->Mass() :0.13957;
34   
35   track.GetXYZ(fP);
36   track.GetPxPyPz(fP+3);
37   Double_t energy = TMath::Sqrt( mass*mass + fP[3]*fP[3] + fP[4]*fP[4] + fP[5]*fP[5]);
38   fP[6] = energy;
39   fP[7] = 0;
40   fQ = (track.Get1Pt() >0 ) ?1 :-1;
41   fNDF = 0;
42   fChi2 = 0;
43   fAtProductionVertex = 0;
44   fIsLinearized = 0;
45   fSFromDecay = 0;
46
47   Double_t energyInv = 1./energy;
48   Double_t 
49     h0 = fP[3]*energyInv,
50     h1 = fP[4]*energyInv, 
51     h2 = fP[5]*energyInv;
52   track.GetCovarianceXYZPxPyPz( fC );
53
54   fC[21] = h0*fC[ 6] + h1*fC[10] + h2*fC[15];
55   fC[22] = h0*fC[ 7] + h1*fC[11] + h2*fC[16];
56   fC[23] = h0*fC[ 8] + h1*fC[12] + h2*fC[17];
57   fC[24] = h0*fC[ 9] + h1*fC[13] + h2*fC[18];
58   fC[25] = h0*fC[13] + h1*fC[14] + h2*fC[19];
59   fC[26] = h0*fC[18] + h1*fC[19] + h2*fC[20];
60   fC[27] = h0*h0*fC[ 9] + h1*h1*fC[14] + h2*h2*fC[20] 
61     + 2*(h0*h1*fC[13] + h0*h2*fC[18] + h1*h2*fC[19] ); 
62   for( int i=28; i<36; i++ ) fC[i] = 0;
63   fC[35] = 1.;
64 }
65
66 AliKFParticle::AliKFParticle( const AliESDVertex &vertex, Double_t bz): fBz(bz)
67 {
68   // Constructor from ALICE vertex
69
70   vertex.GetXYZ( fP );
71   vertex.GetCovMatrix( fC );
72   fChi2 = vertex.GetChi2();
73   fNDF = 2*vertex.GetNContributors() - 3;
74   fQ = 0;
75   fAtProductionVertex = 0;
76   fIsLinearized = 0;
77   fSFromDecay = 0;
78 }