]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITStrackV2.h
Added mat.budget estimation macro
[u/mrichter/AliRoot.git] / ITS / AliITStrackV2.h
CommitLineData
006b5f7f 1#ifndef ALIITSTRACKV2_H
2#define ALIITSTRACKV2_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6//-------------------------------------------------------------------------
7// ITS Track Class
8//
9// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
a9a2d814 10// dEdx analysis by: Boris Batyunya, JINR, Boris.Batiounia@cern.ch
006b5f7f 11//-------------------------------------------------------------------------
12
006b5f7f 13#include <AliKalmanTrack.h>
44347160 14#include "AliITSRecoParam.h"
e50912db 15#include "AliITSgeomTGeo.h"
d3dbf323 16#include "AliESDtrack.h"
006b5f7f 17
ae00569a 18/* $Id$ */
19
58e536c5 20class AliESDVertex;
f7a1cc68 21class AliTracker;
006b5f7f 22
23//_____________________________________________________________________________
8676d691 24class AliITStrackV2 : public AliKalmanTrack {
006b5f7f 25public:
22b13da0 26 AliITStrackV2();
763bdf3e 27 AliITStrackV2(AliESDtrack& t,Bool_t c=kFALSE);
006b5f7f 28 AliITStrackV2(const AliITStrackV2& t);
43d2197f 29 ~AliITStrackV2(){fESDtrack=0;}
6c94f330 30
545af9ef 31 void SetCheckInvariant(Bool_t check=kTRUE) {fCheckInvariant=check;}
e50912db 32 Bool_t CorrectForMeanMaterial(Double_t xOverX0, Double_t xTimesRho,
33 Bool_t anglecorr=kFALSE) {
34 return AliExternalTrackParam::CorrectForMeanMaterial(xOverX0,xTimesRho,GetMass(),anglecorr);
35 }
36 Bool_t CorrectForMaterial(Double_t d, Double_t x0=AliITSRecoParam::GetX0Air()) {
37 // deprecated: use CorrectForMeanMaterial instead
6c94f330 38 return AliExternalTrackParam::CorrectForMaterial(d,x0,GetMass());
39 }
e50912db 40 Bool_t PropagateTo(Double_t xr, Double_t d, Double_t x0=AliITSRecoParam::GetX0Air());
db355ee7 41 Bool_t PropagateToTGeo(Double_t xToGo, Int_t nstep, Double_t &xOverX0, Double_t &xTimesRho, Bool_t addTime=kTRUE);
42 Bool_t PropagateToTGeo(Double_t xToGo, Int_t nstep=1, Bool_t addTime=kTRUE) {
43 Double_t dummy1,dummy2; return PropagateToTGeo(xToGo,nstep,dummy1,dummy2,addTime);
afd25725 44 }
6c94f330 45 Double_t GetPredictedChi2(const AliCluster *cluster) const;
46 Bool_t Update(const AliCluster *cl, Double_t chi2, Int_t i);
47
e50912db 48 Bool_t PropagateToVertex(const AliESDVertex *v,Double_t d=0.,Double_t x0=0.);
6c94f330 49 Bool_t Propagate(Double_t alpha, Double_t xr);
9be1d1c7 50 Bool_t Propagate(Double_t xr) { return Propagate(GetAlpha(),xr); }
afd25725 51 Bool_t MeanBudgetToPrimVertex(Double_t xyz[3], Double_t step, Double_t &d) const;
6c94f330 52 Bool_t Improve(Double_t x0,Double_t xyz[3],Double_t ers[3]);
a4354152 53 Bool_t ImproveKalman(Double_t xyz[3],Double_t ers[3], const Double_t* xlMS, const Double_t* x2X0MS, Int_t nMS);
7f6ddf58 54 void SetdEdx(Double_t dedx) {fdEdx=dedx;}
a9a2d814 55 void SetSampledEdx(Float_t q, Int_t i);
b9671574 56 Float_t GetSampledEdx(Int_t i) const {return fdEdxSample[i];}
a9a2d814 57 void CookdEdx(Double_t low=0., Double_t up=0.51);
006b5f7f 58 void SetDetectorIndex(Int_t i) {SetLabel(i);}
7ac23097 59 void ResetClusters();
15dd636f 60 void UpdateESDtrack(ULong_t flags) const;
e43c066c 61
1aedd96e 62 AliESDtrack *GetESDtrack() const {return fESDtrack;}
d3dbf323 63 virtual ULong_t GetStatus() const {
64 if(fESDtrack){return fESDtrack->GetStatus();}
65 else { AliWarning("null ESD track pointer - status 0"); return 0;} }
e43c066c 66
006b5f7f 67 Int_t GetDetectorIndex() const {return GetLabel();}
7f6ddf58 68 Double_t GetdEdx() const {return fdEdx;}
83d73500 69 Double_t GetPIDsignal() const {return GetdEdx();}
df37c864 70 using AliExternalTrackParam::GetC;
6c94f330 71 Double_t GetC() const {return AliExternalTrackParam::GetC(GetBz());}
72 Double_t GetD(Double_t x, Double_t y) const {
73 return AliExternalTrackParam::GetD(x,y,GetBz());
74 }
d3b046c5 75 using AliExternalTrackParam::GetDZ;
6c94f330 76 void GetDZ(Double_t xv, Double_t yv, Double_t zv, Float_t dz[2]) const {
77 return AliExternalTrackParam::GetDZ(xv,yv,zv,GetBz(),dz);
78 }
79
e50912db 80 Bool_t GetGlobalXYZat(Double_t xloc,Double_t &x,Double_t &y,Double_t &z) const;
8602c008 81 Bool_t GetPhiZat(Double_t r,Double_t &phi,Double_t &z) const;
e50912db 82 Bool_t GetLocalXat(Double_t r,Double_t &xloc) const;
6c94f330 83
006b5f7f 84 Int_t Compare(const TObject *o) const;
006b5f7f 85 Int_t GetClusterIndex(Int_t i) const {return fIndex[i];}
ae00569a 86 void SetModuleIndex(Int_t ilayer,Int_t idx) {fModule[ilayer]=idx;}
87 Int_t GetModuleIndex(Int_t ilayer) const {return fModule[ilayer];}
88 void SetModuleIndexInfo(Int_t ilayer,Int_t idet,Int_t status=1,Float_t xloc=0,Float_t zloc=0);
89 Bool_t GetModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status,Float_t &xloc,Float_t &zloc) const;
25015f7a 90 void SetSharedWeight(Int_t ilayer,Float_t w) {fSharedWeight[ilayer]=w;}
91 Float_t GetSharedWeight(Int_t ilayer) const {return fSharedWeight[ilayer];}
6c94f330 92 Bool_t Invariant() const;
ef7253ac 93
ae00569a 94 void SetExtraCluster(Int_t ilayer, Int_t idx) {fIndex[AliITSgeomTGeo::kNLayers+ilayer]=idx;}
95 Int_t GetExtraCluster(Int_t ilayer) const {return fIndex[AliITSgeomTGeo::kNLayers+ilayer];}
96
97 void SetExtraModule(Int_t ilayer, Int_t idx) {fModule[AliITSgeomTGeo::kNLayers+ilayer]=idx;}
98 Int_t GetExtraModule(Int_t ilayer) const {return fModule[AliITSgeomTGeo::kNLayers+ilayer];}
c84a5e9e 99
6c94f330 100protected:
545af9ef 101
102 Bool_t fCheckInvariant; // check the covariance matrix
103
6c94f330 104 Double_t fdEdx; // dE/dx
8602c008 105
106 static const Int_t fgkWARN; //! used for debugging purposes
6c94f330 107 Float_t fdEdxSample[4]; // array of dE/dx samples b.b.
15dd636f 108
e50912db 109 Int_t fIndex[2*AliITSgeomTGeo::kNLayers]; // indices of associated clusters
15dd636f 110
ae00569a 111 Int_t fModule[2*AliITSgeomTGeo::kNLayers]; // indices of crossed modules:
112 // see SetModuleIndexInfo()
25015f7a 113
114 Float_t fSharedWeight[AliITSgeomTGeo::kNLayers]; // probability of sharing
115
ef7253ac 116 AliESDtrack *fESDtrack; //! pointer to the connected ESD track
006b5f7f 117
6c94f330 118private:
119 AliITStrackV2 &operator=(const AliITStrackV2 &tr);
25015f7a 120 ClassDef(AliITStrackV2,9) //ITS reconstructed track
6c94f330 121};
a9a2d814 122
ae00569a 123inline void AliITStrackV2::SetSampledEdx(Float_t q, Int_t i) {
23efe5f1 124 //----------------------------------------------------------------------
a9a2d814 125 // This function stores dEdx sample corrected for the track segment length
126 // Origin: Boris Batyunya, JINR, Boris.Batiounia@cern.ch
23efe5f1 127 //----------------------------------------------------------------------
a9a2d814 128 if (i<0) return;
129 if (i>3) return;
23efe5f1 130 Double_t s=GetSnp(), t=GetTgl();
23efe5f1 131 q *= TMath::Sqrt((1-s*s)/(1+t*t));
132 fdEdxSample[i]=q;
ae00569a 133 return;
23efe5f1 134}
c84a5e9e 135
ae00569a 136inline void AliITStrackV2::SetModuleIndexInfo(Int_t ilayer,Int_t idet,Int_t status,
137 Float_t xloc,Float_t zloc) {
138 //----------------------------------------------------------------------
139 // This function encodes in the module number also the status of cluster association
140 // "status" can have the following values:
141 // 1 "found" (cluster is associated),
142 // 2 "dead" (module is dead from OCDB),
143 // 3 "skipped" (module or layer forced to be skipped),
144 // 4 "outinz" (track out of z acceptance),
145 // 5 "nocls" (no clusters in the road),
146 // 6 "norefit" (cluster rejected during refit)
147 // 7 "deadzspd" (holes in z in SPD)
148 // WARNING: THIS METHOD HAS TO BE SYNCHRONIZED WITH AliESDtrack::GetITSModuleIndexInfo()!
149 //----------------------------------------------------------------------
150
151 if(idet<0) {
152 idet=0;
153 } else {
154 // same detector numbering as in AliITSCalib classes
155 if(ilayer==1) idet+=AliITSgeomTGeo::GetNLadders(1)*AliITSgeomTGeo::GetNDetectors(1);
156 if(ilayer==3) idet+=AliITSgeomTGeo::GetNLadders(3)*AliITSgeomTGeo::GetNDetectors(3);
157 if(ilayer==5) idet+=AliITSgeomTGeo::GetNLadders(5)*AliITSgeomTGeo::GetNDetectors(5);
158 }
159
160 Int_t xInt = Int_t(xloc*10.);
161 Int_t zInt = Int_t(zloc*10.);
162
5af4a2d0 163 if(TMath::Abs(xloc*10.-(Float_t)xInt)>0.5){
164 if(zloc>0) {
165 xInt++;
166 }
167 else {
168 xInt--;
169 }
170 }
171 if(TMath::Abs(zloc*10.-(Float_t)zInt)>0.5){
172 if(zloc>0) {
173 zInt++;
174 }
175 else {
176 zInt--;
177 }
178 }
ae00569a 179 Int_t signs=0;
180 if(xInt>=0 && zInt>=0) signs=10000;
181 if(xInt>=0 && zInt<0) signs=20000;
182 if(xInt<0 && zInt>=0) signs=30000;
183 if(xInt<0 && zInt<0) signs=40000;
184
185 Int_t modindex = signs;
186
187 modindex += TMath::Abs(zInt);
188 modindex += TMath::Abs(xInt)*100;
189
190 modindex += status*100000;
191
192 modindex += idet*1000000;
193
194 SetModuleIndex(ilayer,modindex);
195 return;
196}
197
198inline Bool_t AliITStrackV2::GetModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status,
199 Float_t &xloc,Float_t &zloc) const {
200 //----------------------------------------------------------------------
201 // This function encodes in the module number also the status of cluster association
202 // "status" can have the following values:
203 // 1 "found" (cluster is associated),
204 // 2 "dead" (module is dead from OCDB),
205 // 3 "skipped" (module or layer forced to be skipped),
206 // 4 "outinz" (track out of z acceptance),
207 // 5 "nocls" (no clusters in the road),
208 // 6 "norefit" (cluster rejected during refit),
209 // 7 "deadzspd" (holes in z in SPD)
210 // Also given are the coordinates of the crossing point of track and module
211 // (in the local module ref. system)
212 // WARNING: THIS METHOD HAS TO BE SYNCHRONIZED WITH AliESDtrack::GetITSModuleIndexInfo()!
213 //----------------------------------------------------------------------
214
215
216 if(fModule[ilayer]==-1) {
217 AliError("fModule was not set !");
218 idet = -1;
219 status=0;
220 xloc=-99.; zloc=-99.;
221 return kFALSE;
222 }
223
224 Int_t module = fModule[ilayer];
225
226 idet = Int_t(module/1000000);
227
228 module -= idet*1000000;
229
230 status = Int_t(module/100000);
231
232 module -= status*100000;
233
234 Int_t signs = Int_t(module/10000);
235
236 module-=signs*10000;
237
238 Int_t xInt = Int_t(module/100);
239 module -= xInt*100;
240
241 Int_t zInt = module;
242
243 if(signs==1) { xInt*=1; zInt*=1; }
244 if(signs==2) { xInt*=1; zInt*=-1; }
245 if(signs==3) { xInt*=-1; zInt*=1; }
246 if(signs==4) { xInt*=-1; zInt*=-1; }
247
248 xloc = 0.1*(Float_t)xInt;
249 zloc = 0.1*(Float_t)zInt;
250
251 if(status==4) idet = -1;
252
253 return kTRUE;
254}
255
256
006b5f7f 257#endif
258
259