]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliITStrackerMI.h
correcting printf format specifiers
[u/mrichter/AliRoot.git] / ITS / AliITStrackerMI.h
... / ...
CommitLineData
1#ifndef ALIITSTRACKERMI_H
2#define ALIITSTRACKERMI_H
3/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
8//-------------------------------------------------------------------------
9// ITS tracker
10// reads AliITSclusterMI clusters and creates AliITStrackMI tracks
11// Origin: Marian Ivanov, CERN, Marian.Ivanov@cern.ch
12// Current support and development:
13// Andrea Dainese, andrea.dainese@lnl.infn.it
14//-------------------------------------------------------------------------
15
16class TTree;
17class TTreeSRedirector;
18class AliESDEvent;
19
20class AliITSPlaneEff;
21class AliITSChannelStatus;
22class AliITSDetTypeRec;
23class AliPlaneEff;
24
25#include <TObjArray.h>
26
27#include "AliITStrackMI.h"
28#include "AliITSRecPoint.h"
29#include "AliTracker.h"
30
31
32//-------------------------------------------------------------------------
33class AliITStrackerMI : public AliTracker {
34public:
35 AliITStrackerMI();
36 AliITStrackerMI(const Char_t *geom);
37 virtual ~AliITStrackerMI();
38 AliCluster *GetCluster(Int_t index) const;
39 virtual Bool_t GetTrackPoint(Int_t index, AliTrackPoint& p) const;
40 virtual Bool_t GetTrackPointTrackingError(Int_t index,
41 AliTrackPoint& p, const AliESDtrack *t);
42 AliITSRecPoint *GetClusterLayer(Int_t layn, Int_t ncl) const
43 {return fgLayers[layn].GetCluster(ncl);}
44 Int_t GetNumberOfClustersLayer(Int_t layn) const
45 {return fgLayers[layn].GetNumberOfClusters();}
46 Int_t LoadClusters(TTree *cf);
47 void UnloadClusters();
48 void FillClusterArray(TObjArray* array) const;
49 Int_t Clusters2Tracks(AliESDEvent *event);
50 Int_t PropagateBack(AliESDEvent *event);
51 Int_t RefitInward(AliESDEvent *event);
52 Bool_t RefitAt(Double_t x, AliITStrackMI *track,
53 const AliITStrackMI *clusters, Bool_t extra=kFALSE, Bool_t planeeff=kFALSE);
54 Bool_t RefitAt(Double_t x, AliITStrackMI *track,
55 const Int_t *clusters, Bool_t extra=kFALSE, Bool_t planeeff=kFALSE);
56 void SetupFirstPass(const Int_t *flags,const Double_t *cuts=0);
57 void SetupSecondPass(const Int_t *flags,const Double_t *cuts=0);
58
59 void SetLastLayerToTrackTo(Int_t l=0) {fLastLayerToTrackTo=l;}
60 void UseClusters(const AliKalmanTrack *t, Int_t from=0) const;
61
62 void GetDCASigma(const AliITStrackMI* track, Float_t & sigmarfi, Float_t &sigmaz);
63 Double_t GetPredictedChi2MI(AliITStrackMI* track, const AliITSRecPoint *cluster,Int_t layer);
64 Int_t UpdateMI(AliITStrackMI* track, const AliITSRecPoint* cl,Double_t chi2,Int_t layer) const;
65 AliPlaneEff *GetPlaneEff() {return (AliPlaneEff*)fPlaneEff;} // return the pointer to AliPlaneEff
66 void SetDetTypeRec(const AliITSDetTypeRec *detTypeRec) {fkDetTypeRec = detTypeRec; ReadBadFromDetTypeRec(); }
67 TObjArray* GetTrackHypothesys() {return &fTrackHypothesys;}
68 TObjArray* GetBestHypothesys() {return &fBestHypothesys;}
69 TObjArray* GetOriginal() {return &fOriginal;}
70 TTreeSRedirector *GetDebugStreamer() const {return fDebugStreamer;}
71 static Int_t CorrectForTPCtoITSDeadZoneMaterial(AliITStrackMI *t);
72 void SetForceSkippingOfLayer();
73 Int_t ForceSkippingOfLayer(Int_t l) const { return fForceSkippingOfLayer[l]; }
74
75 class AliITSdetector {
76 public:
77 AliITSdetector():fR(0),fRmisal(0),fPhi(0),fSinPhi(0),fCosPhi(0),fYmin(0),fYmax(0),fZmin(0),fZmax(0),fIsBad(kFALSE),fNChips(0),fChipIsBad(0) {}
78 AliITSdetector(Double_t r,Double_t phi):fR(r),fRmisal(r),fPhi(phi),fSinPhi(TMath::Sin(phi)),fCosPhi(TMath::Cos(phi)),fYmin(10000),fYmax(-1000),fZmin(10000),fZmax(-1000),fIsBad(kFALSE),fNChips(0),fChipIsBad(0) {}
79 ~AliITSdetector() {if(fChipIsBad) delete [] fChipIsBad;}
80 inline void GetGlobalXYZ( const AliITSRecPoint *cl, Double_t xyz[3]) const;
81 Double_t GetR() const {return fR;}
82 Double_t GetRmisal() const {return fRmisal;}
83 Double_t GetPhi() const {return fPhi;}
84 Double_t GetYmin() const {return fYmin;}
85 Double_t GetYmax() const {return fYmax;}
86 Double_t GetZmin() const {return fZmin;}
87 Double_t GetZmax() const {return fZmax;}
88 Bool_t IsBad() const {return fIsBad;}
89 Int_t GetNChips() const {return fNChips;}
90 Bool_t IsChipBad(Int_t iChip) const {return (fChipIsBad ? fChipIsBad[iChip] : kFALSE);}
91 void SetRmisal(Double_t rmisal) {fRmisal = rmisal;}
92 void SetYmin(Double_t min) {fYmin = min;}
93 void SetYmax(Double_t max) {fYmax = max;}
94 void SetZmin(Double_t min) {fZmin = min;}
95 void SetZmax(Double_t max) {fZmax = max;}
96 void SetBad() {fIsBad = kTRUE;}
97 void ReadBadDetectorAndChips(Int_t ilayer,Int_t idet,const AliITSDetTypeRec *detTypeRec);
98 private:
99 AliITSdetector(const AliITSdetector& det);
100 AliITSdetector & operator=(const AliITSdetector& det){
101 this->~AliITSdetector();new(this) AliITSdetector(det);
102 return *this;}
103 Double_t fR; // polar coordinates: r
104 Double_t fRmisal; // polar coordinates: r, with misalignment
105 Double_t fPhi; // polar coordinates: phi
106 Double_t fSinPhi; // sin of phi;
107 Double_t fCosPhi; // cos of phi
108 Double_t fYmin; // local y minimal
109 Double_t fYmax; // local max y
110 Double_t fZmin; // local z min
111 Double_t fZmax; // local z max
112 Bool_t fIsBad; // is detector dead or noisy?
113 Int_t fNChips; // number of chips
114 Bool_t *fChipIsBad; //[fNChips] is chip dead or noisy?
115 };
116
117 class AliITSlayer {
118 public:
119 AliITSlayer();
120 AliITSlayer(Double_t r, Double_t p, Double_t z, Int_t nl, Int_t nd);
121 ~AliITSlayer();
122 Int_t InsertCluster(AliITSRecPoint *c);
123 void SortClusters();
124 void ResetClusters();
125 void ResetWeights();
126 void SelectClusters(Double_t zmin,Double_t zmax,Double_t ymin,Double_t ymax);
127 const AliITSRecPoint *GetNextCluster(Int_t &ci,Bool_t test=kFALSE);
128 void ResetRoad();
129 Double_t GetRoad() const {return fRoad;}
130 Double_t GetR() const {return fR;}
131 Int_t FindClusterIndex(Float_t z) const;
132 AliITSRecPoint *GetCluster(Int_t i) const {return i<fN ? fClusters[i]:0;}
133 Float_t *GetWeight(Int_t i) {return i<fN ? &fClusterWeight[i]:0;}
134 AliITSdetector &GetDetector(Int_t n) const { return fDetectors[n]; }
135 Int_t FindDetectorIndex(Double_t phi, Double_t z) const;
136 Double_t GetThickness(Double_t y, Double_t z, Double_t &x0) const;
137 Int_t InRoad() const ;
138 Int_t GetNumberOfClusters() const {return fN;}
139 Int_t GetNladders() const {return fNladders;}
140 Int_t GetNdetectors() const {return fNdetectors;}
141 Int_t GetSkip() const {return fSkip;}
142 void SetSkip(Int_t skip){fSkip=skip;}
143 void IncAccepted(){fAccepted++;}
144 Int_t GetAccepted() const {return fAccepted;}
145 Int_t GetClusterTracks(Int_t i, Int_t j) const {return fClusterTracks[i][j];}
146 void SetClusterTracks(Int_t i, Int_t j, Int_t c) {fClusterTracks[i][j]=c;}
147 protected:
148 AliITSlayer(const AliITSlayer& layer);
149 AliITSlayer & operator=(const AliITSlayer& layer){
150 this->~AliITSlayer();new(this) AliITSlayer(layer);
151 return *this;}
152 Double_t fR; // mean radius of this layer
153 Double_t fPhiOffset; // offset of the first detector in Phi
154 Int_t fNladders; // number of ladders
155 Double_t fZOffset; // offset of the first detector in Z
156 Int_t fNdetectors; // detectors/ladder
157 AliITSdetector *fDetectors; // array of detectors
158 Int_t fN; // number of clusters
159 AliITSRecPoint *fClusters[AliITSRecoParam::fgkMaxClusterPerLayer]; // pointers to clusters
160 Int_t fClusterIndex[AliITSRecoParam::fgkMaxClusterPerLayer]; // pointers to clusters
161 Float_t fY[AliITSRecoParam::fgkMaxClusterPerLayer]; // y position of the clusters
162 Float_t fZ[AliITSRecoParam::fgkMaxClusterPerLayer]; // z position of the clusters
163 Float_t fYB[2]; // ymin and ymax
164 //
165 AliITSRecPoint *fClusters5[6][AliITSRecoParam::fgkMaxClusterPerLayer5]; // pointers to clusters - slice in y
166 Int_t fClusterIndex5[6][AliITSRecoParam::fgkMaxClusterPerLayer5]; // pointers to clusters - slice in y
167 Float_t fY5[6][AliITSRecoParam::fgkMaxClusterPerLayer5]; // y position of the clusters slice in y
168 Float_t fZ5[6][AliITSRecoParam::fgkMaxClusterPerLayer5]; // z position of the clusters slice in y
169 Int_t fN5[6]; // number of cluster in slice
170 Float_t fDy5; //delta y
171 Float_t fBy5[6][2]; //slice borders
172 //
173 AliITSRecPoint *fClusters10[11][AliITSRecoParam::fgkMaxClusterPerLayer10]; // pointers to clusters - slice in y
174 Int_t fClusterIndex10[11][AliITSRecoParam::fgkMaxClusterPerLayer10]; // pointers to clusters - slice in y
175 Float_t fY10[11][AliITSRecoParam::fgkMaxClusterPerLayer10]; // y position of the clusters slice in y
176 Float_t fZ10[11][AliITSRecoParam::fgkMaxClusterPerLayer10]; // z position of the clusters slice in y
177 Int_t fN10[11]; // number of cluster in slice
178 Float_t fDy10; // delta y
179 Float_t fBy10[11][2]; // slice borders
180 //
181 AliITSRecPoint *fClusters20[21][AliITSRecoParam::fgkMaxClusterPerLayer20]; // pointers to clusters - slice in y
182 Int_t fClusterIndex20[21][AliITSRecoParam::fgkMaxClusterPerLayer20]; // pointers to clusters - slice in y
183 Float_t fY20[21][AliITSRecoParam::fgkMaxClusterPerLayer20]; // y position of the clusters slice in y
184 Float_t fZ20[21][AliITSRecoParam::fgkMaxClusterPerLayer20]; // z position of the clusters slice in y
185 Int_t fN20[21]; // number of cluster in slice
186 Float_t fDy20; //delta y
187 Float_t fBy20[21][2]; //slice borders
188 //
189 AliITSRecPoint** fClustersCs; //clusters table in current slice
190 Int_t *fClusterIndexCs; //cluster index in current slice
191 Float_t *fYcs; //y position in current slice
192 Float_t *fZcs; //z position in current slice
193 Int_t fNcs; //number of clusters in current slice
194 Int_t fCurrentSlice; //current slice
195 //
196 Float_t fClusterWeight[AliITSRecoParam::fgkMaxClusterPerLayer]; // probabilistic weight of the cluster
197 Int_t fClusterTracks[4][AliITSRecoParam::fgkMaxClusterPerLayer]; //tracks registered to given cluster
198 Float_t fZmin; // the
199 Float_t fZmax; // edges
200 Float_t fYmin; // of the
201 Float_t fYmax; // "window"
202 Int_t fI; // index of the current cluster within the "window"
203 Int_t fImax; // index of the last cluster within the "window"
204 Int_t fSkip; // indicates possibility to skip cluster
205 Int_t fAccepted; // accept indicator
206 Double_t fRoad; // road defined by the cluster density
207 Double_t fMaxSigmaClY; // maximum cluster error Y (to enlarge road)
208 Double_t fMaxSigmaClZ; // maximum cluster error Z (to enlarge road)
209 Double_t fNMaxSigmaCl; // number of sigma for road enlargement
210 };
211 AliITStrackerMI::AliITSlayer & GetLayer(Int_t layer) const;
212 AliITStrackerMI::AliITSdetector & GetDetector(Int_t layer, Int_t n) const {return GetLayer(layer).GetDetector(n); }
213 Int_t GetNearestLayer(const Double_t *xr) const; //get nearest upper layer close to the point xr
214 void SetCurrentEsdTrack(Int_t i) {fCurrentEsdTrack=i;}
215 void FollowProlongationTree(AliITStrackMI * otrack, Int_t esdindex, Bool_t constrain);
216
217protected:
218 Bool_t ComputeRoad(AliITStrackMI* track,Int_t ilayer,Int_t idet,Double_t &zmin,Double_t &zmax,Double_t &ymin,Double_t &ymax) const;
219
220 void CookLabel(AliKalmanTrack *t,Float_t wrong) const;
221 void CookLabel(AliITStrackMI *t,Float_t wrong) const;
222 Double_t GetEffectiveThickness();
223 void ResetBestTrack() {
224 fBestTrack.~AliITStrackMI();
225 new(&fBestTrack) AliITStrackMI(fTrackToFollow);
226 }
227 void ResetTrackToFollow(const AliITStrackMI &t) {
228 fTrackToFollow.~AliITStrackMI();
229 new(&fTrackToFollow) AliITStrackMI(t);
230 }
231 void CookdEdx(AliITStrackMI* track);
232 Double_t GetNormalizedChi2(AliITStrackMI * track, Int_t mode);
233 Double_t GetTruncatedChi2(const AliITStrackMI * track, Float_t fac);
234 Double_t NormalizedChi2(AliITStrackMI * track, Int_t layer);
235 Double_t GetInterpolatedChi2(const AliITStrackMI * forwardtrack,const AliITStrackMI * backtrack);
236 Double_t GetMatchingChi2(const AliITStrackMI * track1,const AliITStrackMI * track2);
237 Double_t GetSPDDeadZoneProbability(Double_t zpos, Double_t zerr) const;
238
239 Float_t *GetWeight(Int_t index);
240 void AddTrackHypothesys(AliITStrackMI * track, Int_t esdindex);
241 void SortTrackHypothesys(Int_t esdindex, Int_t maxcut, Int_t mode);
242 AliITStrackMI * GetBestHypothesys(Int_t esdindex, AliITStrackMI * original, Int_t checkmax);
243 void GetBestHypothesysMIP(TObjArray &itsTracks);
244 void RegisterClusterTracks(const AliITStrackMI* track, Int_t id);
245 void UnRegisterClusterTracks(const AliITStrackMI* track, Int_t id);
246 Float_t GetNumberOfSharedClusters(AliITStrackMI* track,Int_t id, Int_t list[6], AliITSRecPoint *clist[6]);
247 Int_t GetOverlapTrack(const AliITStrackMI *track, Int_t trackID, Int_t &shared, Int_t clusterlist[6], Int_t overlist[6]);
248 AliITStrackMI * GetBest2Tracks(Int_t trackID1, Int_t treackID2, Float_t th0, Float_t th1);
249 Float_t * GetErrY(Int_t trackindex) const {return &fCoefficients[trackindex*48];}
250 Float_t * GetErrZ(Int_t trackindex) const {return &fCoefficients[trackindex*48+12];}
251 Float_t * GetNy(Int_t trackindex) const {return &fCoefficients[trackindex*48+24];}
252 Float_t * GetNz(Int_t trackindex) const {return &fCoefficients[trackindex*48+36];}
253 void SignDeltas(const TObjArray *clusterArray, Float_t zv);
254 void MakeCoefficients(Int_t ntracks);
255 void BuildMaterialLUT(TString material);
256 void MakeTrksMaterialLUT(Int_t ntracks);
257 void DeleteTrksMaterialLUT();
258 Int_t CorrectForPipeMaterial(AliITStrackMI *t, TString direction="inward");
259 Int_t CorrectForShieldMaterial(AliITStrackMI *t, TString shield, TString direction="inward");
260 Int_t CorrectForLayerMaterial(AliITStrackMI *t, Int_t layerindex, Double_t oldGlobXYZ[3], TString direction="inward");
261 void UpdateESDtrack(AliITStrackMI* track, ULong_t flags) const;
262 void ReadBadFromDetTypeRec();
263 Int_t CheckSkipLayer(const AliITStrackMI *track,Int_t ilayer,Int_t idet) const;
264 Int_t CheckDeadZone(AliITStrackMI *track,Int_t ilayer,Int_t idet,Double_t dz,Double_t dy,Bool_t noClusters=kFALSE) const;
265 Bool_t LocalModuleCoord(Int_t ilayer,Int_t idet,const AliITStrackMI *track,
266 Float_t &xloc,Float_t &zloc) const;
267// method to be used for Plane Efficiency evaluation
268 Bool_t IsOKForPlaneEff(const AliITStrackMI* track, const Int_t *clusters, Int_t ilayer) const; // Check if a track is usable
269 // for Plane Eff evaluation
270 void UseTrackForPlaneEff(const AliITStrackMI* track, Int_t ilayer); // Use this track for Plane Eff
271//
272 Int_t fI; // index of the current layer
273 static AliITSlayer fgLayers[AliITSgeomTGeo::kNLayers];// ITS layers
274 AliITStrackMI fTracks[AliITSgeomTGeo::kNLayers]; // track estimations at the ITS layers
275 AliITStrackMI fBestTrack; // "best" track
276 AliITStrackMI fTrackToFollow; // followed track
277 TObjArray fTrackHypothesys; // ! array with track hypothesys- ARRAY is the owner of tracks- MI
278 TObjArray fBestHypothesys; // ! array with track hypothesys- ARRAY is the owner of tracks- MI
279 TObjArray fOriginal; // ! array with seeds from the TPC
280 Int_t fBestTrackIndex[100000]; // ! index of the best track
281 Int_t fCurrentEsdTrack; // ! current esd track - MI
282 Int_t fPass; // current pass through the data
283 Int_t fConstraint[2]; // constraint flags
284 Bool_t fAfterV0; //indicates V0 founded
285 Int_t fForceSkippingOfLayer[AliITSgeomTGeo::kNLayers]; // layers to be skipped
286 Int_t fLastLayerToTrackTo; // the innermost layer to track to
287 Float_t * fCoefficients; //! working array with errors and mean cluster shape
288 AliESDEvent * fEsd; //! pointer to the ESD event
289 Double_t fSPDdetzcentre[4]; // centres of SPD modules in z
290 TString fTrackingPhase; // current tracking phase
291 Int_t fUseTGeo; // use TGeo to get material budget
292 Int_t fNtracks; // number of tracks to prolong
293 Float_t fxOverX0Pipe; // material budget
294 Float_t fxTimesRhoPipe; // material budget
295 Float_t fxOverX0Shield[2]; // material budget
296 Float_t fxTimesRhoShield[2]; // material budget
297 Float_t fxOverX0Layer[6]; // material budget
298 Float_t fxTimesRhoLayer[6]; // material budget
299 Float_t *fxOverX0PipeTrks; //! material budget
300 Float_t *fxTimesRhoPipeTrks; //! material budget
301 Float_t *fxOverX0ShieldTrks; //! material budget
302 Float_t *fxTimesRhoShieldTrks; //! material budget
303 Float_t *fxOverX0LayerTrks; //! material budget
304 Float_t *fxTimesRhoLayerTrks; //! material budget
305 TTreeSRedirector *fDebugStreamer; //!debug streamer
306 AliITSChannelStatus *fITSChannelStatus;//! bitmaps with channel status for SPD and SDD
307 const AliITSDetTypeRec *fkDetTypeRec; //! ITS det type rec, from AliITSReconstructor
308 AliITSPlaneEff *fPlaneEff; //! Pointer to the ITS plane efficicency
309private:
310 AliITStrackerMI(const AliITStrackerMI &tracker);
311 AliITStrackerMI & operator=(const AliITStrackerMI &tracker);
312 ClassDef(AliITStrackerMI,9) //ITS tracker MI
313};
314
315
316
317
318/////////////////////////////////////////////////////////
319/////////////////////////////////////////////////////////
320/////////////////////////////////////////////////////////
321
322
323
324
325
326inline void AliITStrackerMI::SetupFirstPass(const Int_t *flags,const Double_t *cuts) {
327 // This function sets up flags and cuts for the first tracking pass
328 //
329 // flags[0] - vertex constaint flag
330 // negative means "skip the pass"
331 // 0 means "no constraint"
332 // positive means "normal constraint"
333
334 fConstraint[0]=flags[0];
335 if (!cuts) return;
336}
337
338inline void AliITStrackerMI::SetupSecondPass(const Int_t *flags,const Double_t *cuts) {
339 // This function sets up flags and cuts for the second tracking pass
340 //
341 // flags[0] - vertex constaint flag
342 // negative means "skip the pass"
343 // 0 means "no constraint"
344 // positive means "normal constraint"
345
346 fConstraint[1]=flags[0];
347 if (!cuts) return;
348}
349
350inline void AliITStrackerMI::CookLabel(AliKalmanTrack *t,Float_t wrong) const {
351 //--------------------------------------------------------------------
352 //This function "cooks" a track label. If label<0, this track is fake.
353 //--------------------------------------------------------------------
354 Int_t tpcLabel=t->GetLabel();
355 if (tpcLabel<0) return;
356 AliTracker::CookLabel(t,wrong);
357 if (tpcLabel!=TMath::Abs(t->GetLabel())){
358 t->SetFakeRatio(1.);
359 }
360 if (tpcLabel !=t->GetLabel()) {
361 t->SetLabel(-tpcLabel);
362 }
363}
364
365inline Double_t AliITStrackerMI::NormalizedChi2(AliITStrackMI * track, Int_t layer)
366{
367 //--------------------------------------------------------------------
368 //get normalize chi2
369 //--------------------------------------------------------------------
370 track->SetNormChi2(layer,2.*track->GetNSkipped()+0.25*track->GetNDeadZone()+track->GetdEdxMismatch()+track->GetChi2()/
371 //track->fNormChi2[layer] = 2.*track->fNSkipped+0.25*track->fNDeadZone+track->fdEdxMismatch+track->fChi22/
372 TMath::Max(double(track->GetNumberOfClusters()-track->GetNSkipped()),
373 1./(1.+track->GetNSkipped())));
374 return track->GetNormChi2(layer);
375}
376inline void AliITStrackerMI::AliITSdetector::GetGlobalXYZ(const AliITSRecPoint *cl, Double_t xyz[3]) const
377{
378 //
379 // get cluster coordinates in global cooordinate
380 //
381 xyz[2] = cl->GetZ();
382 xyz[0] = fR*fCosPhi - cl->GetY()*fSinPhi;
383 xyz[1] = fR*fSinPhi + cl->GetY()*fCosPhi;
384}
385#endif