TPC module
[u/mrichter/AliRoot.git] / TPC / TPCrec / AliTPCtracker.h
CommitLineData
265b5e37 1
829455ad 2#ifndef ALITPCTRACKER_H
3#define ALITPCTRACKER_H
1c53abe2 4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
91162307 7
1c53abe2 8/* $Id$ */
9
10//-------------------------------------------------------
47966a6d 11// TPC tracker
12// Parallel tracker
1c53abe2 13//
14// Origin:
15//-------------------------------------------------------
6d171107 16
f06a1ff6 17#include <TArrayI.h>
8cc1870a 18#include <TMatrixD.h>
1c53abe2 19#include "AliTracker.h"
81e97e0d 20#include "AliTPCreco.h"
b9671574 21#include "AliTPCclusterMI.h"
9350f379 22#include "AliTPCtrackerSector.h"
5576d489 23#include "AliESDfriend.h"
24
81e97e0d 25
b67e07dc 26
1c53abe2 27class TFile;
28class AliTPCParam;
29class AliTPCseed;
91162307 30class AliTPCTrackerPoint;
bad6eb00 31class AliESDEvent;
32class AliESDtrack;
91162307 33class TTree;
eea478d3 34class AliESDkink;
81e97e0d 35class TTreeSRedirector;
2ccb4dfc 36class AliTrackPoint;
ec7e4ad6 37class AliDCSSensorArray;
38class AliDCSSensor;
9a836cc2 39class TGraphErrors;
bd26fa83 40
ddfbc51a 41
829455ad 42class AliTPCtracker : public AliTracker {
1c53abe2 43public:
65e67c9c 44 enum EStreamFlags{ // flags to store addition data/code debugging infomation which is not stored in ESD but in specaial TPCdebug.root file
45 kStreamTransform =0x00001, // flag:stream cluster transformation
46 kStreamErrParam =0x00002, // flag:stream in debug mode cluster and track extrapolation at given row together with error nad shape estimate
47 kStreamFilterClusterInfo =0x00004, // flag:stream TPC data ouliers filtering information
48 kStreamClDump =0x00008, // flag:stream clusters at the end of process (signed with useage flags)
49 kStreamRemoveUsed =0x00010, // flag:stream information about TPC tracks which were descarded (double track removal)
50 kStreamRemoveShort =0x00020, // flag:stream information about TPC tracks which were discarded (short track removal)
51 kStreamSplitted2 =0x00040, // flag:stream information about discarded TPC tracks pair algorithm
52 kStreamFillESD =0x00080, // flag: stream track information in FillESD function (after track Iteration 0)
53 kStreamCPropagateBack =0x00100, // flag: stream track information in PropagateBack function (after tracking Iteration 1)
54 kStreamRecoverBack =0x00200, // flag: stream track information for track failing PropagateBack function and recovered back
55 kStreamRefitInward =0x00400, // flag: stream track information in RefitInward function (after tracking Iteration 2)
56 kStreamRecoverIn =0x00800, // flag: stream track information for track failing in RefitInward function and recovered back
57 kStreamUpdateTrack =0x01000, // flag: stream track/cluster infroamtion in track update method
58 //
59 kStreamCrosstalkMatrix =0x02000, // flag: stream crosstalk matrix as used in the reconstruction at given region of TPC
60 kStreamXtalk =0x04000, // flag: stream crosstalk correction as applied to cluster
61 kStreamIonTail =0x08000, // flag: stream ion tail correction as applied to cluster
62 kStreamFindMultiMC =0x10000, // flag: stream MC infomation about the multiple find track (ONLY for MC data)
63 kStreamFindCurling =0x20000, // flag: stream track infroamtion in the FindCurling tracks method
64 kStreamFindKinks =0x40000, // flag: stream track infroamtion in the FindKinks method
65 };
829455ad 66 AliTPCtracker();
67 AliTPCtracker(const AliTPCParam *par);
68 virtual ~AliTPCtracker();
91162307 69 //
d26d9159 70 void SetIteration(Int_t iteration){fIteration = iteration;}
72e25240 71 virtual Int_t Clusters2TracksHLT(AliESDEvent *const esd, const AliESDEvent *hltEvent);
2f051b58 72 virtual Int_t Clusters2Tracks (AliESDEvent *const esd);
af885e0f 73 virtual Int_t RefitInward (AliESDEvent *esd);
2f051b58 74 virtual Int_t LoadClusters (TTree * const tree);
47af7ca4 75 virtual Int_t LoadClusters (const TObjArray * arr); // another input
76 virtual Int_t LoadClusters (const TClonesArray * arr); // another input
eea44233 77 void FilterOutlierClusters(); // filter outlier clusters
ec7e4ad6 78 virtual Int_t PostProcess(AliESDEvent *esd);
d26d9159 79 Int_t LoadClusters();
80 void UnloadClusters();
98ee6d31 81 Int_t LoadInnerSectors();
82 Int_t LoadOuterSectors();
002af263 83 virtual void FillClusterArray(TObjArray* array) const;
75fb37cc 84 void Transform(AliTPCclusterMI * cluster);
9a836cc2 85 void ApplyTailCancellation();
265b5e37 86 void ApplyXtalkCorrection();
3c8c25a3 87 void CalculateXtalkCorrection();
5a516e0a 88 void GetTailValue(Float_t ampfactor,Double_t &ionTailMax,Double_t &ionTailTotal,TGraphErrors **graphRes,Float_t *indexAmpGraphs,AliTPCclusterMI *cl0,AliTPCclusterMI *cl1);
91162307 89 //
47af7ca4 90 void FillESD(const TObjArray* arr);
91162307 91 void DeleteSeeds();
92 void SetDebug(Int_t debug){ fDebug = debug;}
af885e0f 93 void FindKinks(TObjArray * array, AliESDEvent * esd);
6d493ea0 94 //
47af7ca4 95 void FindCurling(const TObjArray * array, AliESDEvent * esd, Int_t iter);
1af5da7e 96 void FindSplitted(TObjArray * array, AliESDEvent * esd, Int_t iter);
47af7ca4 97 void FindMultiMC(const TObjArray * array, AliESDEvent * esd, Int_t iter);
6d493ea0 98 //
51ad6848 99 void UpdateKinkQualityM(AliTPCseed * seed);
eea478d3 100 void UpdateKinkQualityD(AliTPCseed * seed);
2f051b58 101 Int_t CheckKinkPoint(AliTPCseed*seed, AliTPCseed &mother, AliTPCseed &daughter, const AliESDkink &kink);
102 Int_t RefitKink(AliTPCseed &mother, AliTPCseed &daughter, const AliESDkink &kink);
1c53abe2 103 Int_t ReadSeeds(const TFile *in);
47af7ca4 104 TObjArray * GetSeeds() const {return fSeeds;}
96495539 105 void SetSeeds(TObjArray * seeds) { fSeeds = seeds;}
91162307 106 //
34acb742 107 AliCluster * GetCluster(Int_t index) const {return (AliCluster*)GetClusterMI(index);}
1c53abe2 108 AliTPCclusterMI *GetClusterMI(Int_t index) const;
f8aae377 109 Int_t Clusters2Tracks();
af32720d 110 virtual void CookLabel(AliKalmanTrack *tk,Float_t wrong) const;
2f051b58 111 virtual Int_t CookLabel(AliTPCseed *const t,Float_t wrong, Int_t first,Int_t last ) const;
91162307 112
c9427e08 113 void RotateToLocal(AliTPCseed *seed);
91162307 114
f124f8bf 115 Int_t FollowProlongation(AliTPCseed& t, Int_t rf=0, Int_t step=1, Bool_t fromSeeds=0);
2ccb4dfc 116 Bool_t GetTrackPoint(Int_t index, AliTrackPoint &p ) const;
117
f124f8bf 118 Int_t FollowBackProlongation(AliTPCseed& t, Int_t rf, Bool_t fromSeeds=0);
91162307 119 Int_t FollowToNext(AliTPCseed& t, Int_t nr);
91162307 120 Int_t UpdateClusters(AliTPCseed& t, Int_t nr);
121 Int_t FollowToNextCluster( AliTPCseed& t, Int_t nr);
122
544c295f 123 Int_t PropagateBack(const TObjArray *const arr);
af885e0f 124 Int_t PropagateBack(AliESDEvent * event);
2f051b58 125 Int_t PropagateBack(AliTPCseed *const pt, Int_t row0, Int_t row1);
91162307 126 Int_t PropagateForward();
544c295f 127 Int_t PropagateForward2(const TObjArray *const arr);
91162307 128
47966a6d 129 void SortTracks(TObjArray * arr, Int_t mode) const;
91162307 130
47af7ca4 131 virtual Double_t ErrY2(AliTPCseed* seed, const AliTPCclusterMI * cl = 0);
132 virtual Double_t ErrZ2(AliTPCseed* seed, const AliTPCclusterMI * cl = 0);
1c53abe2 133
47af7ca4 134 Double_t F1(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3) const;
135 Double_t F1old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3) const;
136 Double_t F2(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3) const;
137 Double_t F2old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3) const;
91162307 138
47af7ca4 139 Double_t F3(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2) const;
b67e07dc 140 Double_t F3n(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2,
47af7ca4 141 Double_t c) const;
2f051b58 142 Bool_t GetProlongation(Double_t x1, Double_t x2, Double_t x[5], Double_t &y, Double_t &z) const;
f06a1ff6 143 //
ddfbc51a 144 void ResetSeedsPool();
145 void MarkSeedFree( TObject* seed );
146 TObject *&NextFreeSeed();
147 //
b67e07dc 148 public:
1598ba75 149 void SetUseHLTClusters(Int_t useHLTClusters) {fUseHLTClusters = useHLTClusters;} // set usage from HLT clusters from rec.C options
1c53abe2 150
50f68b1a 151 inline void SetTPCtrackerSectors(AliTPCtrackerSector *innerSec, AliTPCtrackerSector *outerSec); // set the AliTPCtrackerSector arrays from outside (toy MC)
152
1c53abe2 153 Float_t OverlapFactor(AliTPCseed * s1, AliTPCseed * s2, Int_t &sum1, Int_t &sum2);
154 void SignShared(AliTPCseed * s1, AliTPCseed * s2);
91162307 155 void SignShared(TObjArray * arr);
156
51ad6848 157 void RemoveUsed2(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t minimal);
91162307 158
00055a22 159 Int_t AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluster);
c9427e08 160
ec7e4ad6 161 Bool_t IsTPCHVDipEvent(AliESDEvent const *esdEvent);
162
7f1a1b08 163 // public for ToyMC usage
164 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);
165 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);
166 void SumTracks(TObjArray *arr1,TObjArray *&arr2);
167 void SignClusters(const TObjArray * arr, Float_t fnumber=3., Float_t fdensity=2.);
168
1c53abe2 169private:
76d56fd6 170 Bool_t IsFindable(AliTPCseed & t);
829455ad 171 AliTPCtracker(const AliTPCtracker& r); //dummy copy constructor
172 AliTPCtracker &operator=(const AliTPCtracker& r);//dummy assignment operator
92f513f5 173 void AddCovariance(AliTPCseed * seed); // add covariance
e1dadcd0 174 void AddCovarianceAdd(AliTPCseed * seed); // add covariance
92f513f5 175
bd26fa83 176 inline AliTPCtrackerRow &GetRow(Int_t sec, Int_t row);
5afd7dbd 177 inline Bool_t IsActive(Int_t sec, Int_t row);
47966a6d 178 inline Double_t GetXrow(Int_t row) const;
179 inline Double_t GetMaxY(Int_t row) const;
180 inline Int_t GetRowNumber(Double_t x) const;
eea478d3 181 Int_t GetRowNumber(Double_t x[3]) const;
47966a6d 182 inline Double_t GetPadPitchLength(Double_t x) const;
183 inline Double_t GetPadPitchLength(Int_t row) const;
91162307 184
fd065ea2 185 void GetShape(AliTPCseed * seed, Int_t row);
91162307 186
544c295f 187 void ReadSeeds(const AliESDEvent *const event, Int_t direction); //read seeds from the event
1c53abe2 188
91162307 189 void MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], Float_t deltay = -1);
91162307 190
1c53abe2 191
2f051b58 192 AliTPCseed *MakeSeed(AliTPCseed *const track, Float_t r0, Float_t r1, Float_t r2); //reseed
47af7ca4 193 AliTPCseed *ReSeed(const AliTPCseed *t, Float_t r0, Float_t r1, Float_t r2); //reseed
eea478d3 194 AliTPCseed *ReSeed(AliTPCseed *t, Int_t r0, Bool_t forward); //reseed
91162307 195
196
197
198 AliTPCseed * ReSeed(AliTPCseed *t);
98ee6d31 199 //Int_t LoadInnerSectors();
200 //Int_t LoadOuterSectors();
f47588e0 201 void DumpClusters(Int_t iter, TObjArray *trackArray);
91162307 202 void UnsignClusters();
91162307 203
5576d489 204 void FillClusterOccupancyInfo();
205
2f051b58 206 void ParallelTracking(TObjArray *const arr, Int_t rfirst, Int_t rlast);
91162307 207 void Tracking(TObjArray * arr);
208 TObjArray * Tracking(Int_t seedtype, Int_t i1, Int_t i2, Float_t cuts[4], Float_t dy=-1, Int_t dsec=0);
209 TObjArray * Tracking();
a395b09f 210 TObjArray * TrackingSpecial();
544c295f 211 void PrepareForBackProlongation(const TObjArray *const arr, Float_t fac) const;
2f051b58 212 void PrepareForProlongation(TObjArray *const arr, Float_t fac) const;
1c53abe2 213
91162307 214 Int_t UpdateTrack(AliTPCseed *t, Int_t accept); //update trackinfo
1c53abe2 215
bad6eb00 216 void MakeESDBitmaps(AliTPCseed *t, AliESDtrack *esd);
1c53abe2 217
72e25240 218 Int_t PropagateToRowHLT(AliTPCseed *pt, int nrow);
219 void TrackFollowingHLT(TObjArray *const arr);
220 TObjArray * MakeSeedsHLT(const AliESDEvent *hltEvent);
221
1c53abe2 222 const Int_t fkNIS; //number of inner sectors
9350f379 223 AliTPCtrackerSector *fInnerSec; //array of inner sectors;
1c53abe2 224 const Int_t fkNOS; //number of outer sectors
9350f379 225 AliTPCtrackerSector *fOuterSec; //array of outer sectors;
1c53abe2 226
227 Int_t fN; //number of loaded sectors
9350f379 228 AliTPCtrackerSector *fSectors; //pointer to loaded sectors;
91162307 229 //
230 TTree * fInput; // input tree with clusters
231 TTree * fOutput; // output tree with tracks
232 TTree * fSeedTree; // output tree with seeds - filled in debug mode 1
233 TTree * fTreeDebug; // output with a debug information about track
af885e0f 234 AliESDEvent * fEvent; // output with esd tracks
72e25240 235 const AliESDEvent * fEventHLT; // input with HLT tracks
91162307 236 Int_t fDebug; // debug option
237 Bool_t fNewIO; // indicated if we have data using New IO
1c53abe2 238 Int_t fNtracks; //current number of tracks
239 TObjArray *fSeeds; //array of track seeds
91162307 240 Int_t fIteration; // indicate iteration - 0 - froward -1 back - 2forward - back->forward
1c53abe2 241 // TObjArray * fTrackPointPool; // ! pool with track points
91162307 242 Double_t fXRow[200]; // radius of the pad row
243 Double_t fYMax[200]; // max y for given pad row
244 Double_t fPadLength[200]; // max y for given pad row
47af7ca4 245 const AliTPCParam *fkParam; //pointer to the parameters
81e97e0d 246 TTreeSRedirector *fDebugStreamer; //!debug streamer
1598ba75 247 Int_t fUseHLTClusters; // use HLT clusters instead of offline clusters
f06a1ff6 248 //
8cc1870a 249
39240815 250 TObjArray * fCrossTalkSignalArray; // for 36 sectors
ddfbc51a 251 TClonesArray* fSeedsPool; //! pool of seeds
252 TArrayI fFreeSeedsID; //! array of ID's of freed seeds
253 Int_t fNFreeSeeds; //! number of seeds freed in the pool
254 Int_t fLastSeedID; //! id of the pool seed on which is returned by the NextFreeSeed method
f06a1ff6 255 //
829455ad 256 ClassDef(AliTPCtracker,4)
1c53abe2 257};
258
91162307 259
829455ad 260AliTPCtrackerRow & AliTPCtracker::GetRow(Int_t sec, Int_t row)
91162307 261{
262 //
263 return (row>=fInnerSec->GetNRows()) ? fOuterSec[sec][row-fInnerSec->GetNRows()]:fInnerSec[sec][row];
264}
265
829455ad 266Bool_t AliTPCtracker::IsActive(Int_t sec, Int_t row)
5afd7dbd 267{
268 //
269 // check if the given sector row is active
270 //
271 return (row>=fInnerSec->GetNRows()) ? fOuterSec[sec][row-fInnerSec->GetNRows()].GetN()>0:fInnerSec[sec][row].GetN()>0;
272}
273
274
829455ad 275Double_t AliTPCtracker::GetXrow(Int_t row) const {
91162307 276 // return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetX(row-fInnerSec->GetNRows()):fInnerSec->GetX(row);
277 return fXRow[row];
278}
279
829455ad 280Double_t AliTPCtracker::GetMaxY(Int_t row) const {
91162307 281 //return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetMaxY(row-fInnerSec->GetNRows()):fInnerSec->GetMaxY(row);
282 return fYMax[row];
283}
284
829455ad 285Int_t AliTPCtracker::GetRowNumber(Double_t x) const
91162307 286{
287 //
288 return (x>133.) ? fOuterSec->GetRowNumber(x)+fInnerSec->GetNRows():fInnerSec->GetRowNumber(x);
289}
290
829455ad 291Double_t AliTPCtracker::GetPadPitchLength(Double_t x) const
91162307 292{
293 //
294 return (x>133.) ? fOuterSec->GetPadPitchLength(x):fInnerSec->GetPadPitchLength(x);
295 //return fPadLength[row];
296}
297
829455ad 298Double_t AliTPCtracker::GetPadPitchLength(Int_t row) const
91162307 299{
300 //
301 return fPadLength[row];
302}
303
50f68b1a 304void AliTPCtracker::SetTPCtrackerSectors(AliTPCtrackerSector *innerSec, AliTPCtrackerSector *outerSec)
305{
306 //
307 fInnerSec = innerSec;
308 fOuterSec = outerSec;
309}
310
1c53abe2 311#endif
312
313