]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDtrackV1.h
Added new static method AliAnalysisManager::GetRunFromAlienPath() that extracts the...
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackV1.h
1 #ifndef ALITRDTRACKV1_H
2 #define ALITRDTRACKV1_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 ///////////////////////////////////////////////////////////////////////////////
9 //                                                                           //
10 //  Represents a reconstructed TRD track                                     //
11 //                                                                           //
12 ///////////////////////////////////////////////////////////////////////////////
13
14 //#ifndef ALIKALMANTRACK_H
15 #include "AliKalmanTrack.h"
16 //#endif
17
18 //#ifndef ALITRDSEEDV1_H
19 #include "AliTRDseedV1.h"
20 //#endif
21
22 class AliTRDcluster;
23 class AliESDtrack;
24 class AliTRDReconstructor;
25 class AliTRDtrackV1 : public AliKalmanTrack
26 {
27   friend class AliHLTTRDTrack;
28 public:
29   enum ETRDtrackSize { 
30     kNdet      = AliTRDgeometry::kNdet
31    ,kNstacks   = AliTRDgeometry::kNstack*AliTRDgeometry::kNsector
32    ,kNplane    = AliTRDgeometry::kNlayer
33    ,kNcham     = AliTRDgeometry::kNstack
34    ,kNsect     = AliTRDgeometry::kNsector
35    ,kNslice    =   3
36    ,kNMLPslice =   8 
37    ,kMAXCLUSTERSPERTRACK = 210
38   };
39   
40   // bits from 0-13 are reserved by ROOT (see TObject.h)
41   enum ETRDtrackStatus {
42     kOwner     = BIT(14)
43    ,kStopped   = BIT(15) 
44    ,kKink      = BIT(16) 
45    ,kPrimary   = BIT(17) 
46   };
47
48   // propagation/update error codes (up to 4 bits)
49   enum ETRDtrackError {
50     kProlongation = 1
51    ,kPropagation
52    ,kAdjustSector
53    ,kSnp
54    ,kTrackletInit
55    ,kUpdate
56    ,kUnknown      = 0xff
57   };
58
59   // data/clusters/tracklet error codes (up to 4 bits/layer)
60   enum ETRDlayerError {
61     kGeometry = 1
62    ,kBoundary
63    ,kNoClusters
64    ,kNoAttach
65    ,kNoClustersTracklet
66    ,kNoFit
67    ,kChi2
68   };
69
70   AliTRDtrackV1();
71   AliTRDtrackV1(AliTRDseedV1 * const trklts, const Double_t p[5], const Double_t cov[15], Double_t x, Double_t alpha);
72   AliTRDtrackV1(const AliESDtrack &ref);
73   AliTRDtrackV1(const AliTRDtrackV1 &ref);
74   virtual ~AliTRDtrackV1();
75   AliTRDtrackV1 &operator=(const AliTRDtrackV1 &ref);
76   virtual void   Copy(TObject &ref) const;
77  
78   Bool_t         CookPID();
79   Bool_t         CookLabel(Float_t wrong);
80   AliTRDtrackV1* GetBackupTrack() const {return fBackupTrack;}
81   Double_t       GetBudget(Int_t i) const { return fBudget[i];}
82   AliTRDcluster* GetCluster(Int_t id);
83   Int_t          GetClusterIndex(Int_t id) const;
84   Float_t        GetEdep() const {return fDE;}
85   Int_t          GetESDid() const {return fESDid;}
86   inline Float_t GetMomentum(Int_t plane=-1) const;
87   inline Int_t   GetNCross();
88   inline Int_t   GetNumberOfTracklets() const;
89   Double_t       GetPIDsignal() const   { return 0.;}
90   Double_t       GetPID(Int_t is) const { return (is >=0 && is < AliPID::kSPECIES) ? fPID[is] : -1.;}
91   UChar_t        GetNumberOfTrackletsPID() const;
92   Double_t       GetPredictedChi2(const AliTRDseedV1 *tracklet, Double_t *cov) const;
93   Double_t       GetPredictedChi2(const AliCluster* /*c*/) const                   { return 0.0; }
94   Int_t          GetProlongation(Double_t xk, Double_t &y, Double_t &z) const;
95   inline UChar_t GetStatusTRD(Int_t ly=-1) const;
96   Int_t          GetSector() const;
97   AliTRDseedV1*  GetTracklet(Int_t plane) const {return plane >=0 && plane <kNplane ? fTracklet[plane] : NULL;}
98   Int_t          GetTrackletIndex(Int_t plane) const          { return (plane>=0 && plane<kNplane) ? fTrackletIndex[plane] : -1;}
99   AliExternalTrackParam*
100                  GetTrackIn() const  { return fTrackLow;} 
101   AliExternalTrackParam*
102                  GetTrackOut() const  { return fTrackHigh;} 
103   const Int_t* GetTrackletIndexes() const { return &fTrackletIndex[0];}
104   
105   Bool_t         IsEqual(const TObject *inTrack) const;
106   Bool_t         IsKink() const    { return TestBit(kKink);}
107   Bool_t         IsOwner() const   { return TestBit(kOwner);};
108   Bool_t         IsPrimary() const   { return TestBit(kPrimary);};
109   Bool_t         IsStopped() const { return TestBit(kStopped);};
110   Bool_t         IsElectron() const;
111   inline static Bool_t IsTrackError(ETRDtrackError error, UInt_t status);
112   inline static Bool_t IsLayerError(ETRDlayerError error, Int_t layer, UInt_t status);
113
114   Int_t          MakeBackupTrack();
115   void           Print(Option_t *o="") const;
116
117   Bool_t         PropagateTo(Double_t xr, Double_t x0 = 8.72, Double_t rho = 5.86e-3);
118   Int_t          PropagateToR(Double_t xr, Double_t step);
119   Bool_t         Rotate(Double_t angle, Bool_t absolute = kFALSE);
120   void           SetBudget(Int_t i, Double_t b) {if(i>=0 && i<3) fBudget[i] = b;}
121   void           SetEdep(Double32_t inDE){fDE = inDE;};
122   void           SetESDid(Int_t id) {fESDid = id;}
123   void           SetKink(Bool_t k)        { SetBit(kKink, k);}
124   void           SetPrimary(Bool_t k)     { SetBit(kPrimary, k);}
125   void           SetNumberOfClusters();
126   UChar_t        SetNumberOfTrackletsPID(Bool_t recalc);
127   void           SetOwner();
128   void           SetPID(Short_t is, Double_t inPID){if (is >=0 && is < AliPID::kSPECIES) fPID[is]=inPID;};
129   void           SetPIDquality(UChar_t /*inPIDquality*/) const {/*fPIDquality = inPIDquality*/;};
130   inline void    SetStatus(UChar_t stat, Int_t ly=-1);
131   void           SetStopped(Bool_t stop) {SetBit(kStopped, stop);}
132   void           SetTracklet(AliTRDseedV1 *const trklt,  Int_t index);
133   void           SetTrackIn();
134   void           SetTrackOut(const AliExternalTrackParam *op=NULL);
135   inline void    SetReconstructor(const AliTRDReconstructor *rec);
136   inline Float_t StatusForTOF();
137   void           UnsetTracklet(Int_t plane);
138   Bool_t         Update(const AliCluster *, Double_t, Int_t) { return kFALSE; };
139   void           UpdateChi2(Float_t chi2);
140   void           UpdateESDtrack(AliESDtrack *t);
141
142 private:
143   UInt_t       fStatus;                //  Bit map for the status of propagation
144   Int_t        fTrackletIndex[kNplane];//  Tracklets index in the tracker list
145   Int_t        fESDid;                 //  ESD track id 
146   Double32_t   fPID[AliPID::kSPECIES]; //  PID probabilities
147   Double32_t   fBudget[3];             //  Integrated material budget
148   Double32_t   fDE;                    //  Integrated delta energy
149   const AliTRDReconstructor *fkReconstructor;//! reconstructor link 
150   AliTRDtrackV1 *fBackupTrack;         //! Backup track
151   AliTRDseedV1  *fTracklet[kNplane];   //  Tracklets array defining the track
152   AliExternalTrackParam *fTrackLow;    // parameters of the track which enter TRD from below (TPC) 
153   AliExternalTrackParam *fTrackHigh;   // parameters of the track which enter TRD from above (HMPID, PHOS) 
154
155   ClassDef(AliTRDtrackV1, 7)          // TRD track - tracklet based
156 };
157
158 //____________________________________________________
159 inline Float_t AliTRDtrackV1::GetMomentum(Int_t plane) const
160 {
161 // Return ESD momentum stored in the tracklet reconstructed in layer = "plane". 
162 // By default returns the ESD momentum in first tracklet attached to track
163   if(plane==-1){
164     for(Int_t i(0); i<kNplane; i++){
165       if(fTracklet[i]) return fTracklet[i]->GetMomentum();
166     }
167   } else if( plane >=0 && plane < kNplane){
168     if(fTracklet[plane]) return fTracklet[plane]->GetMomentum();
169   }
170   return -1.;
171 }
172
173 //____________________________________________________
174 inline Int_t AliTRDtrackV1::GetNCross()
175 {
176   Int_t ncross = 0;
177   for(Int_t ip=0; ip<kNplane; ip++){
178     if(!fTracklet[ip]) continue;
179     ncross += fTracklet[ip]->IsRowCross();
180   }
181   return ncross;
182 }
183
184 //____________________________________________________
185 inline Int_t AliTRDtrackV1::GetNumberOfTracklets() const
186 {
187   Int_t n = 0;
188   for(Int_t ip=0; ip<kNplane; ip++){
189     if(!fTracklet[ip]) continue;
190     n++;
191   }
192   return n;
193 }
194
195 //____________________________________________________
196 inline UChar_t AliTRDtrackV1::GetStatusTRD(Int_t ly) const
197 {
198   if(ly>=-1 && ly<kNplane) return (fStatus>>((ly+1)*4))&0xf;
199   return kUnknown;
200 }
201
202 //____________________________________________________
203 inline Bool_t AliTRDtrackV1::IsTrackError(ETRDtrackError error, UInt_t status)
204 {
205   return (status&0xf)==UChar_t(error);
206 }
207
208 //____________________________________________________
209 inline Bool_t AliTRDtrackV1::IsLayerError(ETRDlayerError error, Int_t ly, UInt_t status)
210 {
211   if(ly>=kNplane || ly<0) return kFALSE;
212   return ((status>>((ly+1)*4))&0xf) == UChar_t(error);
213 }
214
215 //____________________________________________________
216 inline void AliTRDtrackV1::SetReconstructor(const AliTRDReconstructor *rec)
217 {
218   for(Int_t ip=0; ip<kNplane; ip++){
219     if(!fTracklet[ip]) continue;
220     fTracklet[ip]->SetReconstructor(rec);
221   }
222   fkReconstructor = rec;
223 }
224
225 //____________________________________________________
226 inline void AliTRDtrackV1::SetStatus(UChar_t status, Int_t ly)
227 {
228   if(ly<kNplane) fStatus|=((status&0xf)<<((ly+1)*4));
229   return;
230 }
231
232
233 //____________________________________________________________________________
234 inline Float_t AliTRDtrackV1::StatusForTOF()
235 {
236   // OBSOLETE
237   // Defines the status of the TOF extrapolation
238   //
239
240   if(!fTracklet[5]) return 0.;
241
242   // Definition of res ????
243   Float_t res = /*(0.2 + 0.8 * (fN / (fNExpected + 5.0))) **/ (0.4 + 0.6 * fTracklet[5]->GetN() / 20.0);
244   res *= (0.25 + 0.8 * 40.0 / (40.0 + fBudget[2]));
245   return res;
246 }
247
248 #endif
249
250
251