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