]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCtrackerMI.h
Merging changes from v4-04-Release
[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
81e97e0d 16#include <TError.h>
1c53abe2 17#include "AliTracker.h"
81e97e0d 18#include "AliTPCreco.h"
19#include "AliPID.h"
20
b67e07dc 21
1c53abe2 22class TFile;
23class AliTPCParam;
24class AliTPCseed;
25class AliTPCclusterMI;
91162307 26class AliTPCTrackerPoint;
27class AliESD;
28class TTree;
eea478d3 29class AliESDkink;
81e97e0d 30class TTreeSRedirector;
2ccb4dfc 31class AliTrackPoint;
1c53abe2 32
33class AliTPCtrackerMI : public AliTracker {
34public:
d26d9159 35 AliTPCtrackerMI():AliTracker(),fkNIS(0),fkNOS(0) {
36 fInnerSec=fOuterSec=0; fSeeds=0;
37 }
38 AliTPCtrackerMI(const AliTPCParam *par);
9996a03b 39 AliTPCtrackerMI(const AliTPCtrackerMI& r); //dummy copy constructor
40 AliTPCtrackerMI &operator=(const AliTPCtrackerMI& r);//dummy assignment operator
b67e07dc 41 virtual ~AliTPCtrackerMI();
91162307 42 //
d26d9159 43 void SetIteration(Int_t iteration){fIteration = iteration;}
44 virtual Int_t Clusters2Tracks (AliESD *esd);
45 virtual Int_t RefitInward (AliESD *esd);
46 virtual Int_t LoadClusters (TTree * tree);
47 Int_t LoadClusters();
48 void UnloadClusters();
0201b65c 49 void Transform(AliCluster * cluster);
91162307 50 //
51 void SetIO(); //set default IO from folders
52 void SetIO(TTree * input, TTree * output, AliESD * event);
d26d9159 53 void FillESD(TObjArray* arr);
91162307 54 void WriteTracks();
d26d9159 55 void WriteTracks(TTree * tree);
91162307 56 void DeleteSeeds();
57 void SetDebug(Int_t debug){ fDebug = debug;}
51ad6848 58 void FindKinks(TObjArray * array, AliESD * esd);
81e97e0d 59 void FindV0s(TObjArray * array, AliESD * esd);
51ad6848 60 void UpdateKinkQualityM(AliTPCseed * seed);
eea478d3 61 void UpdateKinkQualityD(AliTPCseed * seed);
62 Int_t CheckKinkPoint(AliTPCseed*seed, AliTPCseed &mother, AliTPCseed &daughter, AliESDkink &kink);
63 Int_t RefitKink(AliTPCseed &mother, AliTPCseed &daughter, AliESDkink &kink);
1c53abe2 64 Int_t ReadSeeds(const TFile *in);
91162307 65 TObjArray * GetSeeds(){return fSeeds;}
66 //
34acb742 67 AliCluster * GetCluster(Int_t index) const {return (AliCluster*)GetClusterMI(index);}
1c53abe2 68 AliTPCclusterMI *GetClusterMI(Int_t index) const;
f8aae377 69 Int_t Clusters2Tracks();
af32720d 70 virtual void CookLabel(AliKalmanTrack *tk,Float_t wrong) const;
51ad6848 71 virtual Int_t CookLabel(AliTPCseed *t,Float_t wrong, Int_t first,Int_t last ) const;
91162307 72
c9427e08 73 void RotateToLocal(AliTPCseed *seed);
91162307 74
75
76 Int_t FollowProlongation(AliTPCseed& t, Int_t rf=0, Int_t step=1);
77 Int_t FollowProlongationFast(AliTPCseed& t, Int_t rf=0, Int_t step=1);
2ccb4dfc 78 Bool_t GetTrackPoint(Int_t index, AliTrackPoint &p ) const;
79
91162307 80 Int_t FollowBackProlongation(AliTPCseed& t, Int_t rf);
81 Int_t FollowToNext(AliTPCseed& t, Int_t nr);
82 Int_t FollowToNextFast(AliTPCseed& t, Int_t nr);
83 Int_t UpdateClusters(AliTPCseed& t, Int_t nr);
84 Int_t FollowToNextCluster( AliTPCseed& t, Int_t nr);
85
91162307 86 Int_t PropagateBack(TObjArray * arr);
87 Int_t PropagateBack(AliESD * event);
88 Int_t PropagateBack(AliTPCseed *pt, Int_t row0, Int_t row1);
89 Int_t PropagateForward();
90 Int_t PropagateForward2(TObjArray * arr);
91
47966a6d 92 void SortTracks(TObjArray * arr, Int_t mode) const;
91162307 93
94
1c53abe2 95 virtual Double_t ErrY2(AliTPCseed* seed, AliTPCclusterMI * cl = 0);
96 virtual Double_t ErrZ2(AliTPCseed* seed, AliTPCclusterMI * cl = 0);
97
b67e07dc 98 Double_t F1(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
99 Double_t F1old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
100 Double_t F2(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
101 Double_t F2old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3);
91162307 102
b67e07dc 103 Double_t F3(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2);
104 Double_t F3n(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2,
91162307 105 Double_t c);
106 Bool_t GetProlongation(Double_t x1, Double_t x2, Double_t x[5], Double_t &y, Double_t &z);
107
b67e07dc 108 public:
1c53abe2 109//**************** Internal tracker class **********************
b67e07dc 110 class AliTPCSector;
1c53abe2 111 class AliTPCRow {
b67e07dc 112 friend class AliTPCtrackerMI;
113 friend class AliTPCtrackerMI::AliTPCSector;
1c53abe2 114 public:
b67e07dc 115 AliTPCRow();
1c53abe2 116 ~AliTPCRow();
117 void InsertCluster(const AliTPCclusterMI *c, UInt_t index);
982aff31 118 void ResetClusters();
1c53abe2 119 operator int() const {return fN;}
91162307 120 Int_t GetN() const {return fN;}
1c53abe2 121 const AliTPCclusterMI* operator[](Int_t i) const {return fClusters[i];}
122 UInt_t GetIndex(Int_t i) const {return fIndex[i];}
91162307 123 inline Int_t Find(Double_t z) const;
1627d1c4 124 AliTPCclusterMI * FindNearest(Double_t y, Double_t z, Double_t roady, Double_t roadz) const;
91162307 125 AliTPCclusterMI * FindNearest2(Double_t y, Double_t z, Double_t roady, Double_t roadz, UInt_t & index) const;
126 AliTPCclusterMI * FindNearest3(Double_t y, Double_t z, Double_t roady, Double_t roadz, UInt_t & index) const;
127
1c53abe2 128 void SetX(Double_t x) {fX=x;}
129 Double_t GetX() const {return fX;}
6d171107 130private:
9996a03b 131 AliTPCRow & operator=(const AliTPCRow & );
132 AliTPCRow(const AliTPCRow& /*r*/); //dummy copy constructor
1c53abe2 133 Float_t fDeadZone; // the width of the dead zone
91162307 134 AliTPCclusterMI *fClusters1; //array with clusters 1
b67e07dc 135 Int_t fN1; //number of clusters on left side
91162307 136 AliTPCclusterMI *fClusters2; //array with clusters 2
b67e07dc 137 Int_t fN2; // number of clusters on right side of the TPC
138 Short_t fFastCluster[510]; //index of the nearest cluster at given position
1c53abe2 139 Int_t fN; //number of clusters
140 const AliTPCclusterMI *fClusters[kMaxClusterPerRow]; //pointers to clusters
91162307 141 // indexes for cluster at given position z
142 // AliTPCclusterMI *fClustersArray; //
1c53abe2 143 UInt_t fIndex[kMaxClusterPerRow]; //indeces of clusters
144 Double_t fX; //X-coordinate of this row
2fc0c115 145
1c53abe2 146 };
147
148//**************** Internal tracker class **********************
149 class AliTPCSector {
b67e07dc 150 friend class AliTPCtrackerMI;
1c53abe2 151 public:
152 AliTPCSector() { fN=0; fRow = 0; }
153 ~AliTPCSector() { delete[] fRow; }
9996a03b 154 AliTPCRow& operator[](Int_t i) const { return *(fRow+i); }
155 Int_t GetNRows() const { return fN; }
156 void Setup(const AliTPCParam *par, Int_t flag);
157 Double_t GetX(Int_t l) const {return fRow[l].GetX();}
158 Double_t GetMaxY(Int_t l) const {
159 return GetX(l)*TMath::Tan(0.5*GetAlpha());
160 }
161 Double_t GetAlpha() const {return fAlpha;}
162 Double_t GetAlphaShift() const {return fAlphaShift;}
163 //Int_t GetFirst(){return fFirstRow;}
164 Int_t GetRowNumber(Double_t x) const;
165 Double_t GetPadPitchWidth() const {return fPadPitchWidth;}
166 Double_t GetPadPitchLength() const {return fPadPitchLength;}
167 Double_t GetPadPitchLength(Float_t x) const {return (x<200) ? fPadPitchLength:f2PadPitchLength ;}
168
1c53abe2 169 private:
9996a03b 170 AliTPCSector & operator=(const AliTPCSector & );
171 AliTPCSector(const AliTPCSector &/*s*/); //dummy copy contructor
172 Int_t fN; //number of pad rows
173 //Int_t fFirstRow; //offset
174 AliTPCRow *fRow; //array of pad rows
175 Double_t fAlpha; //opening angle
176 Double_t fAlphaShift; //shift angle;
177 Double_t fPadPitchWidth; //pad pitch width
178 Double_t fPadPitchLength; //pad pitch length
179 Double_t f1PadPitchLength; //pad pitch length
180 Double_t f2PadPitchLength; //pad pitch length
1c53abe2 181
1c53abe2 182 };
183
184 Float_t OverlapFactor(AliTPCseed * s1, AliTPCseed * s2, Int_t &sum1, Int_t &sum2);
185 void SignShared(AliTPCseed * s1, AliTPCseed * s2);
91162307 186 void SignShared(TObjArray * arr);
187
188 void RemoveUsed(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t removalindex);
51ad6848 189 void RemoveUsed2(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t minimal);
91162307 190 void RemoveDouble(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t removalindex);
191
47966a6d 192 void StopNotActive(TObjArray * arr, Int_t row0, Float_t th0, Float_t th1, Float_t th2) const;
193 void StopNotActive(AliTPCseed * seed, Int_t row0, Float_t th0, Float_t th1, Float_t th2) const;
91162307 194 Int_t AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluster, Float_t factor, Float_t cory=1., Float_t corz=1.);
c9427e08 195
1c53abe2 196private:
91162307 197 inline AliTPCRow &GetRow(Int_t sec, Int_t row);
47966a6d 198 inline Double_t GetXrow(Int_t row) const;
199 inline Double_t GetMaxY(Int_t row) const;
200 inline Int_t GetRowNumber(Double_t x) const;
eea478d3 201 Int_t GetRowNumber(Double_t x[3]) const;
47966a6d 202 inline Double_t GetPadPitchLength(Double_t x) const;
203 inline Double_t GetPadPitchLength(Int_t row) const;
91162307 204
1c53abe2 205 Float_t GetSigmaY(AliTPCseed * seed);
206 Float_t GetSigmaZ(AliTPCseed * seed);
91162307 207 void GetShape(AliTPCseed * seed, Int_t row);
208
d26d9159 209 void ReadSeeds(AliESD *event, Int_t direction); //read seeds from the event
1c53abe2 210
91162307 211 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);
212 void MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], Float_t deltay = -1);
1627d1c4 213
91162307 214 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);
215
1c53abe2 216
91162307 217 AliTPCseed *MakeSeed(AliTPCseed *t, Float_t r0, Float_t r1, Float_t r2); //reseed
d26d9159 218 AliTPCseed *ReSeed(AliTPCseed *t, Float_t r0, Float_t r1, Float_t r2); //reseed
eea478d3 219 AliTPCseed *ReSeed(AliTPCseed *t, Int_t r0, Bool_t forward); //reseed
91162307 220
221
222
223 AliTPCseed * ReSeed(AliTPCseed *t);
224 Int_t LoadInnerSectors();
225 Int_t LoadOuterSectors();
226 void UnsignClusters();
227 void SignClusters(TObjArray * arr, Float_t fnumber=3., Float_t fdensity=2.);
228
229 void ParallelTracking(TObjArray * arr, Int_t rfirst, Int_t rlast);
230 void Tracking(TObjArray * arr);
231 TObjArray * Tracking(Int_t seedtype, Int_t i1, Int_t i2, Float_t cuts[4], Float_t dy=-1, Int_t dsec=0);
232 TObjArray * Tracking();
47966a6d 233 void SumTracks(TObjArray *arr1,TObjArray *arr2) const;
234 void PrepareForBackProlongation(TObjArray * arr, Float_t fac) const;
235 void PrepareForProlongation(TObjArray * arr, Float_t fac) const;
1c53abe2 236
4c57c771 237 void SetSampledEdx(AliTPCseed */*t*/, Float_t /*q*/, Int_t /*i*/) {;}
91162307 238 Int_t UpdateTrack(AliTPCseed *t, Int_t accept); //update trackinfo
1c53abe2 239
1c53abe2 240
1c53abe2 241 const Int_t fkNIS; //number of inner sectors
242 AliTPCSector *fInnerSec; //array of inner sectors;
243 const Int_t fkNOS; //number of outer sectors
244 AliTPCSector *fOuterSec; //array of outer sectors;
245
246 Int_t fN; //number of loaded sectors
247 AliTPCSector *fSectors; //pointer to loaded sectors;
91162307 248 //
249 TTree * fInput; // input tree with clusters
250 TTree * fOutput; // output tree with tracks
251 TTree * fSeedTree; // output tree with seeds - filled in debug mode 1
252 TTree * fTreeDebug; // output with a debug information about track
253 AliESD * fEvent; // output with esd tracks
254 Int_t fDebug; // debug option
255 Bool_t fNewIO; // indicated if we have data using New IO
1c53abe2 256 Int_t fNtracks; //current number of tracks
257 TObjArray *fSeeds; //array of track seeds
91162307 258 Int_t fIteration; // indicate iteration - 0 - froward -1 back - 2forward - back->forward
1c53abe2 259 // TObjArray * fTrackPointPool; // ! pool with track points
91162307 260 // TObjArray * fSeedPool; //! pool with seeds
261 Double_t fXRow[200]; // radius of the pad row
262 Double_t fYMax[200]; // max y for given pad row
263 Double_t fPadLength[200]; // max y for given pad row
1c53abe2 264 const AliTPCParam *fParam; //pointer to the parameters
81e97e0d 265 TTreeSRedirector *fDebugStreamer; //!debug streamer
91162307 266 ClassDef(AliTPCtrackerMI,1)
1c53abe2 267};
268
91162307 269
270AliTPCtrackerMI::AliTPCRow & AliTPCtrackerMI::GetRow(Int_t sec, Int_t row)
271{
272 //
273 return (row>=fInnerSec->GetNRows()) ? fOuterSec[sec][row-fInnerSec->GetNRows()]:fInnerSec[sec][row];
274}
275
47966a6d 276Double_t AliTPCtrackerMI::GetXrow(Int_t row) const {
91162307 277 // return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetX(row-fInnerSec->GetNRows()):fInnerSec->GetX(row);
278 return fXRow[row];
279}
280
47966a6d 281Double_t AliTPCtrackerMI::GetMaxY(Int_t row) const {
91162307 282 //return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetMaxY(row-fInnerSec->GetNRows()):fInnerSec->GetMaxY(row);
283 return fYMax[row];
284}
285
47966a6d 286Int_t AliTPCtrackerMI::GetRowNumber(Double_t x) const
91162307 287{
288 //
289 return (x>133.) ? fOuterSec->GetRowNumber(x)+fInnerSec->GetNRows():fInnerSec->GetRowNumber(x);
290}
291
47966a6d 292Double_t AliTPCtrackerMI::GetPadPitchLength(Double_t x) const
91162307 293{
294 //
295 return (x>133.) ? fOuterSec->GetPadPitchLength(x):fInnerSec->GetPadPitchLength(x);
296 //return fPadLength[row];
297}
298
47966a6d 299Double_t AliTPCtrackerMI::GetPadPitchLength(Int_t row) const
91162307 300{
301 //
302 return fPadLength[row];
303}
304
305
306
1c53abe2 307#endif
308
309