]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCtracker.h
Load/UnloadClusters added to the base class and the derived classes changed correspon...
[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
18 class TFile;
19 class AliTPCParam;
20 class TObjArray;
21
22 class AliTPCtracker : public AliTracker {
23 public:
24    AliTPCtracker():AliTracker(),fkNIS(0),fkNOS(0) {
25       fInnerSec=fOuterSec=0; fSeeds=0; 
26       fParam = 0;
27    }
28    AliTPCtracker(const AliTPCParam *par);
29   ~AliTPCtracker();
30
31    Int_t ReadSeeds(const TFile *in);
32
33    Int_t LoadClusters();
34    void UnloadClusters();
35
36    AliCluster *GetCluster(Int_t index) const;
37    Int_t Clusters2Tracks(const TFile *in, TFile *out);
38    Int_t PropagateBack(const TFile *in, TFile *out);
39    Int_t PropagateBack(const TFile *in, const TFile *in2, TFile *out);
40    Int_t RefitInward(TFile *outTracks, TFile *inTracks);
41
42    virtual void  CookLabel(AliKalmanTrack *t,Float_t wrong) const; 
43
44 public:
45 //**************** Internal tracker class ********************** 
46    class AliTPCRow {
47    public:
48      AliTPCRow() {
49        fN=0; 
50        fSize=kMaxClusterPerRow/8;
51        fClusterArray=new AliTPCcluster[fSize];
52      }
53      ~AliTPCRow() {delete[] fClusterArray;}
54      void InsertCluster(const AliTPCcluster *c, Int_t sec, Int_t row);
55      void ResetClusters() {fN=0;}
56      operator int() const {return fN;}
57      const AliTPCcluster *operator[](Int_t i) const {return fClusters[i];}
58      const AliTPCcluster *GetUnsortedCluster(Int_t i) const {
59        return fClusterArray+i;
60      }
61      UInt_t GetIndex(Int_t i) const {return fIndex[i];}
62      Int_t Find(Double_t y) const; 
63      void SetX(Double_t x) {fX=x;}
64      Double_t GetX() const {return fX;}
65
66    private:
67      Int_t fN;                                          //number of clusters 
68      const AliTPCcluster *fClusters[kMaxClusterPerRow]; //pointers to clusters
69      Int_t fSize;                                 //size of array of clusters
70      AliTPCcluster *fClusterArray;                      //array of clusters
71      UInt_t fIndex[kMaxClusterPerRow];                  //indeces of clusters
72      Double_t fX;                                 //X-coordinate of this row
73
74    private:
75      AliTPCRow(const AliTPCRow& r);            //dummy copy constructor
76      AliTPCRow &operator=(const AliTPCRow& r); //dummy assignment operator
77    };
78
79 //**************** Internal tracker class ********************** 
80    class AliTPCSector {
81    public:
82      AliTPCSector() { fN=0; fRow = 0; }
83     ~AliTPCSector() { delete[] fRow; }
84      AliTPCRow& operator[](Int_t i) const { return *(fRow+i); }
85      Int_t GetNRows() const { return fN; }
86      void Setup(const AliTPCParam *par, Int_t flag);
87      Double_t GetX(Int_t l) const {return fRow[l].GetX();}
88      Double_t GetMaxY(Int_t l) const {
89          return GetX(l)*TMath::Tan(0.5*GetAlpha());
90      } 
91      Double_t GetAlpha() const {return fAlpha;}
92      Double_t GetAlphaShift() const {return fAlphaShift;}
93      Int_t GetRowNumber(Double_t x) const {
94         //return pad row number for this x
95        Double_t r;
96        if (fN < 64){
97          r=fRow[fN-1].GetX();
98          if (x > r) return fN;
99          r=fRow[0].GetX();
100          if (x < r) return -1;
101          return Int_t((x-r)/f1PadPitchLength + 0.5);}
102        else{    
103            r=fRow[fN-1].GetX();
104            if (x > r) return fN;
105            r=fRow[0].GetX();
106            if (x < r) return -1;
107           Double_t r1=fRow[64].GetX();
108           if(x<r1){       
109             return Int_t((x-r)/f1PadPitchLength + 0.5);}
110           else{
111             return (Int_t((x-r1)/f2PadPitchLength + 0.5)+64);} 
112        }
113      }
114      Double_t GetPadPitchWidth()  const {return fPadPitchWidth;}
115
116    private:
117      Int_t fN;                        //number of pad rows 
118      AliTPCRow *fRow;                    //array of pad rows
119      Double_t fAlpha;                    //opening angle
120      Double_t fAlphaShift;               //shift angle;
121      Double_t fPadPitchWidth;            //pad pitch width
122      Double_t f1PadPitchLength;          //pad pitch length
123      Double_t f2PadPitchLength;          //pad pitch length
124    private:
125      AliTPCSector(const AliTPCSector &s);           //dummy copy contructor
126      AliTPCSector& operator=(const AliTPCSector &s);//dummy assignment operator
127    };
128
129 //**************** Internal tracker class ********************** 
130    class AliTPCseed : public AliTPCtrack {
131    public:
132      AliTPCseed():AliTPCtrack(){}
133      AliTPCseed(const AliTPCtrack &t):AliTPCtrack(t){}
134      AliTPCseed(const AliKalmanTrack &t, Double_t a):AliTPCtrack(t,a){}
135      AliTPCseed(UInt_t index, const Double_t xx[5], 
136                 const Double_t cc[15], Double_t xr, Double_t alpha): 
137                 AliTPCtrack(index, xx, cc, xr, alpha) {}
138      void SetSampledEdx(Float_t q, Int_t i) {
139         Double_t s=GetSnp(), t=GetTgl();
140         q *= TMath::Sqrt((1-s*s)/(1+t*t));
141         fdEdxSample[i]=q;
142      }
143      void CookdEdx(Double_t low=0.05, Double_t up=0.70);
144
145    private:
146      Float_t fdEdxSample[200]; //array of dE/dx samples 
147    };
148
149 private:
150
151    void MakeSeeds(Int_t i1, Int_t i2);
152    Int_t FollowProlongation(AliTPCseed& t, Int_t rf=0);
153    Int_t FollowBackProlongation(AliTPCseed &s, const AliTPCtrack &t);
154    Int_t FollowRefitInward(AliTPCseed *seed, AliTPCtrack *track);
155
156    AliTPCtracker(const AliTPCtracker& r);           //dummy copy constructor
157    AliTPCtracker &operator=(const AliTPCtracker& r);//dummy assignment operator
158
159    const Int_t fkNIS;        //number of inner sectors
160    AliTPCSector *fInnerSec;  //array of inner sectors
161    const Int_t fkNOS;        //number of outer sectors
162    AliTPCSector *fOuterSec;  //array of outer sectors
163
164    Int_t fN;               //number of "active" sectors
165    AliTPCSector *fSectors; //pointer to "active" sectors;
166    
167    AliTPCParam *fParam;      //! TPC parameters for outer reference plane [SR, GSI, 18.02.2003]
168    TObjArray *fSeeds;        //array of track seeds
169 };
170
171 #endif
172
173