]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCtrackerMI.h
Changes for the V0 finder (M.Ivanov)
[u/mrichter/AliRoot.git] / TPC / AliTPCtrackerMI.h
CommitLineData
1c53abe2 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 */
5
91162307 6
1c53abe2 7/* $Id$ */
8
9//-------------------------------------------------------
47966a6d 10// TPC tracker
11// Parallel tracker
1c53abe2 12//
13// Origin:
14//-------------------------------------------------------
6d171107 15
16#include <TError.h>
17
1c53abe2 18#include "AliTracker.h"
19#include "AliTPCtrack.h"
cd4a3564 20#include "AliComplexCluster.h"
b67e07dc 21
1c53abe2 22class TFile;
23class AliTPCParam;
24class AliTPCseed;
25class AliTPCclusterMI;
91162307 26class AliTPCTrackerPoint;
27class AliESD;
28class TTree;
1c53abe2 29
30class AliTPCseed : public AliTPCtrack {
b67e07dc 31 friend class AliTPCtrackerMI;
d26d9159 32 public:
1c53abe2 33 AliTPCseed();
34 virtual ~AliTPCseed();
35 AliTPCseed(const AliTPCtrack &t);
2fc0c115 36 AliTPCseed(const AliTPCseed &s);
bbc6cd2c 37 //AliTPCseed(const AliKalmanTrack &t, Double_t a);
51ad6848 38 AliTPCseed(UInt_t index, const Double_t xx[5],
39 const Double_t cc[15], Double_t xr, Double_t alpha);
1c53abe2 40 Int_t Compare(const TObject *o) const;
91162307 41 void Reset(Bool_t all = kTRUE);
1c53abe2 42 Int_t GetProlongation(Double_t xr, Double_t &y, Double_t & z) const;
43 virtual Double_t GetPredictedChi2(const AliTPCclusterMI *cluster) const;
44 virtual Int_t Update(const AliTPCclusterMI* c, Double_t chi2, UInt_t i);
91162307 45 AliTPCTrackerPoint * GetTrackPoint(Int_t i);
1c53abe2 46 void RebuildSeed(); // rebuild seed to be ready for storing
91162307 47 Double_t GetDensityFirst(Int_t n);
b67e07dc 48 Double_t GetSigma2C() const {return fC44;};
91162307 49 void GetClusterStatistic(Int_t first, Int_t last, Int_t &found, Int_t &foundable, Int_t &shared, Bool_t plus2);
50
51 void Modify(Double_t factor);
b67e07dc 52 void SetClusterIndex2(Int_t row, Int_t index) {
91162307 53 fIndex[row] = index;
54 }
b67e07dc 55 Int_t GetClusterIndex2(Int_t row) const {
91162307 56 return fIndex[row];
1c53abe2 57 }
b67e07dc 58 Int_t GetClusterSector(Int_t row) const {
e325274c 59 Int_t pica = -1;
60 if (fIndex[row]>=0) pica = ((fIndex[row]&0xff000000)>>24);
61 return pica;
91162307 62 }
63
1c53abe2 64 void SetErrorY2(Float_t sy2){fErrorY2=sy2;}
65 void SetErrorZ2(Float_t sz2){fErrorZ2=sz2;}
91162307 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);
b67e07dc 68 Bool_t IsActive() const { return !(fRemoval);}
1c53abe2 69 void Desactivate(Int_t reason){ fRemoval = reason;}
91162307 70 //
71 //
b67e07dc 72 private:
6d171107 73 AliTPCseed & operator = (const AliTPCseed &)
74 {::Fatal("= operator","Not Implemented\n");return *this;}
47966a6d 75 AliESDtrack * fEsd; //!
91162307 76 AliTPCclusterMI* fClusterPointer[160]; //! array of cluster pointers -
77 TClonesArray * fPoints; // array with points along the track
1c53abe2 78 TClonesArray * fEPoints; // array with exact points - calculated in special macro not used in tracking
91162307 79 //---CURRENT VALUES
c9427e08 80 Int_t fRow; //!current row number
1c53abe2 81 Int_t fSector; //!current sector number
91162307 82 Int_t fRelativeSector; //! index of current relative sector
83 Float_t fCurrentSigmaY2; //!expected current cluster sigma Y
84 Float_t fCurrentSigmaZ2; //!expected current cluster sigma Z
85 Float_t fErrorY2; //!sigma of current cluster
86 Float_t fErrorZ2; //!sigma of current cluster
1c53abe2 87 AliTPCclusterMI * fCurrentCluster; //!pointer to the current cluster for prolongation
88 Int_t fCurrentClusterIndex1; //! index of the current cluster
91162307 89 Bool_t fInDead; //! indicate if the track is in dead zone
90 Bool_t fIsSeeding; //!indicates if it is proces of seeading
91 Int_t fNoCluster; //!indicates number of rows without clusters
92 Int_t fSort; //!indicate criteria for sorting
93 Bool_t fBSigned; //indicates that clusters of this trackes are signed to be used
94 //
95 //
1c53abe2 96 Float_t fDEDX[4]; // dedx according padrows
97 Float_t fSDEDX[4]; // sdedx according padrows
98 Int_t fNCDEDX[4]; // number of clusters for dedx measurment
91162307 99 //
100 Int_t fSeedType; //seeding type
101 Int_t fSeed1; //first row for seeding
102 Int_t fSeed2; //last row for seeding
103 Int_t fOverlapLabels[12]; //track labels and the length of the overlap
91162307 104 Float_t fMAngular; // mean angular factor
105 AliTPCTrackerPoint fTrackPoints[160]; //!track points - array track points
1c53abe2 106
107 ClassDef(AliTPCseed,1)
108};
109
110
111
112
113class AliTPCtrackerMI : public AliTracker {
114public:
d26d9159 115 AliTPCtrackerMI():AliTracker(),fkNIS(0),fkNOS(0) {
116 fInnerSec=fOuterSec=0; fSeeds=0;
117 }
118 AliTPCtrackerMI(const AliTPCParam *par);
2fc0c115 119 AliTPCtrackerMI(const AliTPCtrackerMI& r); //dummy copy constructor
120 AliTPCtrackerMI &operator=(const AliTPCtrackerMI& r);//dummy assignment operator
b67e07dc 121 virtual ~AliTPCtrackerMI();
91162307 122 //
d26d9159 123 void SetIteration(Int_t iteration){fIteration = iteration;}
124 virtual Int_t Clusters2Tracks (AliESD *esd);
125 virtual Int_t RefitInward (AliESD *esd);
126 virtual Int_t LoadClusters (TTree * tree);
127 Int_t LoadClusters();
128 void UnloadClusters();
129
91162307 130 //
131 void SetIO(); //set default IO from folders
132 void SetIO(TTree * input, TTree * output, AliESD * event);
d26d9159 133 void FillESD(TObjArray* arr);
91162307 134 void WriteTracks();
d26d9159 135 void WriteTracks(TTree * tree);
91162307 136 void DeleteSeeds();
137 void SetDebug(Int_t debug){ fDebug = debug;}
51ad6848 138 void FindKinks(TObjArray * array, AliESD * esd);
139 void UpdateKinkQualityM(AliTPCseed * seed);
140
1c53abe2 141 Int_t ReadSeeds(const TFile *in);
91162307 142 TObjArray * GetSeeds(){return fSeeds;}
143 //
144 AliCluster * GetCluster (int) const {return 0;}
1c53abe2 145 AliTPCclusterMI *GetClusterMI(Int_t index) const;
f8aae377 146 Int_t Clusters2Tracks();
91162307 147 virtual void CookLabel(AliTPCseed *t,Float_t wrong) const;
51ad6848 148 virtual Int_t CookLabel(AliTPCseed *t,Float_t wrong, Int_t first,Int_t last ) const;
91162307 149
c9427e08 150 void RotateToLocal(AliTPCseed *seed);
91162307 151
152
153 Int_t FollowProlongation(AliTPCseed& t, Int_t rf=0, Int_t step=1);
154 Int_t FollowProlongationFast(AliTPCseed& t, Int_t rf=0, Int_t step=1);
155
156 Int_t FollowBackProlongation(AliTPCseed& t, Int_t rf);
157 Int_t FollowToNext(AliTPCseed& t, Int_t nr);
158 Int_t FollowToNextFast(AliTPCseed& t, Int_t nr);
159 Int_t UpdateClusters(AliTPCseed& t, Int_t nr);
160 Int_t FollowToNextCluster( AliTPCseed& t, Int_t nr);
161
91162307 162 Int_t PropagateBack(TObjArray * arr);
163 Int_t PropagateBack(AliESD * event);
164 Int_t PropagateBack(AliTPCseed *pt, Int_t row0, Int_t row1);
165 Int_t PropagateForward();
166 Int_t PropagateForward2(TObjArray * arr);
167
168 Int_t CheckKinkPoint(AliTPCseed*seed, Float_t th);
47966a6d 169 void SortTracks(TObjArray * arr, Int_t mode) const;
91162307 170
171
1c53abe2 172 virtual Double_t ErrY2(AliTPCseed* seed, AliTPCclusterMI * cl = 0);
173 virtual Double_t ErrZ2(AliTPCseed* seed, AliTPCclusterMI * cl = 0);
174
b67e07dc 175 Double_t F1(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
176 Double_t F1old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
177 Double_t F2(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
178 Double_t F2old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
91162307 179
b67e07dc 180 Double_t F3(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2);
181 Double_t F3n(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2,
91162307 182 Double_t c);
183 Bool_t GetProlongation(Double_t x1, Double_t x2, Double_t x[5], Double_t &y, Double_t &z);
184
b67e07dc 185 public:
1c53abe2 186//**************** Internal tracker class **********************
b67e07dc 187 class AliTPCSector;
1c53abe2 188 class AliTPCRow {
b67e07dc 189 friend class AliTPCtrackerMI;
190 friend class AliTPCtrackerMI::AliTPCSector;
1c53abe2 191 public:
b67e07dc 192 AliTPCRow();
65780d25 193 AliTPCRow(const AliTPCRow& /*r*/){;} //dummy copy constructor
194 AliTPCRow &operator=(const AliTPCRow& /*r*/){return *this;} //dummy assignment operator
1c53abe2 195 ~AliTPCRow();
196 void InsertCluster(const AliTPCclusterMI *c, UInt_t index);
982aff31 197 void ResetClusters();
1c53abe2 198 operator int() const {return fN;}
91162307 199 Int_t GetN() const {return fN;}
1c53abe2 200 const AliTPCclusterMI* operator[](Int_t i) const {return fClusters[i];}
201 UInt_t GetIndex(Int_t i) const {return fIndex[i];}
91162307 202 inline Int_t Find(Double_t z) const;
1627d1c4 203 AliTPCclusterMI * FindNearest(Double_t y, Double_t z, Double_t roady, Double_t roadz) const;
91162307 204 AliTPCclusterMI * FindNearest2(Double_t y, Double_t z, Double_t roady, Double_t roadz, UInt_t & index) const;
205 AliTPCclusterMI * FindNearest3(Double_t y, Double_t z, Double_t roady, Double_t roadz, UInt_t & index) const;
206
1c53abe2 207 void SetX(Double_t x) {fX=x;}
208 Double_t GetX() const {return fX;}
6d171107 209private:
1c53abe2 210 Float_t fDeadZone; // the width of the dead zone
91162307 211 AliTPCclusterMI *fClusters1; //array with clusters 1
b67e07dc 212 Int_t fN1; //number of clusters on left side
91162307 213 AliTPCclusterMI *fClusters2; //array with clusters 2
b67e07dc 214 Int_t fN2; // number of clusters on right side of the TPC
215 Short_t fFastCluster[510]; //index of the nearest cluster at given position
1c53abe2 216 Int_t fN; //number of clusters
217 const AliTPCclusterMI *fClusters[kMaxClusterPerRow]; //pointers to clusters
91162307 218 // indexes for cluster at given position z
219 // AliTPCclusterMI *fClustersArray; //
1c53abe2 220 UInt_t fIndex[kMaxClusterPerRow]; //indeces of clusters
221 Double_t fX; //X-coordinate of this row
2fc0c115 222
1c53abe2 223 };
224
225//**************** Internal tracker class **********************
226 class AliTPCSector {
b67e07dc 227 friend class AliTPCtrackerMI;
1c53abe2 228 public:
229 AliTPCSector() { fN=0; fRow = 0; }
230 ~AliTPCSector() { delete[] fRow; }
65780d25 231 AliTPCSector(const AliTPCSector & /*s*/){;} //dummy copy contructor
232 AliTPCSector& operator=(const AliTPCSector & /*s*/){return *this;}//dummy assignment operator
1c53abe2 233 AliTPCRow& operator[](Int_t i) const { return *(fRow+i); }
234 Int_t GetNRows() const { return fN; }
235 void Setup(const AliTPCParam *par, Int_t flag);
236 Double_t GetX(Int_t l) const {return fRow[l].GetX();}
237 Double_t GetMaxY(Int_t l) const {
238 return GetX(l)*TMath::Tan(0.5*GetAlpha());
239 }
240 Double_t GetAlpha() const {return fAlpha;}
241 Double_t GetAlphaShift() const {return fAlphaShift;}
91162307 242 //Int_t GetFirst(){return fFirstRow;}
47966a6d 243 Int_t GetRowNumber(Double_t x) const;
1c53abe2 244 Double_t GetPadPitchWidth() const {return fPadPitchWidth;}
245 Double_t GetPadPitchLength() const {return fPadPitchLength;}
246 Double_t GetPadPitchLength(Float_t x) const {return (x<200) ? fPadPitchLength:f2PadPitchLength ;}
247
248 private:
249 Int_t fN; //number of pad rows
91162307 250 //Int_t fFirstRow; //offset
1c53abe2 251 AliTPCRow *fRow; //array of pad rows
252 Double_t fAlpha; //opening angle
253 Double_t fAlphaShift; //shift angle;
254 Double_t fPadPitchWidth; //pad pitch width
255 Double_t fPadPitchLength; //pad pitch length
256 Double_t f1PadPitchLength; //pad pitch length
257 Double_t f2PadPitchLength; //pad pitch length
258
1c53abe2 259 };
260
261 Float_t OverlapFactor(AliTPCseed * s1, AliTPCseed * s2, Int_t &sum1, Int_t &sum2);
262 void SignShared(AliTPCseed * s1, AliTPCseed * s2);
91162307 263 void SignShared(TObjArray * arr);
264
265 void RemoveUsed(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t removalindex);
51ad6848 266 void RemoveUsed2(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t minimal);
91162307 267 void RemoveDouble(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t removalindex);
268
47966a6d 269 void StopNotActive(TObjArray * arr, Int_t row0, Float_t th0, Float_t th1, Float_t th2) const;
270 void StopNotActive(AliTPCseed * seed, Int_t row0, Float_t th0, Float_t th1, Float_t th2) const;
91162307 271 Int_t AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluster, Float_t factor, Float_t cory=1., Float_t corz=1.);
c9427e08 272
1c53abe2 273private:
91162307 274 inline AliTPCRow &GetRow(Int_t sec, Int_t row);
47966a6d 275 inline Double_t GetXrow(Int_t row) const;
276 inline Double_t GetMaxY(Int_t row) const;
277 inline Int_t GetRowNumber(Double_t x) const;
278 inline Double_t GetPadPitchLength(Double_t x) const;
279 inline Double_t GetPadPitchLength(Int_t row) const;
91162307 280
1c53abe2 281 Float_t GetSigmaY(AliTPCseed * seed);
282 Float_t GetSigmaZ(AliTPCseed * seed);
91162307 283 void GetShape(AliTPCseed * seed, Int_t row);
284
d26d9159 285 void ReadSeeds(AliESD *event, Int_t direction); //read seeds from the event
1c53abe2 286
91162307 287 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);
288 void MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], Float_t deltay = -1);
1627d1c4 289
91162307 290 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);
291
1c53abe2 292
91162307 293 AliTPCseed *MakeSeed(AliTPCseed *t, Float_t r0, Float_t r1, Float_t r2); //reseed
d26d9159 294 AliTPCseed *ReSeed(AliTPCseed *t, Float_t r0, Float_t r1, Float_t r2); //reseed
91162307 295
296
297
298 AliTPCseed * ReSeed(AliTPCseed *t);
299 Int_t LoadInnerSectors();
300 Int_t LoadOuterSectors();
301 void UnsignClusters();
302 void SignClusters(TObjArray * arr, Float_t fnumber=3., Float_t fdensity=2.);
303
304 void ParallelTracking(TObjArray * arr, Int_t rfirst, Int_t rlast);
305 void Tracking(TObjArray * arr);
306 TObjArray * Tracking(Int_t seedtype, Int_t i1, Int_t i2, Float_t cuts[4], Float_t dy=-1, Int_t dsec=0);
307 TObjArray * Tracking();
47966a6d 308 void SumTracks(TObjArray *arr1,TObjArray *arr2) const;
309 void PrepareForBackProlongation(TObjArray * arr, Float_t fac) const;
310 void PrepareForProlongation(TObjArray * arr, Float_t fac) const;
1c53abe2 311
4c57c771 312 void SetSampledEdx(AliTPCseed */*t*/, Float_t /*q*/, Int_t /*i*/) {;}
91162307 313 Int_t UpdateTrack(AliTPCseed *t, Int_t accept); //update trackinfo
1c53abe2 314
1c53abe2 315
1c53abe2 316 const Int_t fkNIS; //number of inner sectors
317 AliTPCSector *fInnerSec; //array of inner sectors;
318 const Int_t fkNOS; //number of outer sectors
319 AliTPCSector *fOuterSec; //array of outer sectors;
320
321 Int_t fN; //number of loaded sectors
322 AliTPCSector *fSectors; //pointer to loaded sectors;
91162307 323 //
324 TTree * fInput; // input tree with clusters
325 TTree * fOutput; // output tree with tracks
326 TTree * fSeedTree; // output tree with seeds - filled in debug mode 1
327 TTree * fTreeDebug; // output with a debug information about track
328 AliESD * fEvent; // output with esd tracks
329 Int_t fDebug; // debug option
330 Bool_t fNewIO; // indicated if we have data using New IO
1c53abe2 331 Int_t fNtracks; //current number of tracks
332 TObjArray *fSeeds; //array of track seeds
91162307 333 Int_t fIteration; // indicate iteration - 0 - froward -1 back - 2forward - back->forward
1c53abe2 334 // TObjArray * fTrackPointPool; // ! pool with track points
91162307 335 // TObjArray * fSeedPool; //! pool with seeds
336 Double_t fXRow[200]; // radius of the pad row
337 Double_t fYMax[200]; // max y for given pad row
338 Double_t fPadLength[200]; // max y for given pad row
1c53abe2 339 const AliTPCParam *fParam; //pointer to the parameters
91162307 340 ClassDef(AliTPCtrackerMI,1)
1c53abe2 341};
342
91162307 343
344AliTPCtrackerMI::AliTPCRow & AliTPCtrackerMI::GetRow(Int_t sec, Int_t row)
345{
346 //
347 return (row>=fInnerSec->GetNRows()) ? fOuterSec[sec][row-fInnerSec->GetNRows()]:fInnerSec[sec][row];
348}
349
47966a6d 350Double_t AliTPCtrackerMI::GetXrow(Int_t row) const {
91162307 351 // return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetX(row-fInnerSec->GetNRows()):fInnerSec->GetX(row);
352 return fXRow[row];
353}
354
47966a6d 355Double_t AliTPCtrackerMI::GetMaxY(Int_t row) const {
91162307 356 //return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetMaxY(row-fInnerSec->GetNRows()):fInnerSec->GetMaxY(row);
357 return fYMax[row];
358}
359
47966a6d 360Int_t AliTPCtrackerMI::GetRowNumber(Double_t x) const
91162307 361{
362 //
363 return (x>133.) ? fOuterSec->GetRowNumber(x)+fInnerSec->GetNRows():fInnerSec->GetRowNumber(x);
364}
365
47966a6d 366Double_t AliTPCtrackerMI::GetPadPitchLength(Double_t x) const
91162307 367{
368 //
369 return (x>133.) ? fOuterSec->GetPadPitchLength(x):fInnerSec->GetPadPitchLength(x);
370 //return fPadLength[row];
371}
372
47966a6d 373Double_t AliTPCtrackerMI::GetPadPitchLength(Int_t row) const
91162307 374{
375 //
376 return fPadLength[row];
377}
378
379
380
1c53abe2 381#endif
382
383