]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCtracker.h
Compatibility with HP
[u/mrichter/AliRoot.git] / TPC / AliTPCtracker.h
1 #ifndef ALITPCTRACKER_H
2 #define ALITPCTRACKER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 //-------------------------------------------------------
9 //                       TPC tracker
10 //
11 //   Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch 
12 //-------------------------------------------------------
13 #include "AliTracker.h"
14 #include "AliTPCtrack.h"
15 #include "AliTPCreco.h"
16 #include "AliTPCcluster.h"
17 #include "AliBarrelTrack.h"
18
19 class TFile;
20 class TTree;
21 class TBranch;
22 class AliTPCParam;
23 class TObjArray;
24 class TClonesArray;
25 class AliESD;
26
27 class AliTPCtracker : public AliTracker {
28 public:
29    AliTPCtracker():AliTracker(),fkNIS(0),fkNOS(0) {
30       fInnerSec=fOuterSec=0; fSeeds=0; 
31       fParam = 0;
32    }
33    AliTPCtracker(const AliTPCParam *par);
34   ~AliTPCtracker();
35
36    Int_t ReadSeeds(const TFile *in);
37
38    Int_t LoadClusters(TTree *c);
39    void UnloadClusters();
40
41    AliCluster *GetCluster(Int_t index) const;
42    Int_t Clusters2Tracks(TTree *in, TTree *out);
43    Int_t Clusters2Tracks(AliESD *event);
44    Int_t PropagateBack(TTree *in, TTree *out);
45    Int_t PropagateBack(AliESD *event);
46    Int_t RefitInward(TTree *inTracks, TTree *outTracks);
47    Int_t RefitInward(AliESD *event);
48
49    virtual void  CookLabel(AliKalmanTrack *t,Float_t wrong) const; 
50
51 public:
52 //**************** Internal tracker class ********************** 
53    class AliTPCRow {
54    public:
55      AliTPCRow() {
56        fN=0; 
57        fSize=kMaxClusterPerRow/8;
58        fClusterArray=new AliTPCcluster[fSize];
59      }
60      ~AliTPCRow() {delete[] fClusterArray;}
61      void InsertCluster(const AliTPCcluster *c, Int_t sec, Int_t row);
62      void ResetClusters() {fN=0; delete[] fClusterArray; fClusterArray=0;}
63      operator int() const {return fN;}
64      const AliTPCcluster *operator[](Int_t i) const {return fClusters[i];}
65      const AliTPCcluster *GetUnsortedCluster(Int_t i) const {
66        if ((i < 0) || (i >= fN)) return NULL;
67        return fClusterArray+i;
68      }
69      UInt_t GetIndex(Int_t i) const {return fIndex[i];}
70      Int_t Find(Double_t y) const; 
71      void SetX(Double_t x) {fX=x;}
72      Double_t GetX() const {return fX;}
73
74    private:
75      Int_t fN;                                          //number of clusters 
76      const AliTPCcluster *fClusters[kMaxClusterPerRow]; //pointers to clusters
77      Int_t fSize;                                 //size of array of clusters
78      AliTPCcluster *fClusterArray;                      //array of clusters
79      UInt_t fIndex[kMaxClusterPerRow];                  //indeces of clusters
80      Double_t fX;                                 //X-coordinate of this row
81
82    private:
83      AliTPCRow(const AliTPCRow& r);            //dummy copy constructor
84      AliTPCRow &operator=(const AliTPCRow& r); //dummy assignment operator
85    };
86
87 //**************** Internal tracker class ********************** 
88    class AliTPCSector {
89    public:
90      AliTPCSector() { fN=0; fRow = 0; }
91     ~AliTPCSector() { delete[] fRow; }
92      AliTPCRow& operator[](Int_t i) const { return *(fRow+i); }
93      Int_t GetNRows() const { return fN; }
94      void Setup(const AliTPCParam *par, Int_t flag);
95      Double_t GetX(Int_t l) const {return fRow[l].GetX();}
96      Double_t GetMaxY(Int_t l) const {
97          return GetX(l)*TMath::Tan(0.5*GetAlpha());
98      } 
99      Double_t GetAlpha() const {return fAlpha;}
100      Double_t GetAlphaShift() const {return fAlphaShift;}
101      Int_t GetRowNumber(Double_t x) const {
102         //return pad row number for this x
103        Double_t r;
104        if (fN < 64){
105          r=fRow[fN-1].GetX();
106          if (x > r) return fN;
107          r=fRow[0].GetX();
108          if (x < r) return -1;
109          return Int_t((x-r)/f1PadPitchLength + 0.5);}
110        else{    
111            r=fRow[fN-1].GetX();
112            if (x > r) return fN;
113            r=fRow[0].GetX();
114            if (x < r) return -1;
115           Double_t r1=fRow[64].GetX();
116           if(x<r1){       
117             return Int_t((x-r)/f1PadPitchLength + 0.5);}
118           else{
119             return (Int_t((x-r1)/f2PadPitchLength + 0.5)+64);} 
120        }
121      }
122      Double_t GetPadPitchWidth()  const {return fPadPitchWidth;}
123
124    private:
125      Int_t fN;                        //number of pad rows 
126      AliTPCRow *fRow;                    //array of pad rows
127      Double_t fAlpha;                    //opening angle
128      Double_t fAlphaShift;               //shift angle;
129      Double_t fPadPitchWidth;            //pad pitch width
130      Double_t f1PadPitchLength;          //pad pitch length
131      Double_t f2PadPitchLength;          //pad pitch length
132    private:
133      AliTPCSector(const AliTPCSector &s);           //dummy copy contructor
134      AliTPCSector& operator=(const AliTPCSector &s);//dummy assignment operator
135    };
136
137 //**************** Internal tracker class ********************** 
138    class AliTPCseed : public AliTPCtrack {
139    public:
140      AliTPCseed():AliTPCtrack(){}
141      AliTPCseed(const AliTPCtrack &t):AliTPCtrack(t){}
142      AliTPCseed(const AliKalmanTrack &t, Double_t a):AliTPCtrack(t,a){}
143      AliTPCseed(UInt_t index, const Double_t xx[5], 
144                 const Double_t cc[15], Double_t xr, Double_t alpha): 
145                 AliTPCtrack(index, xx, cc, xr, alpha) {}
146      void SetSampledEdx(Float_t q, Int_t i) {
147         Double_t s=GetSnp(), t=GetTgl();
148         q *= TMath::Sqrt((1-s*s)/(1+t*t));
149         fdEdxSample[i]=q;
150      }
151      void CookdEdx(Double_t low=0.05, Double_t up=0.70);
152
153    private:
154      Float_t fdEdxSample[200]; //array of dE/dx samples 
155    };
156
157 private:
158
159    void MakeSeeds(Int_t i1, Int_t i2);
160    Int_t FollowProlongation(AliTPCseed& t, Int_t rf=0);
161    Int_t FollowBackProlongation(AliTPCseed &s, const AliTPCtrack &t);
162    Int_t FollowRefitInward(AliTPCseed *seed, AliTPCtrack *track);
163
164    AliTPCtracker(const AliTPCtracker& r);           //dummy copy constructor
165    AliTPCtracker &operator=(const AliTPCtracker& r);//dummy assignment operator
166
167    const Int_t fkNIS;        //number of inner sectors
168    AliTPCSector *fInnerSec;  //array of inner sectors
169    const Int_t fkNOS;        //number of outer sectors
170    AliTPCSector *fOuterSec;  //array of outer sectors
171
172    Int_t fN;               //number of "active" sectors
173    AliTPCSector *fSectors; //pointer to "active" sectors;
174    
175    AliTPCParam *fParam;      //! TPC parameters for outer reference plane [SR, GSI, 18.02.2003]
176    TObjArray *fSeeds;        //array of track seeds
177
178    // [SR, 01.04.2003]
179    void SetBarrelTree(const char *mode);
180    void StoreBarrelTrack(AliTPCtrack *ps, Int_t refPlane, Int_t isIn);
181
182    // [SR, 01.04.2003]
183    TFile *fBarrelFile;             // file with "barrel" tracks
184    TTree *fBarrelTree;             // tree with "barrel" tracks
185    TBranch *fBarrelBranch;
186    TClonesArray *fBarrelArray;
187    AliBarrelTrack *fBarrelTrack;
188
189   ClassDef(AliTPCtracker,1)   // Time Projection Chamber tracker
190 };
191
192 #endif
193
194