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