]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliAODTrack.h
Changes to take into account the recent modifications in libESD.pkg
[u/mrichter/AliRoot.git] / STEER / AliAODTrack.h
1 #ifndef AliAODTrack_H
2 #define AliAODTrack_H
3 /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 //-------------------------------------------------------------------------
9 //     AOD track base class
10 //     Author: Markus Oldenburg, CERN
11 //-------------------------------------------------------------------------
12
13 #include <TRef.h>
14
15 #include "AliVirtualParticle.h"
16 #include "AliAODVertex.h"
17 #include "AliAODRedCov.h"
18
19 class AliAODTrack : public AliVirtualParticle {
20
21  public:
22   
23   enum AODTrk_t {kUndef=-1, kPrimary, kSecondary, kOrphan};
24
25   enum AODTrkBits_t {
26     kIsDCA=BIT(14)   // set if fPosition is the DCA and not the position of the first point
27   };
28
29   enum AODTrkPID_t {
30     kUnknown=0, kElectron, kMuon, kPion, kProton, kDeuton, kTriton, kAlpha, kOther};
31
32   AliAODTrack();
33   AliAODTrack(Int_t id,
34               Int_t label,
35               Double_t p[3],
36               Bool_t cartesian,
37               Double_t x[3],
38               Bool_t dca,
39               Double_t covMatrix[21],
40               Short_t q,
41               UChar_t itsClusMap,
42               Double_t pid[10],
43               AliAODVertex *prodVertex,
44               AODTrk_t ttype=kUndef);
45
46    AliAODTrack(Int_t id,
47               Int_t label,
48               Float_t p[3],
49               Bool_t cartesian,
50               Float_t x[3],
51               Bool_t dca,
52               Float_t covMatrix[21],
53               Short_t q,
54               UChar_t itsClusMap,
55               Float_t pid[10],
56               AliAODVertex *prodVertex,
57               AODTrk_t ttype=kUndef);
58
59   virtual ~AliAODTrack();
60   AliAODTrack(const AliAODTrack& trk); 
61   AliAODTrack& operator=(const AliAODTrack& trk);
62
63   // kinematics
64   virtual Double_t OneOverPt() const { return fMomentum[0]; }
65   virtual Double_t Phi()       const { return fMomentum[1]; }
66   virtual Double_t Theta()     const { return fMomentum[2]; }
67   
68   virtual Double_t Px() const { return TMath::Cos(fMomentum[1])/fMomentum[0]; }
69   virtual Double_t Py() const { return TMath::Sin(fMomentum[1])/fMomentum[0]; }
70   virtual Double_t Pz() const { return 1./(fMomentum[0] * TMath::Tan(fMomentum[2])); }
71   virtual Double_t Pt() const { return 1./fMomentum[0]; }
72   virtual Double_t P()  const { return TMath::Sqrt(Pt()*Pt()+Pz()*Pz()); }
73
74           Double_t Chi2() const { return fChi2; }
75
76   virtual Double_t E() const { return -999.; }
77   // make a connection to the PID object, here!!!
78   virtual Double_t M() const { return -999.; }
79   
80   virtual Double_t Eta() const { return -TMath::Log(TMath::Tan(0.5 * fMomentum[2])); }
81   // make a connection to the PID object, here!!!
82   virtual Double_t Y() const { return -999.; }
83
84   virtual Short_t  Charge() const {return fCharge; }
85
86   // PID
87   virtual const Double_t *PID() const { return fPID; }
88
89   template <class T> void GetPID(T *pid) const {
90     for(Int_t i=0; i<10; ++i) pid[i]=fPID[i];}
91  
92   template <class T> void SetPID(const T *pid) {
93     if(pid) for(Int_t i=0; i<10; ++i) fPID[i]=pid[i];
94     else {for(Int_t i=1; i<10; fPID[i++]=0); fPID[0]=1.;}}
95
96   Int_t GetID() const { return fID; }
97   Int_t GetLabel() const { return fLabel; } 
98   Char_t GetType() const { return fType;}
99
100   template <class T> void GetP(T *p) const {
101     p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];}
102
103   template <class T> void GetPxPyPz(T *p) const {
104     p[0] = Px(); p[1] = Py(); p[2] = Pz();}
105
106   template <class T> Bool_t GetPosition(T *x) const {
107     x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2];
108     return TestBit(kIsDCA);}
109
110   template <class T> void SetCovMatrix(const T *covMatrix) {
111     if(!fCovMatrix) fCovMatrix=new AliAODRedCov<6>();
112     fCovMatrix->SetCovMatrix(covMatrix);}
113
114   template <class T> Bool_t GetCovMatrix(T *covMatrix) const {
115     if(!fCovMatrix) return kFALSE;
116     fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
117
118   void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
119
120   UChar_t GetITSClusterMap() const { return fITSClusterMap; }
121
122   AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); }
123   
124   // print
125   void  Print(const Option_t *opt = "") const;
126
127   // setters
128   void SetID(Int_t id) { fID = id; }
129   void SetLabel(Int_t label) {fLabel = label; }
130
131   template <class T> void SetPosition(const T *x, Bool_t isDCA = kFALSE);
132   void SetDCA(Double_t d, Double_t z);
133
134   void SetOneOverPt(Double_t oneOverPt) { fMomentum[0] = oneOverPt; }
135   void SetPt(Double_t pt) { fMomentum[0] = 1./pt; };
136   void SetPhi(Double_t phi) { fMomentum[1] = phi; }
137   void SetTheta(Double_t theta) { fMomentum[2] = theta; }
138   template <class T> void SetP(const T *p, Bool_t cartesian = kTRUE);
139   void SetP() {fMomentum[0]=fMomentum[1]=fMomentum[2]=-999.;}
140
141   void SetCharge(Short_t q) { fCharge = q; }
142   void SetChi2(Double_t chi2) { fChi2 = chi2; }
143
144   void SetITSClusterMap(UChar_t itsClusMap) { fITSClusterMap = itsClusMap; }
145
146   void SetProdVertex(TObject *vertex) { fProdVertex = vertex; }
147
148   // name and title
149   void SetType(AODTrk_t ttype) { fType=ttype; }
150
151  private :
152
153   // Momentum & position
154   Double32_t    fMomentum[3];    // momemtum stored in 1/pt, phi, theta
155   Double32_t    fPosition[3];    // position of first point on track or dca
156
157   Double32_t    fPID[10];        // [0.,1.,8] pointer to PID object
158   Double32_t    fChi2;           // chi2 of mometum fit
159
160   Int_t         fID;             // unique track ID, points back to the ESD track
161   Int_t         fLabel;          // track label, points back to MC track
162   
163   AliAODRedCov<6> *fCovMatrix;      // covariance matrix (x, y, z, px, py, pz)
164   TRef          fProdVertex;     // vertex of origin
165
166   Char_t        fCharge;         // particle charge
167   UChar_t       fITSClusterMap;  // map of ITS cluster, one bit per layer
168   Char_t        fType;           // Track Type
169
170
171   ClassDef(AliAODTrack,1);
172 };
173
174 #endif