3 ////////////////////////////////////////////////
4 // Manager class for TPC //
5 ////////////////////////////////////////////////
7 #include "AliDetector.h"
10 #include "AliTPCSecGeo.h"
11 #include "AliTPCParam.h"
14 #include <TClonesArray.h>
24 class AliTPC : public AliDetector {
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
39 Float_t fSide; // selects left(-1), right(+1), or both(0) sides of the TPC
40 Int_t fNoComp; // number of a drift gas components
41 Int_t fMixtComp[3]; // drift gas components
42 Float_t fMixtProp[3]; // mixture proportions
46 TClonesArray *fClusters; // List of clusters for all sectors
47 TClonesArray *fTracks; // List of reconstructed tracks
49 AliTPCD * fDigParam; //detector parameters
52 AliTPC(const char *name, const char *title);
54 virtual void AddCluster(Float_t*, Int_t*);
55 /*virtual*/void AddCluster(const AliTPCcluster&);
56 virtual void AddDigit(Int_t*, Int_t*);
57 virtual void AddHit(Int_t, Int_t*, Float_t*);
58 virtual void AddTrack(Float_t*);
59 /*virtual*/void AddTrack(const AliTPCtrack&);
60 Int_t DistancetoPrimitive(Int_t px, Int_t py);
61 virtual void BuildGeometry();
62 virtual void CreateGeometry() {}
63 virtual void CreateMaterials();
64 virtual void Hits2Clusters();
66 virtual void Hits2Digits(); //MI change
67 virtual void Hits2DigitsSector(Int_t isec); //MI change
69 virtual Int_t IsVersion() const =0;
70 virtual void Digits2Clusters();
71 virtual void Clusters2Tracks();
72 TClonesArray *Clusters() {return fClusters;}
73 TClonesArray *Tracks() {return fTracks;}
74 Int_t *GetClustersIndex() {return fClustersIndex;}
75 Int_t *GetDigitsIndex() {return fDigitsIndex;}
76 Int_t GetNsectors() {return fNsectors;}
77 virtual void MakeBranch(Option_t *opt=" ");
78 virtual void ResetDigits();
79 virtual void SetSecAL(Int_t sec);
80 virtual void SetSecAU(Int_t sec);
81 virtual void SetSecLows(Int_t s1,Int_t s2,Int_t s3,Int_t s4,Int_t s5, Int_t s6);
82 virtual void SetSecUps (Int_t s1,Int_t s2,Int_t s3,Int_t s4,Int_t s5, Int_t s6,
83 Int_t s7,Int_t s8,Int_t s9,Int_t s10, Int_t s11, Int_t s12);
84 virtual void SetSens(Int_t sens);
87 virtual void SetSide(Float_t side);
88 virtual void SetGasMixt(Int_t nc,Int_t c1,Int_t c2,Int_t c3,Float_t p1,
89 Float_t p2,Float_t p3);
91 virtual void StepManager()=0;
92 virtual void DrawDetector() {}
93 AliTPCD* GetDigParam() {return fDigParam;} //MI change8
94 void SetDigParam(AliTPCD* param) {fDigParam=param;} //MI must think about it
97 void ElDiff(Float_t *xyz);
98 void MakeTriplet(Int_t row,TObjArray **rowTriplet,
101 void ExB(Float_t *xyz);
102 void DigitizeRow(Int_t irow,Int_t isec,TObjArray **rowTriplet);
103 Float_t GetSignal(TObjArray *p1, Int_t ntr, Int_t np, TMatrix *m1, TMatrix *m2,
105 void GetList (Float_t label,Int_t np,TMatrix *m,Int_t *IndexRange,
107 void MakeSector(Int_t isec,Int_t nrows,TTree *TH,Stat_t ntracks,TObjArray **row);
108 void GetCrossTalk (Int_t iFlag,TObjArray *p,Int_t ntracks,Int_t *npads,
112 ClassDef(AliTPC,2) // Time Projection Chamber class
115 //_____________________________________________________________________________
117 class AliTPCcluster : public TObject {
119 Int_t fTracks[3];//labels of overlapped tracks
120 Int_t fSector; //sector number
121 Int_t fPadRow; //PadRow number
122 Float_t fY ; //Y of cluster
123 Float_t fZ ; //Z of cluster
124 Float_t fQ ; //Q of cluster (in ADC counts)
125 Float_t fSigmaY2; //Sigma Y square of cluster
126 Float_t fSigmaZ2; //Sigma Z square of cluster
130 fTracks[0]=fTracks[1]=fTracks[2]=0;
132 fY=fZ=fQ=fSigmaY2=fSigmaZ2=0.;
134 AliTPCcluster(Float_t *hits, Int_t*);
135 virtual ~AliTPCcluster() {;}
136 void Use() {fTracks[0]=-fTracks[0];}
137 int IsUsed() const {return (fTracks[0]<0) ? 1 : 0;}
138 void GetXYZ(Float_t *x, const AliTPCParam *) const; //Get global x,y,z
139 Bool_t IsSortable() const;
140 Int_t Compare(TObject *o) ;
141 ClassDef(AliTPCcluster,1) // Time Projection Chamber clusters
145 //_____________________________________________________________________________
147 class AliTPCdigit : public AliDigit {
149 Int_t fSector; //array of volumes
150 Int_t fPadRow; //Row number
151 Int_t fPad ; //Pad number
152 Int_t fTime; //Time bucket
153 Int_t fSignal; //Signal amplitude
157 AliTPCdigit(Int_t *tracks, Int_t *digits);
158 virtual ~AliTPCdigit() {}
160 ClassDef(AliTPCdigit,1) // Time Projection Chamber digits
164 //_____________________________________________________________________________
166 class AliTPChit : public AliHit {
168 Int_t fSector; //sector number
169 Int_t fPadRow; //Pad Row number
170 Float_t fQ ; //charge
174 AliTPChit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits);
175 virtual ~AliTPChit() {}
177 ClassDef(AliTPChit,1) // Time Projection Chamber hits
181 //_____________________________________________________________________________
183 const unsigned MAX_CLUSTER_PER_ROW=1500;
184 const Double_t FIELD=0.2;
186 class AliTPCtrack : public TObject {
187 Double_t fAlpha; // rotation angle
188 Double_t ref; // track reference plane (X-coordinate)
189 TVector x; // vector of track parameters
190 TMatrix C; // covariance matrix of track parameters
191 TObjArray clusters; // pointers to clusters belonging to this track
192 Double_t chi2; // total chi2 value for this track
194 AliTPCtrack(Float_t *hits);
195 AliTPCtrack(const AliTPCcluster& c, const TVector& xx, const TMatrix& CC,
196 const AliTPCParam *);
197 AliTPCtrack(const AliTPCtrack& t);
198 int PropagateTo(Double_t x,
199 Double_t x0=28.94,Double_t rho=0.9e-3,Double_t pm=0.139);
200 void PropagateToVertex(
201 Double_t x0=36.66,Double_t rho=1.2e-3,Double_t pm=0.139);
202 void Update(const AliTPCcluster* c, Double_t chi2);
203 int Rotate(Double_t angle);
205 void UseClusters() const ;
206 Double_t GetPredictedChi2(const AliTPCcluster*) const ;
207 Double_t GetX() const {return ref;}
208 Double_t GetY() const {return x(0);}
209 Double_t GetC() const {return x(2);}
210 Double_t GetY(Double_t x) const;
211 Double_t GetZ() const {return x(1);}
212 Double_t GetTgl() const {return x(4);}
213 Double_t GetPt() const {return 0.3*FIELD/x(2)/100;}
215 Double_t GetSigmaY2() const {return C(0,0);}
216 Double_t GetSigmaZ2() const {return C(1,1);}
217 Double_t GetSigmaC2() const {return C(2,2);}
218 Double_t GetSigmaTgl2() const {return C(4,4);}
219 Double_t GetAlpha() const {return fAlpha;}
220 Double_t GetChi2() const {return chi2;}
221 operator int() const {return clusters.GetEntriesFast();}
222 AliTPCcluster& operator[](int i) {
223 return *((AliTPCcluster*)clusters.UncheckedAt(i));
225 void GetPxPyPz(Double_t&, Double_t&, Double_t&) const ;
226 void GetXYZ(Double_t& X,Double_t& Y,Double_t& Z) const {X=ref;Y=x(0);Z=x(1);}
228 ClassDef(AliTPCtrack,1) // Time Projection Chamber reconstructed tracks
231 //_____Classes for internal tracking use ______________________________________
233 class TrackSeed : public AliTPCtrack {
235 TrackSeed(const AliTPCcluster& c, const TVector& x, const TMatrix& C,
236 const AliTPCParam *p) : AliTPCtrack(c,x,C,p) {}
237 Bool_t IsSortable() const {return kTRUE;}
238 Int_t Compare(TObject *o) {
239 AliTPCtrack *t=(AliTPCtrack*)o;
240 Double_t c =GetSigmaY2();
241 Double_t co=t->GetSigmaY2();
243 else if (c<co) return -1;
249 unsigned num_of_clusters;
250 const AliTPCcluster *clusters[MAX_CLUSTER_PER_ROW];
252 AliTPCRow() {num_of_clusters=0;}
253 void InsertCluster(const AliTPCcluster*);
255 operator int() const {return num_of_clusters;}
256 const AliTPCcluster* operator[](int i) const {return clusters[i];}
257 int Find(Double_t y) const;
263 unsigned num_of_rows;
265 const AliTPCParam *param;
268 row = 0; num_of_rows=0;
271 virtual void SetUp(AliTPCParam *p) {param=p;}
272 virtual ~AliTPCSector() { delete[] row; }
273 AliTPCRow& operator[](int i) const { return *(row+i); }
274 virtual Double_t GetX(int l) const = 0;
275 virtual Double_t GetMaxY(int l) const = 0;
276 virtual Double_t GetAlpha() const = 0;
279 class AliTPCSSector : public AliTPCSector {
282 virtual ~AliTPCSSector() {}
283 virtual void SetUp(AliTPCParam *p) {
285 num_of_rows=p->GetNRowLow();
286 row=new AliTPCRow[num_of_rows];
288 Double_t GetX(int l) const { return param->GetPadRowRadiiLow(l); }
289 Double_t GetAlpha() const {return alpha_low;}
290 Double_t GetMaxY(int l) const { return GetX(l)*tan(0.5*GetAlpha()); }
293 class AliTPCLSector : public AliTPCSector {
296 virtual ~AliTPCLSector() {}
297 virtual void SetUp(AliTPCParam *p) {
299 num_of_rows=p->GetNRowUp();
300 row=new AliTPCRow[num_of_rows];
302 Double_t GetX(int l) const { return param->GetPadRowRadiiUp(l); }
303 Double_t GetAlpha() const {return alpha_up;}
304 Double_t GetMaxY(int l) const { return GetX(l)*tan(0.5*GetAlpha()); }