3 ////////////////////////////////////////////////
4 // Manager class for TPC //
5 ////////////////////////////////////////////////
7 #include "AliDetector.h"
10 #include "AliTPCSecGeo.h"
11 #include "AliTPCParam.h"
14 #include <TClonesArray.h>
22 class AliTPC : public AliDetector {
25 Int_t fSecAL; // Upper sector selector
26 Int_t fSecAU; // Lower sector selector
27 Int_t fSecLows[6]; // List of lower sectors selected
28 Int_t fSecUps[12]; // List of upper sectors selected
29 Int_t fNsectors; // Number of sectors in TPC
30 Int_t fNclusters; // Number of clusters in TPC
31 Int_t fNtracks; // Number of tracks in TPC
32 Int_t *fClustersIndex; // Index for each sector in fClusters
33 Int_t *fDigitsIndex; // Index for each sector in fDigits
37 Float_t fSide; // selects left(-1), right(+1), or both(0) sides of the TPC
38 Int_t fNoComp; // number of a drift gas components
39 Int_t fMixtComp[3]; // drift gas components
40 Float_t fMixtProp[3]; // mixture proportions
44 TClonesArray *fClusters; // List of clusters for all sectors
45 TClonesArray *fTracks; // List of reconstructed tracks
47 AliTPCD * fDigParam; //detector parameters
50 AliTPC(const char *name, const char *title);
52 virtual void AddCluster(Float_t*, Int_t*);
53 /*virtual*/void AddCluster(const AliTPCcluster&);
54 virtual void AddDigit(Int_t*, Int_t*);
55 virtual void AddHit(Int_t, Int_t*, Float_t*);
56 virtual void AddTrack(Float_t*);
57 /*virtual*/void AddTrack(const AliTPCtrack&);
58 Int_t DistancetoPrimitive(Int_t px, Int_t py);
59 virtual void BuildGeometry();
60 virtual void CreateGeometry() {}
61 virtual void CreateMaterials();
62 virtual void Hits2Clusters();
64 virtual void Hits2Digits(); //MI change
65 virtual void Hits2DigitsSector(Int_t isec); //MI change
67 virtual Int_t IsVersion() const =0;
68 virtual void Digits2Clusters();
69 virtual void Clusters2Tracks();
70 TClonesArray *Clusters() {return fClusters;}
71 TClonesArray *Tracks() {return fTracks;}
72 Int_t *GetClustersIndex() {return fClustersIndex;}
73 Int_t *GetDigitsIndex() {return fDigitsIndex;}
74 Int_t GetNsectors() {return fNsectors;}
75 virtual void MakeBranch(Option_t *opt=" ");
76 virtual void ResetDigits();
77 virtual void SetSecAL(Int_t sec);
78 virtual void SetSecAU(Int_t sec);
79 virtual void SetSecLows(Int_t s1,Int_t s2,Int_t s3,Int_t s4,Int_t s5, Int_t s6);
80 virtual void SetSecUps (Int_t s1,Int_t s2,Int_t s3,Int_t s4,Int_t s5, Int_t s6,
81 Int_t s7,Int_t s8,Int_t s9,Int_t s10, Int_t s11, Int_t s12);
82 virtual void SetSens(Int_t sens);
85 virtual void SetSide(Float_t side);
86 virtual void SetGasMixt(Int_t nc,Int_t c1,Int_t c2,Int_t c3,Float_t p1,
87 Float_t p2,Float_t p3);
89 virtual void StepManager()=0;
90 virtual void DrawDetector() {}
91 AliTPCD* GetDigParam() {return fDigParam;} //MI change8
92 void SetDigParam(AliTPCD* param) {fDigParam=param;} //MI must think about it
95 void ElDiff(Float_t *xyz);
96 void MakeTriplet(Int_t row,TObjArray **rowTriplet,
99 void ExB(Float_t *xyz);
100 void DigitizeRow(Int_t irow,Int_t isec,TObjArray **rowTriplet);
101 Float_t GetSignal(TObjArray *p1, Int_t ntr, Int_t np, TMatrix *m1, TMatrix *m2,
103 void GetList (Float_t label,Int_t np,TMatrix *m,Int_t *IndexRange,
105 void MakeSector(Int_t isec,Int_t nrows,TTree *TH,Stat_t ntracks,TObjArray **row);
106 void GetCrossTalk (Int_t iFlag,TObjArray *p,Int_t ntracks,Int_t *npads,
110 ClassDef(AliTPC,2) // Time Projection Chamber class
113 //_____________________________________________________________________________
115 class AliTPCcluster : public TObject {
117 Int_t fTracks[3];//labels of overlapped tracks
118 Int_t fSector; //sector number
119 Int_t fPadRow; //PadRow number
120 Float_t fY; //Y of cluster
121 Float_t fZ; //Z of cluster
122 Float_t fQ; //Q of cluster (in ADC counts)
123 Float_t fdEdX; //dE/dX inside this cluster
124 Float_t fSigmaY2; //Sigma Y square of cluster
125 Float_t fSigmaZ2; //Sigma Z square of cluster
129 fTracks[0]=fTracks[1]=fTracks[2]=0;
131 fY=fZ=fQ=fdEdX=fSigmaY2=fSigmaZ2=0.;
133 AliTPCcluster(Float_t *hits, Int_t*);
134 virtual ~AliTPCcluster() {;}
135 void Use() {fQ=-fQ;} //if fQ<0 cluster is already associated with a track
136 int IsUsed() const {return (fQ<0) ? 1 : 0;}
137 void GetXYZ(Float_t *x, const AliTPCParam *) const; //Get global x,y,z
138 Bool_t IsSortable() const;
139 Int_t Compare(TObject *o) ;
140 ClassDef(AliTPCcluster,1) // Time Projection Chamber clusters
144 //_____________________________________________________________________________
146 class AliTPCdigit : public AliDigit {
148 Int_t fSector; //array of volumes
149 Int_t fPadRow; //Row number
150 Int_t fPad ; //Pad number
151 Int_t fTime; //Time bucket
152 Int_t fSignal; //Signal amplitude
156 AliTPCdigit(Int_t *tracks, Int_t *digits);
157 virtual ~AliTPCdigit() {}
159 ClassDef(AliTPCdigit,1) // Time Projection Chamber digits
163 //_____________________________________________________________________________
165 class AliTPChit : public AliHit {
167 Int_t fSector; //sector number
168 Int_t fPadRow; //Pad Row number
169 Float_t fQ ; //charge
173 AliTPChit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits);
174 virtual ~AliTPChit() {}
176 ClassDef(AliTPChit,1) // Time Projection Chamber hits
180 //_____________________________________________________________________________
181 class AliTPCtrack : public TObject {
182 //-----------------------------------------------------------------
183 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
184 //-----------------------------------------------------------------
185 Double_t fAlpha; // rotation angle
186 Double_t fX; // X-coordinate of this track (reference plane)
187 TVector x; // vector of track parameters
188 TMatrix C; // covariance matrix of track parameters
189 TObjArray fClusters; // clusters belonging to this track
190 Double_t fChi2; // total chi2 value for this track
192 AliTPCtrack(Float_t *hits);
193 AliTPCtrack(const AliTPCcluster *c, const TVector& xx, const TMatrix& CC,
194 Double_t xr, Double_t alpha);
195 AliTPCtrack(const AliTPCtrack& t);
196 Int_t Compare(TObject *o);
197 int PropagateTo(Double_t xr,
198 Double_t x0=28.94,Double_t rho=0.9e-3,Double_t pm=0.139);
199 void PropagateToVertex(
200 Double_t x0=36.66,Double_t rho=1.2e-3,Double_t pm=0.139);
201 void Update(const AliTPCcluster* c, Double_t chi2);
202 int Rotate(Double_t angle);
204 Bool_t IsSortable() const {return kTRUE;}
205 void UseClusters() const ;
206 Double_t GetPredictedChi2(const AliTPCcluster*) const ;
207 int GetLabel(int nrows) const ;
208 void GetPxPyPz(Double_t&, Double_t&, Double_t&) const ;
209 Double_t GetdEdX(Double_t low, Double_t up) const ;
211 Double_t GetX() const {return fX;}
212 Double_t GetY() const {return x(0);}
213 Double_t GetZ() const {return x(1);}
214 Double_t GetC() const {return x(2);}
215 Double_t GetEta() const {return x(3);}
216 Double_t GetTgl() const {return x(4);}
217 Double_t GetPt() const {return 0.3*0.2/GetC()/100;}
218 Double_t GetP() const {
219 return TMath::Abs(GetPt())*sqrt(1.+GetTgl()*GetTgl());
221 Double_t GetSigmaY2() const {return C(0,0);}
222 Double_t GetSigmaZ2() const {return C(1,1);}
223 Double_t GetSigmaC2() const {return C(2,2);}
224 Double_t GetSigmaTgl2() const {return C(4,4);}
225 Double_t GetAlpha() const {return fAlpha;}
226 Double_t GetChi2() const {return fChi2;}
227 operator int() const {return fClusters.GetEntriesFast();}
229 ClassDef(AliTPCtrack,1) // Time Projection Chamber reconstructed tracks
234 //-----------------------------------------------------------------
235 // Classes for internal tracking use.
236 //-----------------------------------------------------------------
237 const unsigned MAX_CLUSTER_PER_ROW=3500;
240 //-----------------------------------------------------------------
241 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
242 //-----------------------------------------------------------------
243 unsigned num_of_clusters;
244 const AliTPCcluster *clusters[MAX_CLUSTER_PER_ROW];
246 AliTPCRow() {num_of_clusters=0;}
247 void InsertCluster(const AliTPCcluster*);
249 operator int() const {return num_of_clusters;}
250 const AliTPCcluster* operator[](int i) const {return clusters[i];}
251 int Find(Double_t y) const;
255 //-----------------------------------------------------------------
256 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
257 //-----------------------------------------------------------------
259 unsigned num_of_rows;
261 static AliTPCParam *param;
263 AliTPCSector() { row = 0; num_of_rows=0; }
264 virtual ~AliTPCSector() { delete[] row; }
265 static void SetParam(AliTPCParam *p) { param=p; }
266 AliTPCRow& operator[](int i) const { return *(row+i); }
267 int GetNRows() const { return num_of_rows; }
268 virtual Double_t GetX(int l) const = 0;
269 virtual Double_t GetMaxY(int l) const = 0;
270 virtual Double_t GetAlpha() const = 0;
271 virtual Double_t GetAlphaShift() const = 0;
272 virtual Int_t GetRowNumber(Double_t x) const = 0;
275 class AliTPCSSector : public AliTPCSector {
276 //-----------------------------------------------------------------
277 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
278 //-----------------------------------------------------------------
282 fprintf(stderr,"AliTPCSSector: parameters are not set !\n");
285 num_of_rows=param->GetNRowLow();
286 row=new AliTPCRow[num_of_rows];
288 virtual ~AliTPCSSector() {}
289 Double_t GetX(int l) const { return param->GetPadRowRadiiLow(l); }
290 Double_t GetMaxY(int l) const { return GetX(l)*tan(0.5*GetAlpha()); }
291 Double_t GetAlpha() const {return param->GetInnerAngle();}
292 Double_t GetAlphaShift() const {return param->GetInnerAngleShift();}
293 Int_t GetRowNumber(Double_t x) const {
294 Double_t r=param->GetInnerRadiusUp();
295 if (x > r) return param->GetNRowLow();
296 r=param->GetInnerRadiusLow();
297 if (x < r) return -1;
298 return int((x-r)/param->GetPadPitchLength() + 0.5);
302 class AliTPCLSector : public AliTPCSector {
303 //-----------------------------------------------------------------
304 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
305 //-----------------------------------------------------------------
309 fprintf(stderr,"AliTPCLSector: parameters are not set !\n");
312 num_of_rows=param->GetNRowUp();
313 row=new AliTPCRow[num_of_rows];
315 virtual ~AliTPCLSector() {}
316 Double_t GetX(int l) const { return param->GetPadRowRadiiUp(l); }
317 Double_t GetMaxY(int l) const { return GetX(l)*tan(0.5*GetAlpha()); }
318 Double_t GetAlpha() const {return param->GetOuterAngle();}
319 Double_t GetAlphaShift() const {return param->GetOuterAngleShift();}
320 Int_t GetRowNumber(Double_t x) const {
321 Double_t r=param->GetOuterRadiusUp();
322 if (x > r) return param->GetNRowUp();
323 r=param->GetOuterRadiusLow();
324 if (x < r) return -1;
325 return int((x-r)/param->GetPadPitchLength() + 0.5);