]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCtrackerMI.h
Changes for HLT - speedup interface for HLT tracker
[u/mrichter/AliRoot.git] / TPC / AliTPCtrackerMI.h
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
6
7 /* $Id$ */
8
9 //-------------------------------------------------------
10 //                       TPC tracker
11 //   Parallel tracker 
12 //
13 //   Origin: 
14 //-------------------------------------------------------
15
16 #include <TError.h>
17 #include "AliTracker.h"
18 #include "AliTPCreco.h"
19 #include "AliPID.h"
20 #include "AliTPCclusterMI.h"
21 #include "AliTPCtrackerSector.h"
22
23
24 class TFile;
25 class AliTPCParam;
26 class AliTPCseed;
27 class AliTPCTrackerPoint;
28 class AliESDEvent;   
29 class TTree;
30 class AliESDkink;
31 class TTreeSRedirector;
32 class AliTrackPoint;
33
34
35
36 class AliTPCtrackerMI : public AliTracker {
37 public:
38   AliTPCtrackerMI();
39   AliTPCtrackerMI(const AliTPCParam *par); 
40   virtual ~AliTPCtrackerMI();
41   //
42   void SetIteration(Int_t iteration){fIteration = iteration;}
43   virtual Int_t Clusters2Tracks (AliESDEvent *esd);
44   virtual Int_t RefitInward (AliESDEvent *esd);
45   virtual Int_t LoadClusters (TTree * tree);
46   virtual Int_t LoadClusters (TObjArray * arr); // another input
47   virtual Int_t LoadClusters (TClonesArray * arr); // another input
48   Int_t  LoadClusters();
49   void   UnloadClusters();
50   Int_t LoadInnerSectors();
51   Int_t LoadOuterSectors();
52   virtual void FillClusterArray(TObjArray* array) const;
53   void   Transform(AliTPCclusterMI * cluster);
54   //
55   void FillESD(TObjArray* arr);
56   void DeleteSeeds();
57   void SetDebug(Int_t debug){ fDebug = debug;}
58   void FindKinks(TObjArray * array, AliESDEvent * esd);
59   //
60   void FindCurling(TObjArray * array, AliESDEvent * esd, Int_t iter);     
61   void FindSplitted(TObjArray * array, AliESDEvent * esd, Int_t iter);       
62   void FindMultiMC(TObjArray * array, AliESDEvent * esd, Int_t iter);     
63   //
64   void FindV0s(TObjArray * array, AliESDEvent * esd);
65   void UpdateKinkQualityM(AliTPCseed * seed);
66   void UpdateKinkQualityD(AliTPCseed * seed);
67   Int_t CheckKinkPoint(AliTPCseed*seed, AliTPCseed &mother, AliTPCseed &daughter, AliESDkink &kink);
68   Int_t RefitKink(AliTPCseed &mother, AliTPCseed &daughter, AliESDkink &kink);
69    Int_t ReadSeeds(const TFile *in);
70    TObjArray * GetSeeds(){return fSeeds;}
71    //   
72    AliCluster * GetCluster(Int_t index) const {return (AliCluster*)GetClusterMI(index);}
73    AliTPCclusterMI *GetClusterMI(Int_t index) const;
74    Int_t Clusters2Tracks();
75    virtual void  CookLabel(AliKalmanTrack *tk,Float_t wrong) const; 
76    virtual Int_t   CookLabel(AliTPCseed *t,Float_t wrong, Int_t first,Int_t last ) const; 
77    
78    void RotateToLocal(AliTPCseed *seed);
79    
80    Int_t FollowProlongation(AliTPCseed& t, Int_t rf=0, Int_t step=1);
81    Int_t FollowProlongationFast(AliTPCseed& t, Int_t rf=0, Int_t step=1);
82    Bool_t GetTrackPoint(Int_t index, AliTrackPoint &p ) const; 
83
84    Int_t FollowBackProlongation(AliTPCseed& t, Int_t rf);
85    Int_t FollowToNext(AliTPCseed& t, Int_t nr);
86    Int_t FollowToNextFast(AliTPCseed& t, Int_t nr);
87    Int_t UpdateClusters(AliTPCseed& t,  Int_t nr);
88    Int_t FollowToNextCluster( AliTPCseed& t, Int_t nr);
89
90    Int_t PropagateBack(TObjArray * arr);
91    Int_t PropagateBack(AliESDEvent * event);
92    Int_t PropagateBack(AliTPCseed *pt, Int_t row0, Int_t row1);   
93    Int_t PropagateForward();
94    Int_t PropagateForward2(TObjArray * arr);
95
96    void SortTracks(TObjArray * arr, Int_t mode) const;
97   
98    virtual Double_t ErrY2(AliTPCseed* seed, AliTPCclusterMI * cl = 0);
99    virtual Double_t ErrZ2(AliTPCseed* seed, AliTPCclusterMI * cl = 0);   
100
101    Double_t F1(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3); 
102    Double_t F1old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3); 
103    Double_t F2(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3); 
104    Double_t F2old(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t x3,Double_t y3); 
105
106    Double_t F3(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2); 
107    Double_t F3n(Double_t x1,Double_t y1, Double_t x2,Double_t y2, Double_t z1,Double_t z2, 
108                 Double_t c); 
109    Bool_t GetProlongation(Double_t x1, Double_t x2, Double_t x[5], Double_t &y, Double_t &z);
110
111  public:
112
113
114    Float_t OverlapFactor(AliTPCseed * s1, AliTPCseed * s2, Int_t &sum1, Int_t &sum2);
115    void  SignShared(AliTPCseed * s1, AliTPCseed * s2);
116    void  SignShared(TObjArray * arr);
117
118    void  RemoveUsed2(TObjArray * arr, Float_t factor1, Float_t factor2, Int_t minimal);
119
120    void  StopNotActive(TObjArray * arr, Int_t row0, Float_t th0, Float_t th1, Float_t th2) const;
121    void  StopNotActive(AliTPCseed * seed, Int_t row0, Float_t th0, Float_t th1, Float_t th2) const;
122    Int_t AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluster);
123
124 private:
125   AliTPCtrackerMI(const AliTPCtrackerMI& r);           //dummy copy constructor
126   AliTPCtrackerMI &operator=(const AliTPCtrackerMI& r);//dummy assignment operator
127   void AddCovariance(AliTPCseed * seed);               // add covariance
128
129    inline AliTPCtrackerRow &GetRow(Int_t sec, Int_t row);
130    inline Bool_t     IsActive(Int_t sec, Int_t row);
131    inline Double_t  GetXrow(Int_t row) const;
132    inline Double_t  GetMaxY(Int_t row) const;
133    inline Int_t GetRowNumber(Double_t x) const;
134    Int_t GetRowNumber(Double_t x[3]) const;
135    inline Double_t GetPadPitchLength(Double_t x) const;
136    inline Double_t GetPadPitchLength(Int_t row) const;
137
138     void GetShape(AliTPCseed * seed, Int_t row);
139  
140    void ReadSeeds(AliESDEvent *event, Int_t direction);  //read seeds from the event
141
142    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); 
143    void MakeSeeds5(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2, Float_t cuts[4], Float_t deltay = -1);
144
145    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);
146   
147
148    AliTPCseed *MakeSeed(AliTPCseed *t, Float_t r0, Float_t r1, Float_t r2); //reseed
149    AliTPCseed *ReSeed(AliTPCseed *t, Float_t r0, Float_t r1, Float_t r2); //reseed
150    AliTPCseed *ReSeed(AliTPCseed *t, Int_t r0, Bool_t forward); //reseed
151
152
153   
154    AliTPCseed * ReSeed(AliTPCseed *t);
155    //Int_t LoadInnerSectors();
156    //Int_t LoadOuterSectors();
157    void UnsignClusters();
158    void SignClusters(TObjArray * arr, Float_t fnumber=3., Float_t fdensity=2.);  
159
160    void ParallelTracking(TObjArray * arr, Int_t rfirst, Int_t rlast);
161    void Tracking(TObjArray * arr);
162    TObjArray * Tracking(Int_t seedtype, Int_t i1, Int_t i2, Float_t cuts[4], Float_t dy=-1, Int_t dsec=0);
163    TObjArray * Tracking();
164    TObjArray * TrackingSpecial();
165    void SumTracks(TObjArray *arr1,TObjArray *&arr2) const;
166    void PrepareForBackProlongation(TObjArray * arr, Float_t fac) const;
167    void PrepareForProlongation(TObjArray * arr, Float_t fac) const;
168
169    void SetSampledEdx(AliTPCseed */*t*/, Float_t /*q*/, Int_t /*i*/) {;}
170    Int_t UpdateTrack(AliTPCseed *t, Int_t accept); //update trackinfo
171
172    void MakeBitmaps(AliTPCseed *t);
173
174    const Int_t fkNIS;        //number of inner sectors
175    AliTPCtrackerSector *fInnerSec;  //array of inner sectors;
176    const Int_t fkNOS;        //number of outer sectors
177    AliTPCtrackerSector *fOuterSec;  //array of outer sectors;
178
179    Int_t fN;               //number of loaded sectors
180    AliTPCtrackerSector *fSectors; //pointer to loaded sectors;
181    //
182    TTree * fInput;       // input tree with clusters
183    TTree * fOutput;      // output tree with tracks
184    TTree * fSeedTree;    // output tree with seeds - filled in debug mode 1
185    TTree * fTreeDebug;   // output with a debug information about track
186    AliESDEvent * fEvent;      // output with esd tracks
187    Int_t    fDebug;      // debug option        
188    Bool_t   fNewIO;      // indicated if we have data using New IO 
189    Int_t fNtracks;                     //current number of tracks
190    TObjArray *fSeeds;                  //array of track seeds
191    Int_t fIteration;                   // indicate iteration - 0 - froward -1 back - 2forward - back->forward
192    //   TObjArray * fTrackPointPool;        // ! pool with track points
193    //   TObjArray * fSeedPool;              //! pool with seeds
194    Double_t fXRow[200];                // radius of the pad row
195    Double_t fYMax[200];                // max y for given pad row
196    Double_t fPadLength[200];                // max y for given pad row
197    const AliTPCParam *fParam;          //pointer to the parameters
198    TTreeSRedirector *fDebugStreamer;     //!debug streamer
199    ClassDef(AliTPCtrackerMI,2) 
200 };
201
202
203 AliTPCtrackerRow & AliTPCtrackerMI::GetRow(Int_t sec, Int_t row)
204 {
205   //
206   return (row>=fInnerSec->GetNRows()) ? fOuterSec[sec][row-fInnerSec->GetNRows()]:fInnerSec[sec][row];
207 }
208
209 Bool_t   AliTPCtrackerMI::IsActive(Int_t sec, Int_t row)
210 {
211   //
212   // check if the given sector row is active 
213   //
214   return (row>=fInnerSec->GetNRows()) ? fOuterSec[sec][row-fInnerSec->GetNRows()].GetN()>0:fInnerSec[sec][row].GetN()>0;
215 }
216
217
218 Double_t  AliTPCtrackerMI::GetXrow(Int_t row) const {
219   //  return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetX(row-fInnerSec->GetNRows()):fInnerSec->GetX(row);
220   return fXRow[row];
221 }
222
223 Double_t  AliTPCtrackerMI::GetMaxY(Int_t row) const {
224   //return (row>=fInnerSec->GetNRows()) ? fOuterSec->GetMaxY(row-fInnerSec->GetNRows()):fInnerSec->GetMaxY(row);
225   return fYMax[row];
226 }
227
228 Int_t AliTPCtrackerMI::GetRowNumber(Double_t x) const
229 {
230   //
231   return (x>133.) ? fOuterSec->GetRowNumber(x)+fInnerSec->GetNRows():fInnerSec->GetRowNumber(x);
232 }
233
234 Double_t  AliTPCtrackerMI::GetPadPitchLength(Double_t x) const
235 {
236   //
237   return (x>133.) ? fOuterSec->GetPadPitchLength(x):fInnerSec->GetPadPitchLength(x);
238   //return fPadLength[row];
239 }
240
241 Double_t  AliTPCtrackerMI::GetPadPitchLength(Int_t row) const
242 {
243   //
244   return fPadLength[row];
245 }
246
247
248
249 #endif
250
251