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