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