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