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 //-------------------------------------------------------
13 //-------------------------------------------------------
14 #include "AliTracker.h"
15 #include "AliTPCtrack.h"
16 #include "TClonesArray.h"
17 //#include "AliTPCClustersArray.h"
19 #include "AliTPCreco.h"
21 #include "AliComplexCluster.h"
25 class AliTPCclusterMI;
26 class AliTPCTrackerPoint;
31 class AliTPCseed : public AliTPCtrack {
34 virtual ~AliTPCseed();
35 AliTPCseed(const AliTPCtrack &t);
36 AliTPCseed(const AliKalmanTrack &t, Double_t a);
37 Int_t Compare(const TObject *o) const;
38 void Reset(Bool_t all = kTRUE);
39 Int_t GetProlongation(Double_t xr, Double_t &y, Double_t & z) const;
40 virtual Double_t GetPredictedChi2(const AliTPCclusterMI *cluster) const;
41 virtual Int_t Update(const AliTPCclusterMI* c, Double_t chi2, UInt_t i);
42 AliTPCTrackerPoint * GetTrackPoint(Int_t i);
43 void RebuildSeed(); // rebuild seed to be ready for storing
44 AliTPCseed(UInt_t index, const Double_t xx[5],
45 const Double_t cc[15], Double_t xr, Double_t alpha);
47 Double_t GetDensityFirst(Int_t n);
48 Double_t GetSigma2C(){return fC44;}
49 void GetClusterStatistic(Int_t first, Int_t last, Int_t &found, Int_t &foundable, Int_t &shared, Bool_t plus2);
51 void Modify(Double_t factor);
52 void SetClusterIndex2(Int_t row, Int_t index){
55 Int_t GetClusterIndex2(Int_t row){
58 Int_t GetClusterSector(Int_t row){
60 if (fIndex[row]>=0) pica = ((fIndex[row]&0xff000000)>>24);
64 void SetErrorY2(Float_t sy2){fErrorY2=sy2;}
65 void SetErrorZ2(Float_t sz2){fErrorZ2=sz2;}
66 void CookdEdx(Double_t low=0.05, Double_t up=0.70, Int_t i1=0, Int_t i2=159, Bool_t onlyused = kFALSE);
67 // void CookdEdx2(Double_t low=0.05, Double_t up=0.70);
68 Bool_t IsActive(){ return !(fRemoval);}
69 void Desactivate(Int_t reason){ fRemoval = reason;}
72 AliTPCclusterMI* fClusterPointer[160]; //! array of cluster pointers -
73 TClonesArray * fPoints; // array with points along the track
74 TClonesArray * fEPoints; // array with exact points - calculated in special macro not used in tracking
76 Int_t fRow; //!current row number
77 Int_t fSector; //!current sector number
78 Int_t fRelativeSector; //! index of current relative sector
79 Float_t fCurrentSigmaY2; //!expected current cluster sigma Y
80 Float_t fCurrentSigmaZ2; //!expected current cluster sigma Z
81 Float_t fErrorY2; //!sigma of current cluster
82 Float_t fErrorZ2; //!sigma of current cluster
83 AliTPCclusterMI * fCurrentCluster; //!pointer to the current cluster for prolongation
84 Int_t fCurrentClusterIndex1; //! index of the current cluster
85 Bool_t fInDead; //! indicate if the track is in dead zone
86 Bool_t fIsSeeding; //!indicates if it is proces of seeading
87 Int_t fNoCluster; //!indicates number of rows without clusters
88 Int_t fSort; //!indicate criteria for sorting
89 Bool_t fBSigned; //indicates that clusters of this trackes are signed to be used
92 Float_t fDEDX[4]; // dedx according padrows
93 Float_t fSDEDX[4]; // sdedx according padrows
94 Int_t fNCDEDX[4]; // number of clusters for dedx measurment
96 Int_t fSeedType; //seeding type
97 Int_t fSeed1; //first row for seeding
98 Int_t fSeed2; //last row for seeding
99 Int_t fOverlapLabels[12]; //track labels and the length of the overlap
101 Float_t fMAngular; // mean angular factor
102 AliTPCTrackerPoint fTrackPoints[160]; //!track points - array track points
104 ClassDef(AliTPCseed,1)
110 class AliTPCtrackerMI : public AliTracker {
112 AliTPCtrackerMI():AliTracker(),fkNIS(0),fkNOS(0) {
113 fInnerSec=fOuterSec=0; fSeeds=0;
115 AliTPCtrackerMI(const AliTPCParam *par);
118 //to be implemented later
119 virtual Int_t Clusters2Tracks (AliESD *){return 0;}
120 virtual Int_t RefitInward (AliESD *){return 0;}
121 virtual Int_t LoadClusters (TTree *){return 0;}
123 void SetIO(); //set default IO from folders
124 void SetIO(TTree * input, TTree * output, AliESD * event);
127 void SetDebug(Int_t debug){ fDebug = debug;}
128 Int_t ReadSeeds(const TFile *in);
129 Int_t LoadClusters();
130 void UnloadClusters();
131 TObjArray * GetSeeds(){return fSeeds;}
133 AliCluster * GetCluster (int) const {return 0;}
134 AliTPCclusterMI *GetClusterMI(Int_t index) const;
135 Int_t Clusters2Tracks(const TFile *in, TFile *out){return 0;}
136 Int_t Clusters2Tracks();
137 virtual void CookLabel(AliTPCseed *t,Float_t wrong) const;
139 void RotateToLocal(AliTPCseed *seed);
142 Int_t FollowProlongation(AliTPCseed& t, Int_t rf=0, Int_t step=1);
143 Int_t FollowProlongationFast(AliTPCseed& t, Int_t rf=0, Int_t step=1);
145 Int_t FollowBackProlongation(AliTPCseed& t, Int_t rf);
146 Int_t FollowToNext(AliTPCseed& t, Int_t nr);
147 Int_t FollowToNextFast(AliTPCseed& t, Int_t nr);
148 Int_t UpdateClusters(AliTPCseed& t, Int_t nr);
149 Int_t FollowToNextCluster( AliTPCseed& t, Int_t nr);
151 virtual Int_t PropagateBack (const TFile *, TFile *){return 0;}
152 Int_t PropagateBack(TObjArray * arr);
153 Int_t PropagateBack(AliESD * event);
154 Int_t PropagateBack(AliTPCseed *pt, Int_t row0, Int_t row1);
155 Int_t PropagateForward();
156 Int_t PropagateForward2(TObjArray * arr);
158 Int_t CheckKinkPoint(AliTPCseed*seed, Float_t th);
159 void SortTracks(TObjArray * arr, Int_t mode);
162 virtual Double_t ErrY2(AliTPCseed* seed, AliTPCclusterMI * cl = 0);
163 virtual Double_t ErrZ2(AliTPCseed* seed, AliTPCclusterMI * cl = 0);
165 Double_t f1(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
166 Double_t f1old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
167 Double_t f2(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
168 Double_t f2old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
170 Double_t f3(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2);
171 Double_t f3n(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2,
173 Bool_t GetProlongation(Double_t x1, Double_t x2, Double_t x[5], Double_t &y, Double_t &z);
176 //**************** Internal tracker class **********************
181 void InsertCluster(const AliTPCclusterMI *c, UInt_t index);
182 operator int() const {return fN;}
183 Int_t GetN() const {return fN;}
184 const AliTPCclusterMI* operator[](Int_t i) const {return fClusters[i];}
185 UInt_t GetIndex(Int_t i) const {return fIndex[i];}
186 inline Int_t Find(Double_t z) const;
187 AliTPCclusterMI * FindNearest(Double_t y, Double_t z, Double_t roady, Double_t roadz) const;
188 AliTPCclusterMI * FindNearest2(Double_t y, Double_t z, Double_t roady, Double_t roadz, UInt_t & index) const;
189 AliTPCclusterMI * FindNearest3(Double_t y, Double_t z, Double_t roady, Double_t roadz, UInt_t & index) const;
191 void SetX(Double_t x) {fX=x;}
192 Double_t GetX() const {return fX;}
193 Float_t fDeadZone; // the width of the dead zone
194 // void RebuildRow(){;}
196 AliTPCclusterMI *fClusters1; //array with clusters 1
198 AliTPCclusterMI *fClusters2; //array with clusters 2
200 Short_t fFastCluster[510];
202 Int_t fN; //number of clusters
203 const AliTPCclusterMI *fClusters[kMaxClusterPerRow]; //pointers to clusters
204 // indexes for cluster at given position z
205 // AliTPCclusterMI *fClustersArray; //
206 UInt_t fIndex[kMaxClusterPerRow]; //indeces of clusters
207 Double_t fX; //X-coordinate of this row
209 AliTPCRow(const AliTPCRow& r); //dummy copy constructor
210 AliTPCRow &operator=(const AliTPCRow& r); //dummy assignment operator
213 //**************** Internal tracker class **********************
216 AliTPCSector() { fN=0; fRow = 0; }
217 ~AliTPCSector() { delete[] fRow; }
218 AliTPCRow& operator[](Int_t i) const { return *(fRow+i); }
219 Int_t GetNRows() const { return fN; }
220 void Setup(const AliTPCParam *par, Int_t flag);
221 Double_t GetX(Int_t l) const {return fRow[l].GetX();}
222 Double_t GetMaxY(Int_t l) const {
223 return GetX(l)*TMath::Tan(0.5*GetAlpha());
225 Double_t GetAlpha() const {return fAlpha;}
226 Double_t GetAlphaShift() const {return fAlphaShift;}
227 //Int_t GetFirst(){return fFirstRow;}
228 Int_t GetRowNumber(Double_t x) const {
229 //return pad row number for this x
233 if (x > r) return fN;
235 if (x < r) return -1;
236 return Int_t((x-r)/fPadPitchLength + 0.5);}
239 if (x > r) return fN;
241 if (x < r) return -1;
242 Double_t r1=fRow[64].GetX();
244 return Int_t((x-r)/f1PadPitchLength + 0.5);}
246 return (Int_t((x-r1)/f2PadPitchLength + 0.5)+64);}
249 Double_t GetPadPitchWidth() const {return fPadPitchWidth;}
250 Double_t GetPadPitchLength() const {return fPadPitchLength;}
251 Double_t GetPadPitchLength(Float_t x) const {return (x<200) ? fPadPitchLength:f2PadPitchLength ;}
254 Int_t fN; //number of pad rows
255 //Int_t fFirstRow; //offset
256 AliTPCRow *fRow; //array of pad rows
257 Double_t fAlpha; //opening angle
258 Double_t fAlphaShift; //shift angle;
259 Double_t fPadPitchWidth; //pad pitch width
260 Double_t fPadPitchLength; //pad pitch length
261 Double_t f1PadPitchLength; //pad pitch length
262 Double_t f2PadPitchLength; //pad pitch length
265 AliTPCSector(const AliTPCSector &s); //dummy copy contructor
266 AliTPCSector& operator=(const AliTPCSector &s);//dummy assignment operator
269 Float_t OverlapFactor(AliTPCseed * s1, AliTPCseed * s2, Int_t &sum1, Int_t &sum2);
270 void SignShared(AliTPCseed * s1, AliTPCseed * s2);
271 void SignShared(TObjArray * arr);
273 void RemoveUsed(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t removalindex);
274 void RemoveDouble(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t removalindex);
276 void StopNotActive(TObjArray * arr, Int_t row0, Float_t th0, Float_t th1, Float_t th2);
277 void StopNotActive(AliTPCseed * seed, Int_t row0, Float_t th0, Float_t th1, Float_t th2);
278 Int_t AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluster, Float_t factor, Float_t cory=1., Float_t corz=1.);
281 inline AliTPCRow &GetRow(Int_t sec, Int_t row);
282 inline Double_t GetXrow(Int_t row);
283 inline Double_t GetMaxY(Int_t row);
284 inline Int_t GetRowNumber(Double_t x);
285 inline Double_t GetPadPitchLength(Double_t x);
286 inline Double_t GetPadPitchLength(Int_t row);
288 Float_t GetSigmaY(AliTPCseed * seed);
289 Float_t GetSigmaZ(AliTPCseed * seed);
290 void GetShape(AliTPCseed * seed, Int_t row);
292 void ReadSeeds(AliESD *event); //read seeds from the event
294 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);
295 void MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], Float_t deltay = -1);
297 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);
300 AliTPCseed *MakeSeed(AliTPCseed *t, Float_t r0, Float_t r1, Float_t r2); //reseed
304 AliTPCseed * ReSeed(AliTPCseed *t);
305 Int_t LoadInnerSectors();
306 Int_t LoadOuterSectors();
307 void UnsignClusters();
308 void SignClusters(TObjArray * arr, Float_t fnumber=3., Float_t fdensity=2.);
310 void ParallelTracking(TObjArray * arr, Int_t rfirst, Int_t rlast);
311 void Tracking(TObjArray * arr);
312 TObjArray * Tracking(Int_t seedtype, Int_t i1, Int_t i2, Float_t cuts[4], Float_t dy=-1, Int_t dsec=0);
313 TObjArray * Tracking();
314 void SumTracks(TObjArray *arr1,TObjArray *arr2);
315 void PrepareForBackProlongation(TObjArray * arr, Float_t fac);
316 void PrepareForProlongation(TObjArray * arr, Float_t fac);
318 void SetSampledEdx(AliTPCseed *t, Float_t q, Int_t i) {;}
319 Int_t UpdateTrack(AliTPCseed *t, Int_t accept); //update trackinfo
322 AliTPCtrackerMI(const AliTPCtrackerMI& r); //dummy copy constructor
323 AliTPCtrackerMI &operator=(const AliTPCtrackerMI& r);//dummy assignment operator
325 const Int_t fkNIS; //number of inner sectors
326 AliTPCSector *fInnerSec; //array of inner sectors;
327 const Int_t fkNOS; //number of outer sectors
328 AliTPCSector *fOuterSec; //array of outer sectors;
330 Int_t fN; //number of loaded sectors
331 AliTPCSector *fSectors; //pointer to loaded sectors;
333 TTree * fInput; // input tree with clusters
334 TTree * fOutput; // output tree with tracks
335 TTree * fSeedTree; // output tree with seeds - filled in debug mode 1
336 TTree * fTreeDebug; // output with a debug information about track
337 AliESD * fEvent; // output with esd tracks
338 Int_t fDebug; // debug option
339 Bool_t fNewIO; // indicated if we have data using New IO
340 Int_t fNtracks; //current number of tracks
341 TObjArray *fSeeds; //array of track seeds
342 Int_t fIteration; // indicate iteration - 0 - froward -1 back - 2forward - back->forward
343 // TObjArray * fTrackPointPool; // ! pool with track points
344 // TObjArray * fSeedPool; //! pool with seeds
345 Double_t fXRow[200]; // radius of the pad row
346 Double_t fYMax[200]; // max y for given pad row
347 Double_t fPadLength[200]; // max y for given pad row
348 const AliTPCParam *fParam; //pointer to the parameters
349 ClassDef(AliTPCtrackerMI,1)
353 AliTPCtrackerMI::AliTPCRow & AliTPCtrackerMI::GetRow(Int_t sec, Int_t row)
356 return (row>=fInnerSec->GetNRows()) ? fOuterSec[sec][row-fInnerSec->GetNRows()]:fInnerSec[sec][row];
359 Double_t AliTPCtrackerMI::GetXrow(Int_t row) {
360 // return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetX(row-fInnerSec->GetNRows()):fInnerSec->GetX(row);
364 Double_t AliTPCtrackerMI::GetMaxY(Int_t row) {
365 //return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetMaxY(row-fInnerSec->GetNRows()):fInnerSec->GetMaxY(row);
369 Int_t AliTPCtrackerMI::GetRowNumber(Double_t x)
372 return (x>133.) ? fOuterSec->GetRowNumber(x)+fInnerSec->GetNRows():fInnerSec->GetRowNumber(x);
375 Double_t AliTPCtrackerMI::GetPadPitchLength(Double_t x)
378 return (x>133.) ? fOuterSec->GetPadPitchLength(x):fInnerSec->GetPadPitchLength(x);
379 //return fPadLength[row];
382 Double_t AliTPCtrackerMI::GetPadPitchLength(Int_t row)
385 return fPadLength[row];