]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPC.h
New RICH section
[u/mrichter/AliRoot.git] / TPC / AliTPC.h
CommitLineData
fe4da5cc 1#ifndef TPC_H
2#define TPC_H
3////////////////////////////////////////////////
4// Manager class for TPC //
5////////////////////////////////////////////////
6
7#include "AliDetector.h"
8#include "AliHit.h"
9#include "AliDigit.h"
10#include "AliTPCSecGeo.h"
8c555625 11#include "AliTPCParam.h"
fe4da5cc 12#include <TMatrix.h>
8c555625 13#include <TTree.h>
14#include <TClonesArray.h>
fe4da5cc 15
16#define MAXTPCTBK 500
17
18class AliTPCcluster;
19class AliTPCtrack;
8c555625 20class AliTPCParam;
21//MI changes
22class AliTPCD;
fe4da5cc 23
24class AliTPC : public AliDetector {
25protected:
26 Int_t fSens; // ISENS
27 Int_t fSecAL; // Upper sector selector
28 Int_t fSecAU; // Lower sector selector
29 Int_t fSecLows[6]; // List of lower sectors selected
30 Int_t fSecUps[12]; // List of upper sectors selected
31 Int_t fNsectors; // Number of sectors in TPC
32 Int_t fNclusters; // Number of clusters in TPC
33 Int_t fNtracks; // Number of tracks in TPC
34 Int_t *fClustersIndex; // Index for each sector in fClusters
35 Int_t *fDigitsIndex; // Index for each sector in fDigits
4b0fdcad 36
37 //MK changes
38
39 Float_t fSide; // selects left(-1), right(+1), or both(0) sides of the TPC
40
fe4da5cc 41 TClonesArray *fClusters; // List of clusters for all sectors
42 TClonesArray *fTracks; // List of reconstructed tracks
8c555625 43 //MI changes
44 AliTPCD * fDigParam; //detector parameters
fe4da5cc 45public:
46 AliTPC();
47 AliTPC(const char *name, const char *title);
48 virtual ~AliTPC();
49 virtual void AddCluster(Float_t*, Int_t*);
50 /*virtual*/void AddCluster(const AliTPCcluster&);
51 virtual void AddDigit(Int_t*, Int_t*);
52 virtual void AddHit(Int_t, Int_t*, Float_t*);
53 virtual void AddTrack(Float_t*);
54 /*virtual*/void AddTrack(const AliTPCtrack&);
55 Int_t DistancetoPrimitive(Int_t px, Int_t py);
56 virtual void BuildGeometry();
57 virtual void CreateGeometry() {}
58 virtual void CreateMaterials();
59 virtual void Hits2Clusters();
8c555625 60
61 virtual void Hits2Digits(); //MI change
62 virtual void Hits2DigitsSector(Int_t isec); //MI change
fe4da5cc 63 virtual void Init();
64 virtual Int_t IsVersion() const =0;
65 virtual void Digits2Clusters();
66 virtual void Clusters2Tracks();
67 TClonesArray *Clusters() {return fClusters;}
68 TClonesArray *Tracks() {return fTracks;}
69 Int_t *GetClustersIndex() {return fClustersIndex;}
70 Int_t *GetDigitsIndex() {return fDigitsIndex;}
71 Int_t GetNsectors() {return fNsectors;}
72 virtual void MakeBranch(Option_t *opt=" ");
73 virtual void ResetDigits();
74 virtual void SetSecAL(Int_t sec);
75 virtual void SetSecAU(Int_t sec);
76 virtual void SetSecLows(Int_t s1,Int_t s2,Int_t s3,Int_t s4,Int_t s5, Int_t s6);
77 virtual void SetSecUps (Int_t s1,Int_t s2,Int_t s3,Int_t s4,Int_t s5, Int_t s6,
78 Int_t s7,Int_t s8,Int_t s9,Int_t s10, Int_t s11, Int_t s12);
79 virtual void SetSens(Int_t sens);
4b0fdcad 80 //MK changes
81
82 virtual void SetSide(Float_t side);
fe4da5cc 83 virtual void StepManager()=0;
8c555625 84 virtual void DrawDetector() {}
85 AliTPCD* GetDigParam() {return fDigParam;} //MI change8
86 void SetDigParam(AliTPCD* param) {fDigParam=param;} //MI must think about it
fe4da5cc 87private:
88 //
8c555625 89 void ElDiff(Float_t *xyz);
90 void MakeTriplet(Int_t row,TObjArray **rowTriplet,
91 TObjArray **prow);
fe4da5cc 92
8c555625 93 void ExB(Float_t *xyz);
94 void DigitizeRow(Int_t irow,Int_t isec,TObjArray **rowTriplet);
95 Float_t GetSignal(TObjArray *p1, Int_t ntr, Int_t np, TMatrix *m1, TMatrix *m2,
96 Int_t *IndexRange);
97 void GetList (Float_t label,Int_t np,TMatrix *m,Int_t *IndexRange,
98 Float_t **pList);
99 void MakeSector(Int_t isec,Int_t nrows,TTree *TH,Stat_t ntracks,TObjArray **row);
100 void GetCrossTalk (Int_t iFlag,TObjArray *p,Int_t ntracks,Int_t *npads,
101 TMatrix *m);
fe4da5cc 102
fe4da5cc 103
104 ClassDef(AliTPC,2) // Time Projection Chamber class
105};
106
107//_____________________________________________________________________________
108
109class AliTPCcluster : public TObject {
110public:
111 Int_t fTracks[3];//labels of overlapped tracks
112 Int_t fSector; //sector number
113 Int_t fPadRow; //PadRow number
114 Float_t fY ; //Y of cluster
115 Float_t fZ ; //Z of cluster
116 Float_t fQ ; //Q of cluster (in ADC counts)
117 Float_t fSigmaY2; //Sigma Y square of cluster
118 Float_t fSigmaZ2; //Sigma Z square of cluster
119
120public:
121 AliTPCcluster() {
122 fTracks[0]=fTracks[1]=fTracks[2]=0;
123 fSector=fPadRow=0;
124 fY=fZ=fQ=fSigmaY2=fSigmaZ2=0.;
125 }
126 AliTPCcluster(Float_t *hits, Int_t*);
127 virtual ~AliTPCcluster() {;}
128 void Use() {fTracks[0]=-fTracks[0];}
129 int IsUsed() const {return (fTracks[0]<0) ? 1 : 0;}
8c555625 130 void GetXYZ(Float_t *x, const AliTPCParam *) const; //Get global x,y,z
131 Bool_t IsSortable() const;
132 Int_t Compare(TObject *o) ;
fe4da5cc 133 ClassDef(AliTPCcluster,1) // Time Projection Chamber clusters
134};
135
136
137//_____________________________________________________________________________
138
139class AliTPCdigit : public AliDigit {
140public:
141 Int_t fSector; //array of volumes
142 Int_t fPadRow; //Row number
143 Int_t fPad ; //Pad number
144 Int_t fTime; //Time bucket
145 Int_t fSignal; //Signal amplitude
146
147public:
148 AliTPCdigit() {}
149 AliTPCdigit(Int_t *tracks, Int_t *digits);
150 virtual ~AliTPCdigit() {}
151
152 ClassDef(AliTPCdigit,1) // Time Projection Chamber digits
153};
154
155
156//_____________________________________________________________________________
157
158class AliTPChit : public AliHit {
159public:
160 Int_t fSector; //sector number
161 Int_t fPadRow; //Pad Row number
162 Float_t fQ ; //charge
163
164public:
165 AliTPChit() {}
166 AliTPChit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits);
167 virtual ~AliTPChit() {}
168
169 ClassDef(AliTPChit,1) // Time Projection Chamber hits
170};
171
172
173//_____________________________________________________________________________
174
8c555625 175const unsigned MAX_CLUSTER_PER_ROW=1500;
fe4da5cc 176const Double_t FIELD=0.2;
177
178class AliTPCtrack : public TObject {
179 Double_t fAlpha; // rotation angle
180 Double_t ref; // track reference plane (X-coordinate)
181 TVector x; // vector of track parameters
182 TMatrix C; // covariance matrix of track parameters
183 TObjArray clusters; // pointers to clusters belonging to this track
184 Double_t chi2; // total chi2 value for this track
185public:
186 AliTPCtrack(Float_t *hits);
8c555625 187 AliTPCtrack(const AliTPCcluster& c, const TVector& xx, const TMatrix& CC,
188 const AliTPCParam *);
fe4da5cc 189 AliTPCtrack(const AliTPCtrack& t);
190 int PropagateTo(Double_t x,
191 Double_t x0=28.94,Double_t rho=0.9e-3,Double_t pm=0.139);
192 void PropagateToVertex(
193 Double_t x0=36.66,Double_t rho=1.2e-3,Double_t pm=0.139);
194 void Update(const AliTPCcluster* c, Double_t chi2);
195 int Rotate(Double_t angle);
196
197 void UseClusters() const ;
198 Double_t GetPredictedChi2(const AliTPCcluster*) const ;
199 Double_t GetX() const {return ref;}
200 Double_t GetY() const {return x(0);}
201 Double_t GetC() const {return x(2);}
202 Double_t GetY(Double_t x) const;
203 Double_t GetZ() const {return x(1);}
204 Double_t GetTgl() const {return x(4);}
205 Double_t GetPt() const {return 0.3*FIELD/x(2)/100;}
206 int GetLab() const ;
207 Double_t GetSigmaY2() const {return C(0,0);}
208 Double_t GetSigmaZ2() const {return C(1,1);}
209 Double_t GetSigmaC2() const {return C(2,2);}
210 Double_t GetSigmaTgl2() const {return C(4,4);}
211 Double_t GetAlpha() const {return fAlpha;}
212 Double_t GetChi2() const {return chi2;}
213 operator int() const {return clusters.GetEntriesFast();}
214 AliTPCcluster& operator[](int i) {
215 return *((AliTPCcluster*)clusters.UncheckedAt(i));
216 }
217 void GetPxPyPz(Double_t&, Double_t&, Double_t&) const ;
218 void GetXYZ(Double_t& X,Double_t& Y,Double_t& Z) const {X=ref;Y=x(0);Z=x(1);}
219
220 ClassDef(AliTPCtrack,1) // Time Projection Chamber reconstructed tracks
221};
222
223//_____Classes for internal tracking use ______________________________________
224
225class TrackSeed : public AliTPCtrack {
226public:
8c555625 227 TrackSeed(const AliTPCcluster& c, const TVector& x, const TMatrix& C,
228 const AliTPCParam *p) : AliTPCtrack(c,x,C,p) {}
fe4da5cc 229 Bool_t IsSortable() const {return kTRUE;}
230 Int_t Compare(TObject *o) {
231 AliTPCtrack *t=(AliTPCtrack*)o;
232 Double_t c =GetSigmaY2();
233 Double_t co=t->GetSigmaY2();
234 if (c>co) return 1;
235 else if (c<co) return -1;
236 return 0;
237 }
238};
239
240class AliTPCRow {
241 unsigned num_of_clusters;
242 const AliTPCcluster *clusters[MAX_CLUSTER_PER_ROW];
243public:
244 AliTPCRow() {num_of_clusters=0;}
245 void InsertCluster(const AliTPCcluster*);
246
247 operator int() const {return num_of_clusters;}
248 const AliTPCcluster* operator[](int i) const {return clusters[i];}
249 int Find(Double_t y) const;
250};
251
8c555625 252
fe4da5cc 253class AliTPCSector {
8c555625 254protected:
fe4da5cc 255 unsigned num_of_rows;
256 AliTPCRow *row;
8c555625 257 const AliTPCParam *param;
fe4da5cc 258public:
8c555625 259 AliTPCSector() {
260 row = 0; num_of_rows=0;
261 param=0;
fe4da5cc 262 }
8c555625 263 virtual void SetUp(AliTPCParam *p) {param=p;}
fe4da5cc 264 virtual ~AliTPCSector() { delete[] row; }
265 AliTPCRow& operator[](int i) const { return *(row+i); }
266 virtual Double_t GetX(int l) const = 0;
267 virtual Double_t GetMaxY(int l) const = 0;
268 virtual Double_t GetAlpha() const = 0;
269};
270
271class AliTPCSSector : public AliTPCSector {
272public:
8c555625 273 AliTPCSSector(){}
fe4da5cc 274 virtual ~AliTPCSSector() {}
8c555625 275 virtual void SetUp(AliTPCParam *p) {
276 param=p;
277 num_of_rows=p->GetNRowLow();
278 row=new AliTPCRow[num_of_rows];
279 }
280 Double_t GetX(int l) const { return param->GetPadRowRadiiLow(l); }
fe4da5cc 281 Double_t GetAlpha() const {return alpha_low;}
8c555625 282 Double_t GetMaxY(int l) const { return GetX(l)*tan(0.5*GetAlpha()); }
fe4da5cc 283};
284
285class AliTPCLSector : public AliTPCSector {
286public:
8c555625 287 AliTPCLSector(){}
fe4da5cc 288 virtual ~AliTPCLSector() {}
8c555625 289 virtual void SetUp(AliTPCParam *p) {
290 param=p;
291 num_of_rows=p->GetNRowUp();
292 row=new AliTPCRow[num_of_rows];
293 }
294 Double_t GetX(int l) const { return param->GetPadRowRadiiUp(l); }
fe4da5cc 295 Double_t GetAlpha() const {return alpha_up;}
8c555625 296 Double_t GetMaxY(int l) const { return GetX(l)*tan(0.5*GetAlpha()); }
fe4da5cc 297};
298
8c555625 299
300
301
fe4da5cc 302#endif
303