1 #ifndef ALITPCTRACKERMI_H
2 #define ALITPCTRACKERMI_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
9 //-------------------------------------------------------
14 //-------------------------------------------------------
17 #include "AliTracker.h"
18 #include "AliTPCreco.h"
20 #include "AliTPCclusterMI.h"
26 class AliTPCTrackerPoint;
30 class TTreeSRedirector;
33 class AliTPCtrackerMI : public AliTracker {
36 AliTPCtrackerMI(const AliTPCParam *par);
37 virtual ~AliTPCtrackerMI();
39 void SetIteration(Int_t iteration){fIteration = iteration;}
40 virtual Int_t Clusters2Tracks (AliESDEvent *esd);
41 virtual Int_t RefitInward (AliESDEvent *esd);
42 virtual Int_t LoadClusters (TTree * tree);
44 void UnloadClusters();
45 void Transform(AliTPCclusterMI * cluster);
47 void FillESD(TObjArray* arr);
49 void SetDebug(Int_t debug){ fDebug = debug;}
50 void FindKinks(TObjArray * array, AliESDEvent * esd);
52 void FindCurling(TObjArray * array, AliESDEvent * esd, Int_t iter);
53 void FindSplitted(TObjArray * array, AliESDEvent * esd, Int_t iter);
54 void FindMultiMC(TObjArray * array, AliESDEvent * esd, Int_t iter);
56 void FindV0s(TObjArray * array, AliESDEvent * esd);
57 void UpdateKinkQualityM(AliTPCseed * seed);
58 void UpdateKinkQualityD(AliTPCseed * seed);
59 Int_t CheckKinkPoint(AliTPCseed*seed, AliTPCseed &mother, AliTPCseed &daughter, AliESDkink &kink);
60 Int_t RefitKink(AliTPCseed &mother, AliTPCseed &daughter, AliESDkink &kink);
61 Int_t ReadSeeds(const TFile *in);
62 TObjArray * GetSeeds(){return fSeeds;}
64 AliCluster * GetCluster(Int_t index) const {return (AliCluster*)GetClusterMI(index);}
65 AliTPCclusterMI *GetClusterMI(Int_t index) const;
66 Int_t Clusters2Tracks();
67 virtual void CookLabel(AliKalmanTrack *tk,Float_t wrong) const;
68 virtual Int_t CookLabel(AliTPCseed *t,Float_t wrong, Int_t first,Int_t last ) const;
70 void RotateToLocal(AliTPCseed *seed);
73 Int_t FollowProlongation(AliTPCseed& t, Int_t rf=0, Int_t step=1);
74 Int_t FollowProlongationFast(AliTPCseed& t, Int_t rf=0, Int_t step=1);
75 Bool_t GetTrackPoint(Int_t index, AliTrackPoint &p ) const;
77 Int_t FollowBackProlongation(AliTPCseed& t, Int_t rf);
78 Int_t FollowToNext(AliTPCseed& t, Int_t nr);
79 Int_t FollowToNextFast(AliTPCseed& t, Int_t nr);
80 Int_t UpdateClusters(AliTPCseed& t, Int_t nr);
81 Int_t FollowToNextCluster( AliTPCseed& t, Int_t nr);
83 Int_t PropagateBack(TObjArray * arr);
84 Int_t PropagateBack(AliESDEvent * event);
85 Int_t PropagateBack(AliTPCseed *pt, Int_t row0, Int_t row1);
86 Int_t PropagateForward();
87 Int_t PropagateForward2(TObjArray * arr);
89 void SortTracks(TObjArray * arr, Int_t mode) const;
91 virtual Double_t ErrY2(AliTPCseed* seed, AliTPCclusterMI * cl = 0);
92 virtual Double_t ErrZ2(AliTPCseed* seed, AliTPCclusterMI * cl = 0);
94 Double_t F1(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
95 Double_t F1old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
96 Double_t F2(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
97 Double_t F2old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
99 Double_t F3(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2);
100 Double_t F3n(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2,
102 Bool_t GetProlongation(Double_t x1, Double_t x2, Double_t x[5], Double_t &y, Double_t &z);
105 //**************** Internal tracker class **********************
111 void InsertCluster(const AliTPCclusterMI *c, UInt_t index);
112 void ResetClusters();
113 operator int() const {return fN;}
114 Int_t GetN() const {return fN;}
115 const AliTPCclusterMI* operator[](Int_t i) const {return fClusters[i];}
116 UInt_t GetIndex(Int_t i) const {return fIndex[i];}
117 inline Int_t Find(Double_t z) const;
118 AliTPCclusterMI * FindNearest(Double_t y, Double_t z, Double_t roady, Double_t roadz) const;
119 AliTPCclusterMI * FindNearest2(Double_t y, Double_t z, Double_t roady, Double_t roadz, UInt_t & index) const;
121 void SetX(Double_t x) {fX=x;}
122 Double_t GetX() const {return fX;}
123 Float_t GetDeadZone() const {return fDeadZone;}
124 void SetDeadZone(Float_t d) {fDeadZone=d;}
125 Int_t GetN1() const {return fN1;}
126 void SetN1(Int_t n) {fN1=n;}
127 Int_t GetN2() const {return fN2;}
128 void SetN2(Int_t n) {fN2=n;}
129 AliTPCclusterMI* GetClusters1() const {return fClusters1;}
130 AliTPCclusterMI* GetClusters2() const {return fClusters2;}
131 void SetClusters1(AliTPCclusterMI* cl) {fClusters1=cl;}
132 void SetClusters2(AliTPCclusterMI* cl) {fClusters2=cl;}
133 void SetCluster1(Int_t i, const AliTPCclusterMI &cl) {fClusters1[i]=cl;}
134 void SetCluster2(Int_t i, const AliTPCclusterMI &cl) {fClusters2[i]=cl;}
135 AliTPCclusterMI* GetCluster1(Int_t i) const {return &fClusters1[i];}
136 AliTPCclusterMI* GetCluster2(Int_t i) const {return &fClusters2[i];}
137 Short_t GetFastCluster(Int_t i) const {return fFastCluster[i];}
138 void SetFastCluster(Int_t i, Short_t cl);
141 AliTPCRow & operator=(const AliTPCRow & );
142 AliTPCRow(const AliTPCRow& /*r*/); //dummy copy constructor
143 Float_t fDeadZone; // the width of the dead zone
144 AliTPCclusterMI *fClusters1; //array with clusters 1
145 Int_t fN1; //number of clusters on left side
146 AliTPCclusterMI *fClusters2; //array with clusters 2
147 Int_t fN2; // number of clusters on right side of the TPC
148 Short_t fFastCluster[510]; //index of the nearest cluster at given position
149 Int_t fN; //number of clusters
150 const AliTPCclusterMI *fClusters[kMaxClusterPerRow]; //pointers to clusters
151 // indexes for cluster at given position z
152 // AliTPCclusterMI *fClustersArray; //
153 UInt_t fIndex[kMaxClusterPerRow]; //indeces of clusters
154 Double_t fX; //X-coordinate of this row
158 //**************** Internal tracker class **********************
168 f1PadPitchLength(0.),
169 f2PadPitchLength(0.){}
170 ~AliTPCSector() { delete[] fRow; }
171 AliTPCRow& operator[](Int_t i) const { return *(fRow+i); }
172 Int_t GetNRows() const { return fN; }
173 void Setup(const AliTPCParam *par, Int_t flag);
174 Double_t GetX(Int_t l) const {return fRow[l].GetX();}
175 Double_t GetMaxY(Int_t l) const {
176 return GetX(l)*TMath::Tan(0.5*GetAlpha());
178 Double_t GetAlpha() const {return fAlpha;}
179 Double_t GetAlphaShift() const {return fAlphaShift;}
180 //Int_t GetFirst(){return fFirstRow;}
181 Int_t GetRowNumber(Double_t x) const;
182 Double_t GetPadPitchWidth() const {return fPadPitchWidth;}
183 Double_t GetPadPitchLength() const {return fPadPitchLength;}
184 Double_t GetPadPitchLength(Float_t x) const {return (x<200) ? fPadPitchLength:f2PadPitchLength ;}
187 AliTPCSector & operator=(const AliTPCSector & );
188 AliTPCSector(const AliTPCSector &/*s*/); //dummy copy contructor
189 Int_t fN; //number of pad rows
190 //Int_t fFirstRow; //offset
191 AliTPCRow *fRow; //array of pad rows
192 Double_t fAlpha; //opening angle
193 Double_t fAlphaShift; //shift angle;
194 Double_t fPadPitchWidth; //pad pitch width
195 Double_t fPadPitchLength; //pad pitch length
196 Double_t f1PadPitchLength; //pad pitch length
197 Double_t f2PadPitchLength; //pad pitch length
201 Float_t OverlapFactor(AliTPCseed * s1, AliTPCseed * s2, Int_t &sum1, Int_t &sum2);
202 void SignShared(AliTPCseed * s1, AliTPCseed * s2);
203 void SignShared(TObjArray * arr);
205 void RemoveUsed2(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t minimal);
207 void StopNotActive(TObjArray * arr, Int_t row0, Float_t th0, Float_t th1, Float_t th2) const;
208 void StopNotActive(AliTPCseed * seed, Int_t row0, Float_t th0, Float_t th1, Float_t th2) const;
209 Int_t AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluster);
212 AliTPCtrackerMI(const AliTPCtrackerMI& r); //dummy copy constructor
213 AliTPCtrackerMI &operator=(const AliTPCtrackerMI& r);//dummy assignment operator
214 inline AliTPCRow &GetRow(Int_t sec, Int_t row);
215 inline Bool_t IsActive(Int_t sec, Int_t row);
216 inline Double_t GetXrow(Int_t row) const;
217 inline Double_t GetMaxY(Int_t row) const;
218 inline Int_t GetRowNumber(Double_t x) const;
219 Int_t GetRowNumber(Double_t x[3]) const;
220 inline Double_t GetPadPitchLength(Double_t x) const;
221 inline Double_t GetPadPitchLength(Int_t row) const;
223 void GetShape(AliTPCseed * seed, Int_t row);
225 void ReadSeeds(AliESDEvent *event, Int_t direction); //read seeds from the event
227 void MakeSeeds3(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], Float_t deltay = -1, Int_t ddsec=0);
228 void MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], Float_t deltay = -1);
230 void MakeSeeds2(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], Float_t deltay = -1, Bool_t bconstrain=kTRUE);
233 AliTPCseed *MakeSeed(AliTPCseed *t, Float_t r0, Float_t r1, Float_t r2); //reseed
234 AliTPCseed *ReSeed(AliTPCseed *t, Float_t r0, Float_t r1, Float_t r2); //reseed
235 AliTPCseed *ReSeed(AliTPCseed *t, Int_t r0, Bool_t forward); //reseed
239 AliTPCseed * ReSeed(AliTPCseed *t);
240 Int_t LoadInnerSectors();
241 Int_t LoadOuterSectors();
242 void UnsignClusters();
243 void SignClusters(TObjArray * arr, Float_t fnumber=3., Float_t fdensity=2.);
245 void ParallelTracking(TObjArray * arr, Int_t rfirst, Int_t rlast);
246 void Tracking(TObjArray * arr);
247 TObjArray * Tracking(Int_t seedtype, Int_t i1, Int_t i2, Float_t cuts[4], Float_t dy=-1, Int_t dsec=0);
248 TObjArray * Tracking();
249 TObjArray * TrackingSpecial();
250 void SumTracks(TObjArray *arr1,TObjArray *&arr2) const;
251 void PrepareForBackProlongation(TObjArray * arr, Float_t fac) const;
252 void PrepareForProlongation(TObjArray * arr, Float_t fac) const;
254 void SetSampledEdx(AliTPCseed */*t*/, Float_t /*q*/, Int_t /*i*/) {;}
255 Int_t UpdateTrack(AliTPCseed *t, Int_t accept); //update trackinfo
257 void MakeBitmaps(AliTPCseed *t);
259 const Int_t fkNIS; //number of inner sectors
260 AliTPCSector *fInnerSec; //array of inner sectors;
261 const Int_t fkNOS; //number of outer sectors
262 AliTPCSector *fOuterSec; //array of outer sectors;
264 Int_t fN; //number of loaded sectors
265 AliTPCSector *fSectors; //pointer to loaded sectors;
267 TTree * fInput; // input tree with clusters
268 TTree * fOutput; // output tree with tracks
269 TTree * fSeedTree; // output tree with seeds - filled in debug mode 1
270 TTree * fTreeDebug; // output with a debug information about track
271 AliESDEvent * fEvent; // output with esd tracks
272 Int_t fDebug; // debug option
273 Bool_t fNewIO; // indicated if we have data using New IO
274 Int_t fNtracks; //current number of tracks
275 TObjArray *fSeeds; //array of track seeds
276 Int_t fIteration; // indicate iteration - 0 - froward -1 back - 2forward - back->forward
277 // TObjArray * fTrackPointPool; // ! pool with track points
278 // TObjArray * fSeedPool; //! pool with seeds
279 Double_t fXRow[200]; // radius of the pad row
280 Double_t fYMax[200]; // max y for given pad row
281 Double_t fPadLength[200]; // max y for given pad row
282 const AliTPCParam *fParam; //pointer to the parameters
283 TTreeSRedirector *fDebugStreamer; //!debug streamer
284 ClassDef(AliTPCtrackerMI,2)
288 AliTPCtrackerMI::AliTPCRow & AliTPCtrackerMI::GetRow(Int_t sec, Int_t row)
291 return (row>=fInnerSec->GetNRows()) ? fOuterSec[sec][row-fInnerSec->GetNRows()]:fInnerSec[sec][row];
294 Bool_t AliTPCtrackerMI::IsActive(Int_t sec, Int_t row)
297 // check if the given sector row is active
299 return (row>=fInnerSec->GetNRows()) ? fOuterSec[sec][row-fInnerSec->GetNRows()].GetN()>0:fInnerSec[sec][row].GetN()>0;
303 Double_t AliTPCtrackerMI::GetXrow(Int_t row) const {
304 // return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetX(row-fInnerSec->GetNRows()):fInnerSec->GetX(row);
308 Double_t AliTPCtrackerMI::GetMaxY(Int_t row) const {
309 //return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetMaxY(row-fInnerSec->GetNRows()):fInnerSec->GetMaxY(row);
313 Int_t AliTPCtrackerMI::GetRowNumber(Double_t x) const
316 return (x>133.) ? fOuterSec->GetRowNumber(x)+fInnerSec->GetNRows():fInnerSec->GetRowNumber(x);
319 Double_t AliTPCtrackerMI::GetPadPitchLength(Double_t x) const
322 return (x>133.) ? fOuterSec->GetPadPitchLength(x):fInnerSec->GetPadPitchLength(x);
323 //return fPadLength[row];
326 Double_t AliTPCtrackerMI::GetPadPitchLength(Int_t row) const
329 return fPadLength[row];