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