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