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