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
41 TClonesArray *fClusters; // List of clusters for all sectors
42 TClonesArray *fTracks; // List of reconstructed tracks
44 AliTPCD * fDigParam; //detector parameters
47 AliTPC(const char *name, const char *title);
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();
61 virtual void Hits2Digits(); //MI change
62 virtual void Hits2DigitsSector(Int_t isec); //MI change
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);
82 virtual void SetSide(Float_t side);
83 virtual void StepManager()=0;
84 virtual void DrawDetector() {}
85 AliTPCD* GetDigParam() {return fDigParam;} //MI change8
86 void SetDigParam(AliTPCD* param) {fDigParam=param;} //MI must think about it
89 void ElDiff(Float_t *xyz);
90 void MakeTriplet(Int_t row,TObjArray **rowTriplet,
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,
97 void GetList (Float_t label,Int_t np,TMatrix *m,Int_t *IndexRange,
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,
104 ClassDef(AliTPC,2) // Time Projection Chamber class
107 //_____________________________________________________________________________
109 class AliTPCcluster : public TObject {
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
122 fTracks[0]=fTracks[1]=fTracks[2]=0;
124 fY=fZ=fQ=fSigmaY2=fSigmaZ2=0.;
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;}
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) ;
133 ClassDef(AliTPCcluster,1) // Time Projection Chamber clusters
137 //_____________________________________________________________________________
139 class AliTPCdigit : public AliDigit {
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
149 AliTPCdigit(Int_t *tracks, Int_t *digits);
150 virtual ~AliTPCdigit() {}
152 ClassDef(AliTPCdigit,1) // Time Projection Chamber digits
156 //_____________________________________________________________________________
158 class AliTPChit : public AliHit {
160 Int_t fSector; //sector number
161 Int_t fPadRow; //Pad Row number
162 Float_t fQ ; //charge
166 AliTPChit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits);
167 virtual ~AliTPChit() {}
169 ClassDef(AliTPChit,1) // Time Projection Chamber hits
173 //_____________________________________________________________________________
175 const unsigned MAX_CLUSTER_PER_ROW=1500;
176 const Double_t FIELD=0.2;
178 class 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
186 AliTPCtrack(Float_t *hits);
187 AliTPCtrack(const AliTPCcluster& c, const TVector& xx, const TMatrix& CC,
188 const AliTPCParam *);
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);
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;}
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));
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);}
220 ClassDef(AliTPCtrack,1) // Time Projection Chamber reconstructed tracks
223 //_____Classes for internal tracking use ______________________________________
225 class TrackSeed : public AliTPCtrack {
227 TrackSeed(const AliTPCcluster& c, const TVector& x, const TMatrix& C,
228 const AliTPCParam *p) : AliTPCtrack(c,x,C,p) {}
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();
235 else if (c<co) return -1;
241 unsigned num_of_clusters;
242 const AliTPCcluster *clusters[MAX_CLUSTER_PER_ROW];
244 AliTPCRow() {num_of_clusters=0;}
245 void InsertCluster(const AliTPCcluster*);
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;
255 unsigned num_of_rows;
257 const AliTPCParam *param;
260 row = 0; num_of_rows=0;
263 virtual void SetUp(AliTPCParam *p) {param=p;}
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;
271 class AliTPCSSector : public AliTPCSector {
274 virtual ~AliTPCSSector() {}
275 virtual void SetUp(AliTPCParam *p) {
277 num_of_rows=p->GetNRowLow();
278 row=new AliTPCRow[num_of_rows];
280 Double_t GetX(int l) const { return param->GetPadRowRadiiLow(l); }
281 Double_t GetAlpha() const {return alpha_low;}
282 Double_t GetMaxY(int l) const { return GetX(l)*tan(0.5*GetAlpha()); }
285 class AliTPCLSector : public AliTPCSector {
288 virtual ~AliTPCLSector() {}
289 virtual void SetUp(AliTPCParam *p) {
291 num_of_rows=p->GetNRowUp();
292 row=new AliTPCRow[num_of_rows];
294 Double_t GetX(int l) const { return param->GetPadRowRadiiUp(l); }
295 Double_t GetAlpha() const {return alpha_up;}
296 Double_t GetMaxY(int l) const { return GetX(l)*tan(0.5*GetAlpha()); }