1 ///////////////////////////////////////////////////////////////////////
2 // Manager and of geomety classes for set: TPC //
4 // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
6 ///////////////////////////////////////////////////////////////////////
8 // MI change global variables for geometry
9 // declaration of the global static variable
10 // of AliTPCParam objects
14 //#include <TObject.h>
15 #include "AliTPCParam.h"
16 //some old TPC parameters in AliTPCSecGeo.h
17 #include "AliTPCSecGeo.h"
24 const Float_t kInnerRadiusLow = 89.45;
25 const Float_t kOuterRadiusLow = 143.725;
26 const Float_t kInnerRadiusUp = 134.55;
27 const Float_t kOuterRadiusUp = 248.275;
29 const Float_t kPadPitchLength = 2.05;
30 const Float_t kPadPitchWidth = 0.35;
31 const Float_t kPadLength = 2.05;
32 const Float_t kPadWidth = 0.35;
33 // Number of wires per pad and wire-wire pitch
34 const Int_t knWires = 5;
35 const Float_t kDiffT = 2.2e-2;
36 const Float_t kDiffL = 2.2e-2;
37 const Float_t kDriftV =2.85e6;
39 const Float_t kOmegaTau = 0.145;
40 const Float_t kAttCoef = 250.;
41 const Float_t kOxyCont = 5.e-6;
45 const Float_t kChipGain = 24;
46 const Float_t kGasGain = 1e4;
47 const Float_t kTSample = 2.e-7; //TSAMPLE
48 const Float_t kTFWHM = 2.5e-7; //fwhm of charge distribution
50 const Float_t kNoise = 500; //default noise = 1000 el
51 const Int_t kZeroSup=5;
52 const Float_t kPadCoupling=0.5;
54 const Float_t kEdgeSectorSpace = 5.26;
59 //___________________________________________
60 AliTPCParam::AliTPCParam()
62 //constructor set the default parameters
67 void AliTPCParam::CRXYZtoXYZ(Float_t *xyz,
68 const Int_t §or, const Int_t & padrow, Int_t option) const
70 //transform relative coordinates to absolute
71 Bool_t rel = ( (option&2)!=0);
73 row_first = (sector<25) ? fPadRowLow[0] : fPadRowUp[0];
74 if (rel==kTRUE) //if we have
77 xyz[0]+=(Int_t) padrow*fPadPitchLength;
80 if ( sector>12) xyz[2]*=-1.;
82 if (sector>48) xyz[2]*=-1;
86 AdjustAngles(sector,cos,sin);
87 xyz[0]=x1*cos - y1*sin;
88 xyz[1]=x1*sin + y1*cos;
91 void AliTPCParam::XYZtoCRXYZ(Float_t *xyz,
92 Int_t §or, Int_t & padrow, Int_t option)
94 //transform global position to the position relative to the sector padrow
95 //if option=0 X calculate absolute calculate sector
96 //if option=1 X absolute use input sector
97 //if option=2 X relative to pad row calculate sector
98 //if option=3 X relative use input sector
99 //!!!!!!!!! WE start to calculate rows from row = 0
101 Bool_t rel = ( (option&2)!=0);
102 //option 0 and 2 means that we don't have information about sector
103 //we calculate sector
106 Float_t r = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
107 if ((xyz[0]==0)&&(xyz[1]==0)) angle = 0;
110 angle =TMath::ASin(xyz[1]/r);
111 if (xyz[0]<0) angle=TMath::Pi()-angle;
112 if ( (xyz[0]>0) && (xyz[1]<0) ) angle=2*TMath::Pi()+angle;
114 //transform global position to the position relative to the sector padrow
115 //fistly calculate xyz[0] "polomer for lover sector
116 sector=Int_t(angle/alpha_low)+1;
119 //firstly we suppose that we are in inner sector
121 AdjustAngles(sector,cos,sin);
123 x1=xyz[0]*cos + xyz[1]*sin;
124 y1=-xyz[0]*sin + xyz[1]*cos;
125 if (x1>fOuterRadiusLow)
127 sector=Int_t(angle/alpha_up)+25;
128 AdjustAngles(sector,cos,sin);
129 x1=xyz[0]*cos + xyz[1]*sin;
130 y1=-xyz[0]*sin + xyz[1]*cos;
131 if (xyz[2]<0) sector+=24;
134 if (xyz[2]<0) sector+=12;
135 if (xyz[2]<0) xyz[2]=-xyz[2];
136 if (x1<fOuterRadiusLow)
137 padrow =Int_t( (x1-fPadRowLow[0])/fPadPitchLength+0.5);
139 padrow = Int_t( (x1-fPadRowUp[0])/fPadPitchLength+0.5);
141 if (x1<fOuterRadiusLow) x1-=padrow*fPadPitchLength+fPadRowLow[0];
143 x1-=padrow*fPadPitchLength+fPadRowUp[0];
148 //if we have information about sector
150 AdjustAngles(sector,cos,sin);
153 //rotate to given sector
154 x1=xyz[0]*cos + xyz[1]*sin;
155 y1=-xyz[0]*sin + xyz[1]*cos;
156 //calculate pad row number
158 padrow =Int_t( (x1-fPadRowLow[0])/fPadPitchLength+1.5)-1;
159 if ( sector>12) xyz[2]=-xyz[2];
162 padrow =Int_t( (x1-fPadRowUp[0])/fPadPitchLength+1.5)-1;
163 if (sector>48) xyz[2]=-xyz[2];
165 //if we store relative position calculate position relative to pad row
168 x1-=padrow*fPadPitchLength+fPadRowLow[0];
170 x1-=padrow*fPadPitchLength+fPadRowUp[0];
177 void AliTPCParam::CRYZtoTimePad(const Float_t &y, const Float_t &z,
178 Float_t &time, Float_t &pad,
179 Int_t sector, Int_t padrow)
181 //transform position in cm to position in time slices and pads
182 Float_t nofpads = (sector < 25) ? fnPadsLow[padrow] : fnPadsUp[padrow];
183 Float_t padc=(nofpads+1)/2; // this is the "central" pad for a row
184 pad = y/(fPadPitchWidth)+padc;
185 time=(z_end-z)/(fDriftV*fTSample);
186 // cout<<y<<" "<<z<<" "<<time<<" "<<pad<<" "<<
187 // sector<<" "<<padrow<<"\n";
189 void AliTPCParam::CRTimePadtoYZ(Float_t &y, Float_t &z,
190 const Float_t &time, const Float_t &pad,
191 Int_t sector, Int_t padrow)
193 //transform position in time slices and pads to cm
194 Float_t nofpads = (sector < 25) ? fnPadsLow[padrow] : fnPadsUp[padrow];
195 Float_t padc=(nofpads+1)/2; // this is the "central" pad for a row
196 y=(pad-padc)*fPadPitchWidth;
197 z=z_end-time*(fDriftV*fTSample);
198 // cout<<y<<" "<<z<<" "<<time<<" "<<pad<<" "<<
199 // sector<<" "<<padrow<<"\n";
202 Int_t AliTPCParam::GetWire(Float_t & x)
205 //return wire number of pad for electron at relative position x
206 //to the center of the pad
207 //and adjust x to the wire position
208 //we suppose that if the wire number is even the center wire
209 //is at center of pad
211 Float_t xrel= x/fWWPitch;
212 if ((fnWires>>1)==0) xrel+=1;
214 Int_t nw=Int_t(xrel);
218 if ((fnWires>>1)==0) x-=fWWPitch/2.;
222 Int_t AliTPCParam::GetIndex(Int_t sector, Int_t row)
225 //give index of the given sector and pad row
226 //no control if the sectors and rows are reasonable !!!
228 if (sector<25) return (sector-1)*fnRowLow+row;
229 return (24*fnRowLow)+(sector-25)*fnRowUp+row;
232 Bool_t AliTPCParam::AdjustSectorRow(Int_t index, Int_t & sector, Int_t &row)
235 //return sector and padrow for given index
236 //if index is reasonable return true else return false
238 if ( (index<0) || (index>fNtRows)) return kFALSE;
239 Int_t outindex = 24*fnRowLow;
240 if (index<outindex) {
241 sector = index/fnRowLow;
242 row = index - sector*fnRowLow;
247 sector = index/fnRowUp;
248 row = index - sector*fnRowUp;
255 Int_t AliTPCParam::GetPadRow(Int_t isec, Float_t &x)
258 //return the pad row for given x (transformed)
260 Float_t row_first=GetPadRowRadii(isec,0);
261 Int_t row = Int_t(( x-row_first+1.5*fPadPitchLength)/fPadPitchLength)-1;
262 //Int_t will make from -0.5 0 but we want to make -1 so we add and after substract 1
263 x -=row* fPadPitchLength+row_first;
264 if ( (row<0)||(row>=GetNRow(isec))) return -1;
268 void AliTPCParam::SetDefault()
270 //set default TPC param
272 //set radius parameters
273 fInnerRadiusLow = kInnerRadiusLow;
274 fOuterRadiusLow = kOuterRadiusLow;
275 fInnerRadiusUp = kInnerRadiusUp;
276 fOuterRadiusUp = kOuterRadiusUp;
277 // set default pad size and shape
278 fPadPitchLength = kPadPitchLength;
279 fPadPitchWidth = kPadPitchWidth;
280 fPadLength = kPadLength;
281 fPadWidth = kPadWidth;
284 fWWPitch= kPadPitchLength/Float_t(knWires);
287 fOmegaTau = kOmegaTau;
291 fChipGain = kChipGain;
294 fPadCoupling= kPadCoupling;
296 fTSigma =kTFWHM/2.35;
298 //calculate sin and cosine of rotations angle
299 for (Int_t i=1; i<80; i++)
303 angle = (i < 13) ? (i-1)*alpha_low : (i-13)*alpha_low;
306 angle = (i < 49) ? (i-25)*alpha_up : (i-49)*alpha_up;
308 fRotAngle[i]=TMath::Cos(angle);
309 fRotAngle[100+i]=TMath::Sin(angle);
314 void AliTPCParam::AdjustAngles(Int_t isec, Float_t &cos, Float_t &sin) const
316 //set cosinus and sinus of rotation angles for sector isec
318 sin=fRotAngle[100+isec];
321 Bool_t AliTPCParam::Update()
325 //recalculate and check some geometric parameters
326 if (0.001>fPadPitchLength){
327 cout<<"ERROR !!! Small pad pitch length \n"<<flush;
331 if (fPadPitchLength<fPadLength) {
332 cout<<"ERROR !!! Pitch length smaller then length of pad \n"<<flush;
336 fnRowUp = Int_t((0.01+fOuterRadiusUp-fOuterRadiusLow)/fPadPitchLength)+1;
337 if ( kMaxRows<fnRowUp) fnRowUp = kMaxRows;
338 if (1>fnRowUp) return kFALSE;
340 fnRowLow = Int_t((0.01+fInnerRadiusUp-fInnerRadiusLow)/fPadPitchLength)+1;
341 if ( kMaxRows<fnRowLow) fnRowUp = kMaxRows;
342 if (1>fnRowLow) return kFALSE;
343 // adjust upper sectors pad row positions and pad numbers
344 for (i = 0;i<fnRowUp;i++)
346 Float_t x = fOuterRadiusLow +fPadPitchLength*(Float_t)i;
347 Float_t y = (x-0.5*fPadPitchLength)*2.*tan(alpha_up/2)-kEdgeSectorSpace;
349 fnPadsUp[i] = (Int_t)(y/fPadPitchWidth) ;
350 if ((fnPadsUp[i]%2) == 0) fnPadsUp[i]-=1;
352 // adjust lower sectors pad row positions and pad numbers
353 for (i = 0;i<fnRowLow;i++)
355 Float_t x = fInnerRadiusLow +fPadPitchLength*(Float_t)i;
356 Float_t y = (x-0.5*fPadPitchLength)*2.*tan(alpha_low/2)-kEdgeSectorSpace;
358 fnPadsLow[i] = (Int_t)(y/fPadPitchWidth) ;
359 if ((fnPadsLow[i]%2) == 0) fnPadsLow[i]-=1;
362 //that variable are not writen to the file there are calculated
364 fWWPitch= fPadPitchLength/Float_t(fnWires);
365 fZWidth = fTSample*fDriftV;
366 fNtRows = 24*fnRowLow+48*fnRowUp;
374 Bool_t AliTPCParam::GetStatus()
376 //get information about object consistency
380 Int_t AliTPCParam::GetNRowLow() const
382 //get the number of pad rows in low sector
385 Int_t AliTPCParam::GetNRowUp() const
387 //get the number of pad rows in up sector
390 Float_t AliTPCParam::GetPadRowRadiiLow(Int_t irow) const
392 //get the pad row (irow) radii
393 if ( !(irow<0) && (irow<fnRowLow) )
394 return fPadRowLow[irow];
399 Float_t AliTPCParam::GetPadRowRadiiUp(Int_t irow) const
401 //get the pad row (irow) radii
402 if ( !(irow<0) && (irow<fnRowUp) )
403 return fPadRowUp[irow];
408 Int_t AliTPCParam::GetNPadsLow(Int_t irow) const
410 //get the number of pads in row irow
411 if ( !(irow<0) && (irow<fnRowLow) )
412 return fnPadsLow[irow];
418 Int_t AliTPCParam::GetNPadsUp(Int_t irow) const
420 //get the number of pads in row irow
421 if ( !(irow<0) && (irow<fnRowUp) )
422 return fnPadsUp[irow];
428 void AliTPCParam::Streamer(TBuffer &R__b)
430 // Stream an object of class AliTPC.
432 if (R__b.IsReading()) {
433 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
434 TObject::Streamer(R__b);
435 if (R__v < 2) return;
437 R__b >> fInnerRadiusLow;
438 R__b >> fInnerRadiusUp;
439 R__b >> fOuterRadiusLow;
440 R__b >> fOuterRadiusUp;
442 R__b >> fPadPitchLength;
443 R__b >> fPadPitchWidth;
466 fWWPitch= fPadPitchLength/Float_t(fnWires);
467 fZWidth = fTSample*fDriftV;
468 fNtRows = 24*fnRowLow+48*fnRowUp;
471 R__b.WriteVersion(AliTPCParam::IsA());
472 TObject::Streamer(R__b);
473 R__b << fInnerRadiusLow;
474 R__b << fInnerRadiusUp;
475 R__b << fOuterRadiusLow;
476 R__b << fOuterRadiusUp;
478 R__b << fPadPitchLength;
479 R__b << fPadPitchWidth;