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