pass the EMCAL transformation matrices only once and not all the vevents; remove...
[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{
3044dfe5 27 friend class AliHLTTRDTrack;
3b57a3f7 28public:
eb2b4f91 29 enum ETRDtrackSize {
e3cf3d02 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 };
3b57a3f7 39
2e2915e7 40 // bits from 0-13 are reserved by ROOT (see TObject.h)
eb2b4f91 41 enum ETRDtrackStatus {
42 kOwner = BIT(14)
43 ,kStopped = BIT(15)
44 ,kKink = BIT(16)
2eb10c34 45 ,kPrimary = BIT(17)
eb2b4f91 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
af4e990c 56 ,kUnknown = 0xff
eb2b4f91 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
e44586fb 68 };
0906e73e 69
3b57a3f7 70 AliTRDtrackV1();
e17f4785 71 AliTRDtrackV1(AliTRDseedV1 * const trklts, const Double_t p[5], const Double_t cov[15], Double_t x, Double_t alpha);
3b57a3f7 72 AliTRDtrackV1(const AliESDtrack &ref);
73 AliTRDtrackV1(const AliTRDtrackV1 &ref);
74 virtual ~AliTRDtrackV1();
75 AliTRDtrackV1 &operator=(const AliTRDtrackV1 &ref) { *(new(this) AliTRDtrackV1(ref)); return *this; }
76
77 Bool_t CookPID();
78 Bool_t CookLabel(Float_t wrong);
79 AliTRDtrackV1* GetBackupTrack() const {return fBackupTrack;}
80 Double_t GetBudget(Int_t i) const { return fBudget[i];}
0349cc67 81 AliTRDcluster* GetCluster(Int_t id);
3b57a3f7 82 Int_t GetClusterIndex(Int_t id) const;
83 Float_t GetEdep() const {return fDE;}
352cef8f 84 Int_t GetESDid() const {return fESDid;}
3b57a3f7 85 inline Float_t GetMomentum(Int_t plane) const;
86 inline Int_t GetNCross();
82180ec1 87 inline Int_t GetNumberOfTracklets() const;
1128e139 88 Double_t GetPIDsignal() const { return 0.;}
3b57a3f7 89 Double_t GetPID(Int_t is) const { return (is >=0 && is < AliPID::kSPECIES) ? fPID[is] : -1.;}
eb2b4f91 90 UChar_t GetNumberOfTrackletsPID() const;
b72f4eaf 91 Double_t GetPredictedChi2(const AliTRDseedV1 *tracklet, Double_t *cov) const;
3b57a3f7 92 Double_t GetPredictedChi2(const AliCluster* /*c*/) const { return 0.0; }
93 Int_t GetProlongation(Double_t xk, Double_t &y, Double_t &z);
eb2b4f91 94 inline UChar_t GetStatusTRD(Int_t ly=-1) const;
95 Int_t GetSector() const;
4d6aee34 96 AliTRDseedV1* GetTracklet(Int_t plane) const {return plane >=0 && plane <kNplane ? fTracklet[plane] : NULL;}
e3cf3d02 97 Int_t GetTrackletIndex(Int_t plane) const { return (plane>=0 && plane<kNplane) ? fTrackletIndex[plane] : -1;}
98 AliExternalTrackParam*
a310e49b 99 GetTrackIn() const { return fTrackLow;}
e3cf3d02 100 AliExternalTrackParam*
a310e49b 101 GetTrackOut() const { return fTrackHigh;}
17896e82 102 const Int_t* GetTrackletIndexes() const { return &fTrackletIndex[0];}
3b57a3f7 103
203967fc 104 Bool_t IsEqual(const TObject *inTrack) const;
f29f13a6 105 Bool_t IsKink() const { return TestBit(kKink);}
106 Bool_t IsOwner() const { return TestBit(kOwner);};
2eb10c34 107 Bool_t IsPrimary() const { return TestBit(kPrimary);};
f29f13a6 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
b453ef55 113 Int_t 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;};
352cef8f 121 void SetESDid(Int_t id) {fESDid = id;}
f29f13a6 122 void SetKink(Bool_t k) { SetBit(kKink, k);}
2eb10c34 123 void SetPrimary(Bool_t k) { SetBit(kPrimary, k);}
3b57a3f7 124 void SetNumberOfClusters();
eb2b4f91 125 UChar_t SetNumberOfTrackletsPID(Bool_t recalc);
3b57a3f7 126 void SetOwner();
bee2b41e 127 void SetPID(Short_t is, Double_t inPID){if (is >=0 && is < AliPID::kSPECIES) fPID[is]=inPID;};
4d6aee34 128 void SetPIDquality(UChar_t /*inPIDquality*/) const {/*fPIDquality = inPIDquality*/;};
eb2b4f91 129 inline void SetStatus(UChar_t stat, Int_t ly=-1);
e44586fb 130 void SetStopped(Bool_t stop) {SetBit(kStopped, stop);}
4d6aee34 131 void SetTracklet(AliTRDseedV1 *const trklt, Int_t index);
a310e49b 132 void SetTrackIn();
133 void SetTrackOut(const AliExternalTrackParam *op=NULL);
181c7f7e 134 inline void SetReconstructor(const AliTRDReconstructor *rec);
3b57a3f7 135 inline Float_t StatusForTOF();
181d2c97 136 void UnsetTracklet(Int_t plane);
b06a50a5 137 Bool_t Update(Double_t *p, Double_t *cov, Double_t chi2, Bool_t useTRD=kTRUE);
4d6aee34 138 Bool_t Update(const AliCluster *, Double_t, Int_t) { return kFALSE; };
3b57a3f7 139 void UpdateESDtrack(AliESDtrack *t);
3b57a3f7 140
141private:
eb2b4f91 142 UInt_t fStatus; // Bit map for the status of propagation
17896e82 143 Int_t fTrackletIndex[kNplane];// Tracklets index in the tracker list
352cef8f 144 Int_t fESDid; // ESD track id
eb2b4f91 145 Double32_t fPID[AliPID::kSPECIES]; // PID probabilities
146 Double32_t fBudget[3]; // Integrated material budget
147 Double32_t fDE; // Integrated delta energy
4d6aee34 148 const AliTRDReconstructor *fkReconstructor;//! reconstructor link
eb2b4f91 149 AliTRDtrackV1 *fBackupTrack; //! Backup track
17896e82 150 AliTRDseedV1 *fTracklet[kNplane]; // Tracklets array defining the track
eb2b4f91 151 AliExternalTrackParam *fTrackLow; // parameters of the track which enter TRD from below (TPC)
17896e82 152 AliExternalTrackParam *fTrackHigh; // parameters of the track which enter TRD from above (HMPID, PHOS)
d9950a5a 153
352cef8f 154 ClassDef(AliTRDtrackV1, 7) // TRD track - tracklet based
d9950a5a 155};
156
3b57a3f7 157//____________________________________________________
158inline Float_t AliTRDtrackV1::GetMomentum(Int_t plane) const
159{
17896e82 160 return plane >=0 && plane < kNplane && fTrackletIndex[plane] != -1 ? fTracklet[plane]->GetMomentum() : -1.;
3b57a3f7 161}
162
163//____________________________________________________
164inline Int_t AliTRDtrackV1::GetNCross()
165{
166 Int_t ncross = 0;
167 for(Int_t ip=0; ip<kNplane; ip++){
168 if(!fTracklet[ip]) continue;
169 ncross += fTracklet[ip]->IsRowCross();
170 }
171 return ncross;
172}
173
82180ec1 174//____________________________________________________
175inline Int_t AliTRDtrackV1::GetNumberOfTracklets() const
176{
177 Int_t n = 0;
178 for(Int_t ip=0; ip<kNplane; ip++){
179 if(!fTracklet[ip]) continue;
180 n++;
181 }
182 return n;
183}
184
eb2b4f91 185//____________________________________________________
186inline UChar_t AliTRDtrackV1::GetStatusTRD(Int_t ly) const
187{
af4e990c 188 if(ly>=-1 && ly<kNplane) return (fStatus>>((ly+1)*4))&0xf;
189 return kUnknown;
eb2b4f91 190}
191
192//____________________________________________________
193inline Bool_t AliTRDtrackV1::IsTrackError(ETRDtrackError error, UInt_t status)
194{
195 return (status&0xf)==UChar_t(error);
196}
197
198//____________________________________________________
199inline Bool_t AliTRDtrackV1::IsLayerError(ETRDlayerError error, Int_t ly, UInt_t status)
200{
201 if(ly>=kNplane || ly<0) return kFALSE;
202 return ((status>>((ly+1)*4))&0xf) == UChar_t(error);
203}
181c7f7e 204
205//____________________________________________________
206inline void AliTRDtrackV1::SetReconstructor(const AliTRDReconstructor *rec)
207{
208 for(Int_t ip=0; ip<kNplane; ip++){
209 if(!fTracklet[ip]) continue;
210 fTracklet[ip]->SetReconstructor(rec);
211 }
4d6aee34 212 fkReconstructor = rec;
181c7f7e 213}
214
eb2b4f91 215//____________________________________________________
216inline void AliTRDtrackV1::SetStatus(UChar_t status, Int_t ly)
217{
218 if(ly<kNplane) fStatus|=((status&0xf)<<((ly+1)*4));
219 return;
220}
221
181c7f7e 222
3b57a3f7 223//____________________________________________________________________________
224inline Float_t AliTRDtrackV1::StatusForTOF()
225{
eb2b4f91 226 // OBSOLETE
3b57a3f7 227 // Defines the status of the TOF extrapolation
228 //
229
230 if(!fTracklet[5]) return 0.;
231
232 // Definition of res ????
233 Float_t res = /*(0.2 + 0.8 * (fN / (fNExpected + 5.0))) **/ (0.4 + 0.6 * fTracklet[5]->GetN() / 20.0);
234 res *= (0.25 + 0.8 * 40.0 / (40.0 + fBudget[2]));
235 return res;
236}
d9950a5a 237
238#endif
239
240
6e49cfdb 241