Line data Source code
1 :
2 : #ifndef ALITPCTRACKER_H
3 : #define ALITPCTRACKER_H
4 : /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 : * See cxx source for full Copyright notice */
6 :
7 :
8 : /* $Id$ */
9 :
10 : //-------------------------------------------------------
11 : // TPC tracker
12 : // Parallel tracker
13 : //
14 : // Origin:
15 : //-------------------------------------------------------
16 :
17 : #include <TArrayI.h>
18 : #include <TMatrixD.h>
19 : #include "AliTracker.h"
20 : #include "AliTPCreco.h"
21 : #include "AliTPCclusterMI.h"
22 : #include "AliTPCtrackerSector.h"
23 : #include "AliESDfriend.h"
24 : #include "AliTPCseed.h"
25 :
26 :
27 : class TFile;
28 : class AliTPCParam;
29 : class AliTPCseed;
30 : class AliESDEvent;
31 : class AliESDtrack;
32 : class TTree;
33 : class AliESDkink;
34 : class TTreeSRedirector;
35 : class AliTrackPoint;
36 : class AliDCSSensorArray;
37 : class AliDCSSensor;
38 : class TGraphErrors;
39 :
40 :
41 : class AliTPCtracker : public AliTracker {
42 : public:
43 : enum EStreamFlags{ // flags to store addition data/code debugging infomation which is not stored in ESD but in specaial TPCdebug.root file
44 : kStreamTransform =0x00001, // flag:stream cluster transformation
45 : kStreamErrParam =0x00002, // flag:stream in debug mode cluster and track extrapolation at given row together with error nad shape estimate
46 : kStreamFilterClusterInfo =0x00004, // flag:stream TPC data ouliers filtering information
47 : kStreamClDump =0x00008, // flag:stream clusters at the end of process (signed with useage flags)
48 : kStreamRemoveUsed =0x00010, // flag:stream information about TPC tracks which were descarded (double track removal)
49 : kStreamRemoveShort =0x00020, // flag:stream information about TPC tracks which were discarded (short track removal)
50 : kStreamSplitted2 =0x00040, // flag:stream information about discarded TPC tracks pair algorithm
51 : kStreamFillESD =0x00080, // flag: stream track information in FillESD function (after track Iteration 0)
52 : kStreamCPropagateBack =0x00100, // flag: stream track information in PropagateBack function (after tracking Iteration 1)
53 : kStreamRecoverBack =0x00200, // flag: stream track information for track failing PropagateBack function and recovered back
54 : kStreamRefitInward =0x00400, // flag: stream track information in RefitInward function (after tracking Iteration 2)
55 : kStreamRecoverIn =0x00800, // flag: stream track information for track failing in RefitInward function and recovered back
56 : kStreamUpdateTrack =0x01000, // flag: stream track/cluster infroamtion in track update method
57 : //
58 : kStreamCrosstalkMatrix =0x02000, // flag: stream crosstalk matrix as used in the reconstruction at given region of TPC
59 : kStreamXtalk =0x04000, // flag: stream crosstalk correction as applied to cluster
60 : kStreamIonTail =0x08000, // flag: stream ion tail correction as applied to cluster
61 : kStreamFindMultiMC =0x10000, // flag: stream MC infomation about the multiple find track (ONLY for MC data)
62 : kStreamFindCurling =0x20000, // flag: stream track infroamtion in the FindCurling tracks method
63 : kStreamFindKinks =0x40000, // flag: stream track infroamtion in the FindKinks method
64 : kStreamSeeddEdx =0x80000 // flag: stream TPC dEdx intermediate information AliTPCseed::CookdEdxNorm (to check and validate methods used in calibration)
65 : };
66 : enum {kMaxFriendTracks=2000};
67 :
68 : AliTPCtracker();
69 : AliTPCtracker(const AliTPCParam *par);
70 : virtual ~AliTPCtracker();
71 : //
72 0 : void SetIteration(Int_t iteration){fIteration = iteration;}
73 : virtual Int_t Clusters2TracksHLT(AliESDEvent *const esd, const AliESDEvent *hltEvent);
74 : virtual Int_t Clusters2Tracks (AliESDEvent *const esd);
75 : virtual Int_t RefitInward (AliESDEvent *esd);
76 : virtual Int_t LoadClusters (TTree * const tree);
77 : virtual Int_t LoadClusters (const TObjArray * arr); // another input
78 : virtual Int_t LoadClusters (const TClonesArray * arr); // another input
79 : void FilterOutlierClusters(); // filter outlier clusters
80 : virtual Int_t PostProcess(AliESDEvent *esd);
81 : Int_t LoadClusters();
82 : void UnloadClusters();
83 : Int_t LoadInnerSectors();
84 : Int_t LoadOuterSectors();
85 : virtual void FillClusterArray(TObjArray* array) const;
86 : void Transform(AliTPCclusterMI * cluster);
87 : void ApplyTailCancellation();
88 : void ApplyXtalkCorrection();
89 : void CalculateXtalkCorrection();
90 : void GetTailValue(Float_t ampfactor,Double_t &ionTailMax,Double_t &ionTailTotal,TGraphErrors **graphRes,Float_t *indexAmpGraphs,AliTPCclusterMI *cl0,AliTPCclusterMI *cl1);
91 : //
92 : void FillESD(const TObjArray* arr);
93 : void DeleteSeeds();
94 0 : void SetDebug(Int_t debug){ fDebug = debug;}
95 : void FindKinks(TObjArray * array, AliESDEvent * esd);
96 : //
97 : void FindCurling(const TObjArray * array, AliESDEvent * esd, Int_t iter);
98 : void FindSplitted(TObjArray * array, AliESDEvent * esd, Int_t iter);
99 : void FindMultiMC(const TObjArray * array, AliESDEvent * esd, Int_t iter);
100 : //
101 : void UpdateKinkQualityM(AliTPCseed * seed);
102 : void UpdateKinkQualityD(AliTPCseed * seed);
103 : Int_t CheckKinkPoint(AliTPCseed*seed, AliTPCseed &mother, AliTPCseed &daughter, const AliESDkink &kink);
104 : Int_t RefitKink(AliTPCseed &mother, AliTPCseed &daughter, const AliESDkink &kink);
105 : Int_t ReadSeeds(const TFile *in);
106 0 : TObjArray * GetSeeds() const {return fSeeds;}
107 0 : void SetSeeds(TObjArray * seeds) { fSeeds = seeds;}
108 : //
109 0 : AliCluster * GetCluster(Int_t index) const {return (AliCluster*)GetClusterMI(index);}
110 : AliTPCclusterMI *GetClusterMI(Int_t index) const;
111 : Int_t Clusters2Tracks();
112 : virtual void CookLabel(AliKalmanTrack *tk,Float_t wrong) const;
113 : virtual Int_t CookLabel(AliTPCseed *const t,Float_t wrong, Int_t first,Int_t last ) const;
114 :
115 : void RotateToLocal(AliTPCseed *seed);
116 :
117 : Int_t FollowProlongation(AliTPCseed& t, Int_t rf=0, Int_t step=1, Bool_t fromSeeds=0);
118 : Bool_t GetTrackPoint(Int_t index, AliTrackPoint &p ) const;
119 :
120 : Int_t FollowBackProlongation(AliTPCseed& t, Int_t rf, Bool_t fromSeeds=0);
121 : Int_t FollowToNext(AliTPCseed& t, Int_t nr);
122 : Int_t UpdateClusters(AliTPCseed& t, Int_t nr);
123 : Int_t FollowToNextCluster( AliTPCseed& t, Int_t nr);
124 :
125 : Int_t PropagateBack(const TObjArray *const arr);
126 : Int_t PropagateBack(AliESDEvent * event);
127 : Int_t PropagateBack(AliTPCseed *const pt, Int_t row0, Int_t row1);
128 : Int_t PropagateForward();
129 : Int_t PropagateForward2(const TObjArray *const arr);
130 :
131 : void SortTracks(TObjArray * arr, Int_t mode) const;
132 :
133 : void ErrY2Z2(AliTPCseed* seed, const AliTPCclusterMI *cl, double &erry2, double &errz2);
134 : virtual Double_t ErrY2(AliTPCseed* seed, const AliTPCclusterMI * cl);
135 : virtual Double_t ErrZ2(AliTPCseed* seed, const AliTPCclusterMI * cl);
136 :
137 : Double_t F1(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3) const;
138 : Double_t F1old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3) const;
139 : Double_t F2(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3) const;
140 : Double_t F2old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3) const;
141 :
142 : Double_t F3(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2) const;
143 : Double_t F3n(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2,
144 : Double_t c) const;
145 : Bool_t GetProlongation(Double_t x1, Double_t x2, Double_t x[5], Double_t &y, Double_t &z) const;
146 : Bool_t GetProlongationLine(Double_t x1, Double_t x2, Double_t x[5], Double_t &y, Double_t &z) const;
147 : //
148 : void ResetSeedsPool();
149 : void MarkSeedFree( TObject* seed );
150 : TObject *&NextFreeSeed();
151 : //
152 : void FillSeedClusterStatCache(const AliTPCseed* seed);
153 : void GetCachedSeedClusterStatistic(Int_t first, Int_t last, Int_t &found, Int_t &foundable, Int_t &shared, Bool_t plus2) const;
154 : void GetSeedClusterStatistic(const AliTPCseed* seed, Int_t first, Int_t last, Int_t &found, Int_t &foundable, Int_t &shared, Bool_t plus2) const;
155 : //
156 : public:
157 4 : void SetUseHLTClusters(Int_t useHLTClusters) {fUseHLTClusters = useHLTClusters;} // set usage from HLT clusters from rec.C options
158 :
159 : inline void SetTPCtrackerSectors(AliTPCtrackerSector *innerSec, AliTPCtrackerSector *outerSec); // set the AliTPCtrackerSector arrays from outside (toy MC)
160 :
161 : Float_t OverlapFactor(AliTPCseed * s1, AliTPCseed * s2, Int_t &sum1, Int_t &sum2);
162 : void SignShared(AliTPCseed * s1, AliTPCseed * s2);
163 : void SignShared(TObjArray * arr);
164 :
165 : void RemoveUsed2(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t minimal);
166 :
167 : Int_t AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluster);
168 :
169 : Bool_t IsTPCHVDipEvent(AliESDEvent const *esdEvent);
170 :
171 : // public for ToyMC usage
172 : 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);
173 : void MakeSeeds2Dist(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], Float_t deltay = -1, Bool_t bconstrain=kTRUE);
174 : 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);
175 : void MakeSeeds3Dist(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], Float_t deltay = -1, Int_t ddsec=0);
176 : void SumTracks(TObjArray *arr1,TObjArray *&arr2);
177 : void SignClusters(const TObjArray * arr, Float_t fnumber=3., Float_t fdensity=2.);
178 : //
179 : Bool_t DistortX(const AliTPCseed* seed, double& x, int row);
180 : //
181 24 : virtual Bool_t OwnsESDObjects() const {return kTRUE;} //RS TPC owns the seeds stored in the friends
182 : virtual void CleanESDFriendsObjects(AliESDEvent* esd);
183 : virtual void CleanESDTracksObjects(TObjArray* trcList);
184 : //
185 : Double_t GetDistortionX(double x, double y, double z, int sec, int row);
186 : Double_t GetYSectEdgeDist(int sec, int row, double ymax, double z);
187 : static Int_t GetTrackSector(double alpha);
188 :
189 : private:
190 : Bool_t IsFindable(AliTPCseed & t);
191 : AliTPCtracker(const AliTPCtracker& r); //dummy copy constructor
192 : AliTPCtracker &operator=(const AliTPCtracker& r);//dummy assignment operator
193 : void AddCovariance(AliTPCseed * seed); // add covariance
194 : void AddCovarianceAdd(AliTPCseed * seed); // add covariance
195 :
196 : inline AliTPCtrackerRow &GetRow(Int_t sec, Int_t row);
197 : inline Bool_t IsActive(Int_t sec, Int_t row);
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;
201 : inline Int_t GetRowNumber(const AliTPCseed* seed) const;
202 : Int_t GetRowNumber(Double_t x[3]) const;
203 : inline Double_t GetPadPitchLength(Double_t x) const;
204 : inline Double_t GetPadPitchLength(Int_t row) const;
205 :
206 : void GetShape(AliTPCseed * seed, Int_t row);
207 :
208 : void ReadSeeds(const AliESDEvent *const event, Int_t direction); //read seeds from the event
209 :
210 : void MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], Float_t deltay = -1);
211 : void MakeSeeds5Dist(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], Float_t deltay = -1);
212 :
213 :
214 : AliTPCseed *MakeSeed(AliTPCseed *const track, Float_t r0, Float_t r1, Float_t r2); //reseed
215 : AliTPCseed *ReSeed(const AliTPCseed *t, Float_t r0, Float_t r1, Float_t r2); //reseed
216 : AliTPCseed *ReSeed(AliTPCseed *t, Int_t r0, Bool_t forward); //reseed
217 :
218 :
219 :
220 : AliTPCseed * ReSeed(AliTPCseed *t);
221 : //Int_t LoadInnerSectors();
222 : //Int_t LoadOuterSectors();
223 : void DumpClusters(Int_t iter, TObjArray *trackArray);
224 : void UnsignClusters();
225 :
226 : void FillClusterOccupancyInfo();
227 :
228 : void ParallelTracking(TObjArray *const arr, Int_t rfirst, Int_t rlast);
229 : void Tracking(TObjArray * arr);
230 : TObjArray * Tracking(Int_t seedtype, Int_t i1, Int_t i2, Float_t cuts[4], Float_t dy=-1, Int_t dsec=0);
231 : TObjArray * Tracking();
232 : TObjArray * TrackingSpecial();
233 : void PrepareForBackProlongation(const TObjArray *const arr, Float_t fac) const;
234 : void PrepareForProlongation(TObjArray *const arr, Float_t fac) const;
235 :
236 : Int_t UpdateTrack(AliTPCseed *t, Int_t accept); //update trackinfo
237 :
238 : void MakeESDBitmaps(AliTPCseed *t, AliESDtrack *esd);
239 :
240 : Int_t PropagateToRowHLT(AliTPCseed *pt, int nrow);
241 : void TrackFollowingHLT(TObjArray *const arr);
242 : TObjArray * MakeSeedsHLT(const AliESDEvent *hltEvent);
243 :
244 : const Int_t fkNIS; //number of inner sectors
245 : AliTPCtrackerSector *fInnerSec; //array of inner sectors;
246 : const Int_t fkNOS; //number of outer sectors
247 : AliTPCtrackerSector *fOuterSec; //array of outer sectors;
248 :
249 : Int_t fN; //number of loaded sectors
250 : AliTPCtrackerSector *fSectors; //pointer to loaded sectors;
251 : //
252 : TTree * fInput; // input tree with clusters
253 : TTree * fOutput; // output tree with tracks
254 : TTree * fSeedTree; // output tree with seeds - filled in debug mode 1
255 : TTree * fTreeDebug; // output with a debug information about track
256 : AliESDEvent * fEvent; // output with esd tracks
257 : const AliESDEvent * fEventHLT; // input with HLT tracks
258 : Int_t fDebug; // debug option
259 : Bool_t fNewIO; // indicated if we have data using New IO
260 : Int_t fNtracks; //current number of tracks
261 : TObjArray *fSeeds; //array of track seeds
262 : Int_t fIteration; // indicate iteration - 0 - froward -1 back - 2forward - back->forward
263 : // TObjArray * fTrackPointPool; // ! pool with track points
264 : Double_t fXRow[200]; // radius of the pad row
265 : Double_t fYMax[200]; // max y for given pad row
266 : Double_t fPadLength[200]; // max y for given pad row
267 : const AliTPCParam *fkParam; //pointer to the parameters
268 : TTreeSRedirector *fDebugStreamer; //!debug streamer
269 : Int_t fUseHLTClusters; // use HLT clusters instead of offline clusters
270 : //
271 : Double_t fClExtraRoadY; //! extra additiom to Y road for FindCluster
272 : Double_t fClExtraRoadZ; //! extra addition Z road for FindCluster
273 : Double_t fExtraClErrYZ2; //! extra cl.error Y^2+Z^2
274 : Double_t fExtraClErrY2; //! extra cl.error Y^2
275 : Double_t fExtraClErrZ2; //! extra cl.error Z^2
276 : Double_t fPrimaryDCAZCut; //! special cut on DCAz for primaries tracking only, disables secondaries seeding
277 : Double_t fPrimaryDCAYCut; //! special cut on DCAy for primaries tracking only, disables secondaries seeding
278 : Bool_t fDisableSecondaries; //! special flag to disable secondaries seeding
279 : TObjArray * fCrossTalkSignalArray; // for 36 sectors
280 : AliTPCclusterMI** fClPointersPool; //! pool of cluster pointers for seeds stored in friends
281 : AliTPCclusterMI** fClPointersPoolPtr; //! pointer on the current free slot in the pool
282 : Int_t fClPointersPoolSize; // number of seeds holding the cluster arrays
283 : TClonesArray* fSeedsPool; //! pool of seeds
284 : TClonesArray* fHelixPool; //! pool of helises
285 : TClonesArray* fETPPool; //! pool of helises
286 : TArrayI fFreeSeedsID; //! array of ID's of freed seeds
287 : Int_t fNFreeSeeds; //! number of seeds freed in the pool
288 : Int_t fLastSeedID; //! id of the pool seed on which is returned by the NextFreeSeed method
289 : //
290 : Bool_t fClStatFoundable[kMaxRow]; //! cached info on foundable clusters of the seed
291 : Bool_t fClStatFound[kMaxRow]; //! cached info on found clusters of the seed
292 : Bool_t fClStatShared[kMaxRow]; //! cached info on shared clusters of the seed
293 : //
294 : Int_t fAccountDistortions; //! flag to account for distortions. RS: to set!
295 : //
296 460 : ClassDef(AliTPCtracker,5)
297 : };
298 :
299 :
300 : AliTPCtrackerRow & AliTPCtracker::GetRow(Int_t sec, Int_t row)
301 : {
302 : //
303 620272 : return (row>=fInnerSec->GetNRows()) ? fOuterSec[sec][row-fInnerSec->GetNRows()]:fInnerSec[sec][row];
304 : }
305 :
306 : Bool_t AliTPCtracker::IsActive(Int_t sec, Int_t row)
307 : {
308 : //
309 : // check if the given sector row is active
310 : //
311 524768 : return (row>=fInnerSec->GetNRows()) ? fOuterSec[sec][row-fInnerSec->GetNRows()].GetN()>0:fInnerSec[sec][row].GetN()>0;
312 : }
313 :
314 :
315 : Double_t AliTPCtracker::GetXrow(Int_t row) const {
316 : // return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetX(row-fInnerSec->GetNRows()):fInnerSec->GetX(row);
317 373280 : return fXRow[row];
318 : }
319 :
320 : Double_t AliTPCtracker::GetMaxY(Int_t row) const {
321 : //return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetMaxY(row-fInnerSec->GetNRows()):fInnerSec->GetMaxY(row);
322 304308 : return fYMax[row];
323 : }
324 :
325 : Int_t AliTPCtracker::GetRowNumber(Double_t x) const
326 : {
327 : //
328 121984 : if (x<133.) return TMath::Max(fInnerSec->GetRowNumber(x),0);
329 26936 : return TMath::Min(fOuterSec->GetRowNumber(x)+fInnerSec->GetNRows(),158);
330 49640 : }
331 :
332 : Int_t AliTPCtracker::GetRowNumber(const AliTPCseed* t) const
333 : {
334 : // last row of the seed or row corresponding to x
335 0 : int row = t->GetRow();
336 : /*
337 : int rowX = GetRowNumber(t->GetX());
338 : if (TMath::Abs(row-rowX)>1 && row>-1) {
339 : printf("MISMATCH Seed %d\n",t->GetPoolID());
340 : printf("GetROW: %d %d %f %s\n",row,rowX,t->GetX(),row==rowX ? "":"!!!!!!!!!**********!!!!!!!!!!!************!!!!!!!!!!!");
341 : }
342 : */
343 0 : return (row>-1&&row<159) ? row : GetRowNumber(t->GetX());
344 : }
345 :
346 : Double_t AliTPCtracker::GetPadPitchLength(Double_t x) const
347 : {
348 : //
349 : return (x>133.) ? fOuterSec->GetPadPitchLength(x):fInnerSec->GetPadPitchLength(x);
350 : //return fPadLength[row];
351 : }
352 :
353 : Double_t AliTPCtracker::GetPadPitchLength(Int_t row) const
354 : {
355 : //
356 : return fPadLength[row];
357 : }
358 :
359 : void AliTPCtracker::SetTPCtrackerSectors(AliTPCtrackerSector *innerSec, AliTPCtrackerSector *outerSec)
360 : {
361 : //
362 0 : fInnerSec = innerSec;
363 0 : fOuterSec = outerSec;
364 0 : }
365 :
366 : #endif
367 :
368 :
|