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