]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCtracker.h
Initialize decayer before generation. Important if run inside cocktail.
[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
14 #include "AliTPCtrack.h"
15 #include "AliTPCParam.h"
16
17 #define kMAXCLUSTER 2500
18
19 class TFile;
20
21 class AliTPCtracker {
22 public:
23    static Int_t Clusters2Tracks(const AliTPCParam *par, TFile *of);
24
25 //**************** Internal tracker class ********************** 
26    class AliTPCRow {
27    public:
28      AliTPCRow() {fN=0;}
29      void InsertCluster(const AliTPCcluster *c, UInt_t index);
30      operator int() const {return fN;}
31      const AliTPCcluster* operator[](Int_t i) const {return fClusters[i];}
32      UInt_t GetIndex(Int_t i) const {return fIndex[i];}
33      Int_t Find(Double_t y) const; 
34
35    private:
36      unsigned fN;                                 //number of clusters 
37      const AliTPCcluster *fClusters[kMAXCLUSTER]; //pointers to clusters
38      UInt_t fIndex[kMAXCLUSTER];                  //indeces of clusters
39
40    private:
41      AliTPCRow(const AliTPCRow& r);            //dummy copy constructor
42      AliTPCRow &operator=(const AliTPCRow& r); //dummy assignment operator
43    };
44
45 //**************** Internal tracker class ********************** 
46    class AliTPCSector {
47    public:
48      AliTPCSector() { fN=0; fRow = 0; }
49      virtual ~AliTPCSector() { delete[] fRow; }
50      static void SetParam(const AliTPCParam *p) { fgParam=p; }
51      AliTPCRow& operator[](Int_t i) const { return *(fRow+i); }
52      Int_t GetNRows() const { return fN; }
53      virtual Double_t GetX(Int_t l) const = 0;
54      virtual Double_t GetMaxY(Int_t l) const = 0;
55      virtual Double_t GetAlpha() const = 0;
56      virtual Double_t GetAlphaShift() const = 0;
57      virtual Int_t GetRowNumber(Double_t x) const = 0;
58      virtual Double_t GetPadPitchWidth() const = 0;
59
60    protected:
61      unsigned fN;                        //number of pad rows 
62      AliTPCRow *fRow;                    //array of pad rows
63      static const AliTPCParam *fgParam;  //TPC parameters
64
65    private:
66      AliTPCSector(const AliTPCSector &s);           //dummy copy contructor
67      AliTPCSector& operator=(const AliTPCSector &s);//dummy assignment operator
68    };
69
70 //**************** Internal tracker class ********************** 
71    class AliTPCSSector : public AliTPCSector {
72    public:
73       AliTPCSSector();
74       Double_t GetX(Int_t l) const { return fgParam->GetPadRowRadiiLow(l); }
75       Double_t GetMaxY(Int_t l) const { 
76          return GetX(l)*TMath::Tan(0.5*GetAlpha()); 
77       }
78       Double_t GetAlpha() const {return fgParam->GetInnerAngle();}
79       Double_t GetAlphaShift() const {return fgParam->GetInnerAngleShift();}
80       Double_t GetPadPitchWidth() const {
81          return fgParam->GetInnerPadPitchWidth();
82       }
83       Int_t GetRowNumber(Double_t x) const;
84    };
85
86 //**************** Internal tracker class ********************** 
87    class AliTPCLSector : public AliTPCSector {
88    public:
89       AliTPCLSector();
90       Double_t GetX(Int_t l) const { return fgParam->GetPadRowRadiiUp(l); }
91       Double_t GetMaxY(Int_t l) const { 
92          return GetX(l)*TMath::Tan(0.5*GetAlpha()); 
93       }
94       Double_t GetAlpha() const {return fgParam->GetOuterAngle();}
95       Double_t GetAlphaShift() const {return fgParam->GetOuterAngleShift();}
96       Double_t GetPadPitchWidth() const {
97          return fgParam->GetOuterPadPitchWidth();
98       }
99       Int_t GetRowNumber(Double_t x) const;
100    };
101
102 //**************** Internal tracker class ********************** 
103    class AliTPCseed : public AliTPCtrack {
104    public:
105      AliTPCseed():AliTPCtrack(){}
106      AliTPCseed(UInt_t index, const Double_t xx[5], 
107                 const Double_t cc[15], Double_t xr, Double_t alpha): 
108                 AliTPCtrack(index, xx, cc, xr, alpha) {}
109      void SetSampledEdx(Float_t q, Int_t i) {
110         Double_t s=GetSnp(), t=GetTgl();
111         q *= TMath::Sqrt((1-s*s)/(1+t*t));
112         fdEdxSample[i]=q;
113      }
114      void UseClusters(AliTPCClustersArray *ca, Int_t n=0);
115      void CookdEdx(Double_t low=0.05, Double_t up=0.70);
116
117    private:
118      Float_t fdEdxSample[200]; //array of dE/dx samples 
119    };
120
121 private:
122    static Int_t 
123    FindProlongation(AliTPCseed& t,const AliTPCSector *sec,Int_t s,Int_t rf=0);
124    static void
125    MakeSeeds(TObjArray &sd,const AliTPCSector *s,Int_t max,Int_t i1,Int_t i2);
126 };
127
128 inline AliTPCtracker::AliTPCSSector::AliTPCSSector() {
129   //default constructor
130   if (!fgParam) {
131      fprintf(stderr,"AliTPCSSector: parameters are not set !\n");
132      return;
133   }
134   fN=fgParam->GetNRowLow();
135   fRow=new AliTPCRow[fN];
136 }
137
138 inline 
139 Int_t AliTPCtracker::AliTPCSSector::GetRowNumber(Double_t x) const {
140   //return pad row number for this x
141   Double_t r=fgParam->GetPadRowRadiiLow(fgParam->GetNRowLow()-1);
142   if (x > r) return fgParam->GetNRowLow();
143   r=fgParam->GetPadRowRadiiLow(0);
144   if (x < r) return -1;
145   return Int_t((x-r)/fgParam->GetInnerPadPitchLength() + 0.5);
146 }
147
148 inline AliTPCtracker::AliTPCLSector::AliTPCLSector(){
149   //default constructor
150   if (!fgParam) {
151      fprintf(stderr,"AliTPCLSector: parameters are not set !\n");
152      return;
153   }
154   fN=fgParam->GetNRowUp();
155   fRow=new AliTPCRow[fN];
156 }
157
158 inline 
159 Int_t AliTPCtracker::AliTPCLSector::GetRowNumber(Double_t x) const {
160   //return pad row number for this x
161   Double_t r=fgParam->GetPadRowRadiiUp(fgParam->GetNRowUp()-1);
162   if (x > r) return fgParam->GetNRowUp();
163   r=fgParam->GetPadRowRadiiUp(0);
164   if (x < r) return -1;
165   return Int_t((x-r)/fgParam->GetOuterPadPitchLength() + 0.5);
166 }
167
168 //-----------------------------------------------------------------
169
170 #endif
171
172