3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 ////////////////////////////////////////////////
9 // Manager class for TPC parameters //
10 ////////////////////////////////////////////////
12 #include "AliDetectorParam.h"
17 class AliTPCParam : public AliDetectorParam {
18 //////////////////////////////////////////////////////
19 //////////////////////////////////////////////////////
20 //ALITPCParam object to be possible change
21 //geometry and some other parameters of TPC
22 //used by AliTPC and AliTPCSector
26 virtual ~AliTPCParam();
28 virtual Bool_t Transform(Float_t *xyz, Int_t *index, Int_t* oindex);
29 //transformation from input coodination system to output coordination system
30 Int_t Transform0to1(Float_t *xyz, Int_t *index) const;
31 //trasforamtion from global to global - adjust index[0] sector
32 //return value is equal to sector corresponding to global position
33 void Transform1to2(Float_t *xyz, Int_t *index) const;
34 //transformation to rotated coordinata
35 void Transform2to1(Float_t *xyz, Int_t *index) const;
36 //transformation from rotated coordinata to global coordinata
37 void Transform2to2(Float_t *xyz, Int_t *index, Int_t *oindex) const;
38 //transform rotated coordinata of one sector to rotated
39 //coordinata relative to another sector
40 Float_t Transform2to2NearestWire(Float_t *xyz, Int_t *index) const;
41 //round x position to nearest wire
42 Int_t Transform2to3(Float_t *xyz, Int_t *index) const;
43 //calulate coresponding index[2] -pad row for straight rows
44 //does not change xyz[]
46 void Transform3to4(Float_t *xyz, Int_t *index) const;
47 //valid only for straight rows straight rows
48 //calculate xyz[0] position relative to given index
50 void Transform4to3(Float_t *xyz, Int_t *index) const;
51 //valid only for straight rows straight rows
52 //transform xyz[0] position relative to given index
53 void Transform2to5( Float_t *xyz, Int_t *index) const;
54 //transform [x,y,z] to [r,rphi,z]
55 void Transform5to2(Float_t *xyz, Int_t *index) const;
56 //transform [r,rphi,z] coordinata to [x,y,z]
57 void Transform4to8(Float_t *xyz, Int_t *index) const;
58 //transform xyz coordinata to 'digit' coordinata
59 void Transform8to4(Float_t *xyz, Int_t *index) const;
60 //transform 'digit' coordinata to xyz coordinata
61 void Transform6to8(Float_t *xyz, Int_t *index) const;
62 //transform dr,f coordinata to 'digit' coordinata
63 void Transform8to6(Float_t *xyz, Int_t *index) const;
64 //transform 'digit' coordinata to dr,f coordinata
66 virtual Int_t Transform2toPadRow(Float_t *xyz, Int_t *index) const{return 0;}
67 //transform rotated to
69 virtual Int_t GetPadRow(Float_t *xyz, Int_t *index) const ;
70 //return pad row of point xyz - xyz is given in coordinate system -(given by index)
71 //output system is 3 for straight row and 7 for cylindrical row
72 virtual void XYZtoCRXYZ(Float_t *xyz,
73 Int_t §or, Int_t &padrow, Int_t option=3) const {;}
74 //transform global position to the position relative to the sector padrow
75 //if option=0 X calculate absolute calculate sector
76 //if option=1 X absolute use input sector
77 //if option=2 X relative to pad row calculate sector
78 //if option=3 X relative use input sector
80 virtual void CRXYZtoXYZ(Float_t *xyz,
81 const Int_t §or, const Int_t & padrow, Int_t option=3) const {;}
82 //transform relative position to the gloabal position
84 virtual void CRTimePadtoYZ(Float_t &y, Float_t &z,
85 const Float_t &time, const Float_t &pad,
86 Int_t sector, Int_t padrow ){;}
87 //transform position in digit units (time slices and pads) to "normal"
89 virtual void CRYZtoTimePad(const Float_t &y, const Float_t &z,
90 Float_t &time, Float_t &pad,
91 Int_t sector, Int_t padrow){;}
92 //transform position in cm to position in digit unit
93 virtual Int_t CalcResponse(Float_t* x, Int_t * index, Int_t row){return 0;}
94 //calculate bin response as function of the input position -x and the weight
95 //if row -pad row is equal -1 calculate response for each pad row
96 //otherwise it calculate only in given pad row
97 //return number of valid response bin
98 virtual void SetDefault(); //set defaut TPCparam
99 virtual Bool_t Update(); //recalculate and check geometric parameters
100 Bool_t GetStatus(); //get information about object consistency
101 Int_t GetIndex(Int_t sector, Int_t row); //give index of the given sector and pad row
102 Int_t GetNSegmentsTotal() const {return fNtRows;}
103 Double_t GetLowMaxY(Int_t irow) const {return irow*0.;}
104 Double_t GetUpMaxY(Int_t irow) const {return irow*0;}
105 //additional geometrical function - for Belikov
107 Bool_t AdjustSectorRow(Int_t index, Int_t & sector, Int_t &row) const; //return sector and padrow
110 void AdjustCosSin(Int_t isec, Float_t &cos, Float_t &sin) const;
111 //set cosinus and sinus of rotation angles for sector isec
112 Float_t GetAngle(Int_t isec) const;
114 //set sector parameters
116 void SetInnerRadiusLow(Float_t InnerRadiusLow ) { fInnerRadiusLow=InnerRadiusLow;}
117 void SetOuterRadiusLow(Float_t OuterRadiusLow ) { fOuterRadiusLow=OuterRadiusLow;}
118 void SetInnerRadiusUp(Float_t InnerRadiusUp) { fInnerRadiusUp= InnerRadiusUp;}
119 void SetOuterRadiusUp(Float_t OuterRadiusUp) { fOuterRadiusUp= OuterRadiusUp;}
120 void SetSectorAngles(Float_t innerangle, Float_t innershift, Float_t outerangle,
122 void SetInnerFrameSpace(Float_t frspace) {fInnerFrameSpace = frspace;}
123 void SetOuterFrameSpace(Float_t frspace) {fOuterFrameSpace = frspace;}
124 void SetInnerWireMount(Float_t fmount) {fInnerWireMount = fmount;}
125 void SetOuterWireMount(Float_t fmount) {fOuterWireMount = fmount;}
126 void SetZLength(Float_t zlength) {fZLength = zlength;}
127 void SetGeometryType(Int_t type) {fGeometryType = type;}
131 void SetRowNLow( Int_t NRowLow){fNRowLow = NRowLow;}
132 void SetRowNUp1 (Int_t NRowUp1){fNRowUp1 = NRowUp1 ;} //upper sec short pads
133 void SetRowNUp2 (Int_t NRowUp2){fNRowUp2 = NRowUp2 ;} //upper sec long pads
134 void SetRowNUp (Int_t NRowUp){fNRowUp = NRowUp ;}
136 //set wire parameters
138 void SetInnerNWires(Int_t nWires){ fNInnerWiresPerPad=nWires;}
139 void SetInnerDummyWire(Int_t dummy) {fInnerDummyWire = dummy;}
140 void SetInnerOffWire(Float_t offset) {fInnerOffWire =offset;}
141 void SetOuter1NWires(Int_t nWires){ fNOuter1WiresPerPad=nWires;}
142 void SetOuter2NWire(Int_t nWires){ fNOuter2WiresPerPad=nWires;}
143 void SetOuterDummyWire(Int_t dummy) {fOuterDummyWire = dummy;}
144 void SetOuterOffWire(Float_t offset) {fOuterOffWire =offset;}
145 void SetInnerWWPitch( Float_t wwPitch) {fInnerWWPitch = wwPitch;}
146 void SetRInnerFirstWire(Float_t firstWire){fRInnerFirstWire = firstWire;}
147 void SetRInnerLastWire(Float_t lastWire){fRInnerLastWire = lastWire;}
148 void SetOuterWWPitch(Float_t wwPitch){fOuterWWPitch = wwPitch;}
149 void SetLastWireUp1(Float_t wireUp1){fLastWireUp1 = wireUp1;}
150 void SetROuterFirstWire(Float_t firstWire){fROuterFirstWire = firstWire;}
151 void SetROuterLastWire(Float_t lastWire){fROuterLastWire = lastWire;}
155 void SetInnerPadPitchLength(Float_t PadPitchLength){ fInnerPadPitchLength=PadPitchLength;}
156 void SetInnerPadPitchWidth(Float_t PadPitchWidth){ fInnerPadPitchWidth = PadPitchWidth;}
157 void SetInnerPadLength(Float_t PadLength){ fInnerPadLength=PadLength;}
158 void SetInnerPadWidth(Float_t PadWidth) { fInnerPadWidth=PadWidth;}
159 void SetOuter1PadPitchLength(Float_t PadPitchLength){ fOuter1PadPitchLength=PadPitchLength;}
160 void SetOuter2PadPitchLength(Float_t PadPitchLength){ fOuter2PadPitchLength=PadPitchLength;}
161 void SetOuterPadPitchWidth(Float_t PadPitchWidth){ fOuterPadPitchWidth = PadPitchWidth;}
162 void SetOuter1PadLength(Float_t PadLength){ fOuter1PadLength=PadLength;}
163 void SetOuter2PadLength(Float_t PadLength){ fOuter2PadLength=PadLength;}
164 void SetOuterPadWidth(Float_t PadWidth) { fOuterPadWidth=PadWidth;}
165 void SetMWPCReadout(Bool_t type) {fBMWPCReadout = type;}
166 void SetNCrossRows(Int_t rows){fNCrossRows = rows;}
170 void SetDiffT(Float_t DiffT){ fDiffT= DiffT;}
171 void SetDiffL(Float_t DiffL){ fDiffL=DiffL;}
172 void SetGasGain(Float_t GasGain){ fGasGain=GasGain;}
173 void SetDriftV(Float_t DriftV){ fDriftV= DriftV;}
174 void SetOmegaTau(Float_t OmegaTau){ fOmegaTau=OmegaTau;}
175 void SetAttCoef(Float_t AttCoef){ fAttCoef=AttCoef;}
176 void SetOxyCont(Float_t OxyCont){ fOxyCont=OxyCont;}
178 //set electronivc parameters
180 void SetPadCoupling(Float_t PadCoupling){ fPadCoupling=PadCoupling;}
181 void SetZeroSup(Int_t ZeroSup) { fZeroSup=ZeroSup;}
182 void SetNoise(Float_t Noise ) { fNoise= Noise;}
183 void SetChipGain(Float_t ChipGain){ fChipGain= ChipGain;}
184 void SetChipNorm(Float_t ChipNorm){ fChipNorm= ChipNorm;}
185 void SetTSample(Float_t TSample) { fTSample=TSample;}
186 void SetTFWHM(Float_t fwhm) { fTSigma=fwhm/2.35;}
187 void SetMaxTBin(Int_t maxtbin) { fMaxTBin = maxtbin;}
188 void SetADCSat(Int_t adcsat) { fADCSat = adcsat;}
189 void SetADCDynRange(Float_t adcdynrange) {fADCDynRange = adcdynrange;}
191 //set response parameters
193 void SetNResponseMax(Int_t max) { fNResponseMax = max;}
194 void SetResponseThreshold(Int_t threshold) {fResponseThreshold = threshold;}
196 //get sector parameters
198 Float_t GetInnerRadiusLow() const {return fInnerRadiusLow;}
199 Float_t GetInnerRadiusUp() const {return fInnerRadiusUp;}
200 Float_t GetOuterRadiusLow() const {return fOuterRadiusLow;}
201 Float_t GetOuterRadiusUp() const {return fOuterRadiusUp;}
202 Float_t GetInnerFrameSpace() const {return fInnerFrameSpace;}
203 Float_t GetOuterFrameSpace() const {return fOuterFrameSpace;}
204 Float_t GetInnerWireMount() const {return fInnerWireMount;}
205 Float_t GetOuterWireMount() const {return fOuterWireMount;}
206 Float_t GetInnerAngle() const ;
207 Float_t GetInnerAngleShift() const ;
208 Float_t GetOuterAngle() const ;
209 Float_t GetOuterAngleShift() const ;
210 Int_t GetNInnerSector() const {return fNInnerSector;}
211 Int_t GetNOuterSector() const {return fNOuterSector;}
212 Int_t GetNSector() const {return fNSector;}
213 Float_t GetZLength() const {return fZLength;}
214 Int_t GetGeometryType() const {return fGeometryType;}
217 //get wires parameter
219 Int_t GetInnerNWires() const {return fNInnerWiresPerPad;}
220 Float_t GetInnerWWPitch() const {return fInnerWWPitch;}
221 Int_t GetInnerDummyWire() const {return fInnerDummyWire;}
222 Float_t GetInnerOffWire() const {return fInnerOffWire;}
223 Float_t GetRInnerFirstWire() const {return fRInnerFirstWire;}
224 Float_t GetRInnerLastWire() const {return fRInnerLastWire;}
225 Int_t GetOuter1NWires() const {return fNOuter1WiresPerPad;}
226 Int_t GetOuter2NWires() const {return fNOuter2WiresPerPad;}
227 Float_t GetOuterWWPitch() const {return fOuterWWPitch;}
228 Int_t GetOuterDummyWire() const {return fOuterDummyWire;}
229 Float_t GetOuterOffWire() const {return fOuterOffWire;}
230 Float_t GetLastWireUp1() {return fLastWireUp1;}
231 Float_t GetROuterFirstWire() const {return fROuterFirstWire;}
232 Float_t GetROuterLastWire() const {return fROuterLastWire;}
233 Float_t GetWWPitch(Int_t isector = 0) const {
234 return ( (isector < fNInnerSector) ? fInnerWWPitch :fOuterWWPitch);}
238 Float_t GetInnerPadPitchLength() const {return fInnerPadPitchLength;}
239 Float_t GetInnerPadPitchWidth() const {return fInnerPadPitchWidth;}
240 Float_t GetInnerPadLength() const {return fInnerPadLength;}
241 Float_t GetInnerPadWidth() const {return fInnerPadWidth;}
242 Float_t GetOuter1PadPitchLength() const {return fOuter1PadPitchLength;}
243 Float_t GetOuter2PadPitchLength() const {return fOuter2PadPitchLength;}
244 Float_t GetOuterPadPitchWidth() const {return fOuterPadPitchWidth;}
245 Float_t GetOuter1PadLength() const {return fOuter1PadLength;}
246 Float_t GetOuter2PadLength() const {return fOuter2PadLength;}
247 Float_t GetOuterPadWidth() const {return fOuterPadWidth;}
248 Bool_t GetMWPCReadout() const {return fBMWPCReadout;}
249 Int_t GetNCrossRows() const {return fNCrossRows;}
250 Float_t GetPadPitchWidth(Int_t isector = 0) const {
251 return ( (isector < fNInnerSector) ? fInnerPadPitchWidth :fOuterPadPitchWidth);}
252 Float_t GetPadPitchLength(Int_t isector = 0, Int_t padrow=0) const
254 if (isector < fNInnerSector) {return fInnerPadPitchLength;}
256 return ((padrow<fNRowUp1) ? fOuter1PadPitchLength:fOuter2PadPitchLength);
259 Int_t GetNRowLow() const; //get the number of pad rows in low sector
260 Int_t GetNRowUp() const; //get the number of pad rows in up sector
261 Int_t GetNRowUp1() const; // number of short rows in up sector
262 Int_t GetNRowUp2() const; // number of long rows in up sector
263 Int_t GetNRow(Int_t isec) const {return ((isec<fNInnerSector) ? fNRowLow:fNRowUp);}
264 Int_t GetNRowsTotal(){return fNtRows;} //get total nuber of rows
265 Float_t GetPadRowRadiiLow(Int_t irow) const; //get the pad row (irow) radii
266 Float_t GetPadRowRadiiUp(Int_t irow) const; //get the pad row (irow) radii
267 Float_t GetPadRowRadii(Int_t isec,Int_t irow) const {
268 return ( (isec < fNInnerSector) ?GetPadRowRadiiLow(irow):GetPadRowRadiiUp(irow));}
269 //retrun radii of the pad row irow in sector i
270 Int_t GetNPadsLow(Int_t irow) const; //get the number of pads in row irow
271 Int_t GetNPadsUp(Int_t irow) const; //get the number of pads in row irow
272 Int_t GetNPads(Int_t isector,Int_t irow) const{
273 return ( (isector < fNInnerSector) ?GetNPadsLow(irow) : GetNPadsUp(irow));}
275 Float_t GetYInner(Int_t irow) const; // wire length in low sec row
276 Float_t GetYOuter(Int_t irow) const; // wire length in up sec row
280 Float_t GetDiffT() const {return fDiffT;}
281 Float_t GetDiffL() const {return fDiffL;}
282 Float_t GetGasGain() const {return fGasGain;}
283 Float_t GetDriftV() const {return fDriftV;}
284 Float_t GetOmegaTau() const {return fOmegaTau;}
285 Float_t GetAttCoef() const {return fAttCoef;}
286 Float_t GetOxyCont() const {return fOxyCont;}
288 //get Electronic parameters
290 Float_t GetPadCoupling() const {return fPadCoupling;}
291 Int_t GetZeroSup() const {return fZeroSup;}
292 Float_t GetNoise() const {return fNoise;}
293 Float_t GetChipGain() const {return fChipGain;}
294 Float_t GetChipNorm() const {return fChipNorm;}
295 Float_t GetTSample() const {return fTSample;}
296 Float_t GetZWidth() const {return fZWidth;}
297 Float_t GetTFWHM() const {return fTSigma*2.35;}
298 Float_t GetZSigma() const {return fTSigma*fDriftV;}
299 virtual Float_t GetZOffset() {return 3*fTSigma*fDriftV;}
300 Int_t GetMaxTBin() const {return fMaxTBin;}
301 Int_t GetADCSat() const {return fADCSat;}
302 Float_t GetADCDynRange() const {return fADCDynRange;}
303 Float_t GetTotalNormFac() const {return fTotalNormFac;}
304 Float_t GetNoiseNormFac() const {return fNoiseNormFac;}
308 Int_t * GetResBin(Int_t i);
309 //return response bin i - bin given by padrow [0] pad[1] timebin[2]
310 Float_t & GetResWeight(Int_t i);
311 //return weight of response bin i
314 Bool_t fbStatus; //indicates consistency of the data
315 //---------------------------------------------------------------------
316 // ALICE TPC sector geometry
317 //--------------------------------------------------------------------
318 Float_t fInnerRadiusLow; // lower radius of inner sector-IP
319 Float_t fInnerRadiusUp; // upper radius of inner sector-IP
320 Float_t fOuterRadiusUp; // upper radius of outer sector-IP
321 Float_t fOuterRadiusLow; // lower radius of outer sector-IP
322 Float_t fInnerAngle; //opening angle of Inner sector
323 Float_t fInnerAngleShift; //shift of first inner sector center to the 0
324 Float_t fOuterAngle; //opening angle of outer sector
325 Float_t fOuterAngleShift; //shift of first sector center to the 0
326 Float_t fInnerFrameSpace; //space for inner frame in the phi direction
327 Float_t fOuterFrameSpace; //space for outer frame in the phi direction
328 Float_t fInnerWireMount; //space for wire mount, inner sector
329 Float_t fOuterWireMount; //space for wire mount, outer sector
330 Int_t fNInnerSector; //number of inner sectors -calculated
331 Int_t fNOuterSector; //number of outer sectors -calculated
332 Int_t fNSector; // total number of sectors -calculated
333 Float_t fZLength; //length of the drift region of the TPC
334 Float_t *fRotAngle; //[fNSector] sin and cos of rotation angles for
335 // diferent sectors -calculated
336 Int_t fGeometryType; //type of geometry -0 straight rows
338 //---------------------------------------------------------------------
339 // ALICE TPC wires geometry - for GEM we can consider that it is gating
340 //--------------------------------------------------------------------
341 Int_t fNInnerWiresPerPad; //Number of wires per pad
342 Float_t fInnerWWPitch; //pitch between wires in inner sector - calculated
343 Int_t fInnerDummyWire; //number of wires without pad readout
344 Float_t fInnerOffWire; //oofset of first wire to the begining of the sector
345 Float_t fRInnerFirstWire; //position of the first wire -calculated
346 Float_t fRInnerLastWire; //position of the last wire -calculated
347 Float_t fLastWireUp1; //position of the last wire in outer1 sector
348 Int_t fNOuter1WiresPerPad; //Number of wires per pad
349 Int_t fNOuter2WiresPerPad;
350 Float_t fOuterWWPitch; //pitch between wires in outer sector -calculated
351 Int_t fOuterDummyWire; //number of wires without pad readout
352 Float_t fOuterOffWire; //oofset of first wire to the begining of the sector
353 Float_t fROuterFirstWire; //position of the first wire -calulated
354 Float_t fROuterLastWire; //position of the last wire -calculated
355 //---------------------------------------------------------------------
356 // ALICE TPC pad parameters
357 //--------------------------------------------------------------------
358 Float_t fInnerPadPitchLength; //Inner pad pitch length
359 Float_t fInnerPadPitchWidth; //Inner pad pitch width
360 Float_t fInnerPadLength; //Inner pad length
361 Float_t fInnerPadWidth; //Inner pad width
362 Float_t fOuter1PadPitchLength; //Outer pad pitch length
363 Float_t fOuter2PadPitchLength;
364 Float_t fOuterPadPitchWidth; //Outer pad pitch width
365 Float_t fOuter1PadLength; //Outer pad length
366 Float_t fOuter2PadLength;
367 Float_t fOuterPadWidth; //Outer pad width
368 Bool_t fBMWPCReadout; //indicate wire readout - kTRUE or GEM readout -kFALSE
369 Int_t fNCrossRows; //number of rows to crostalk calculation
371 Int_t fNRowLow; //number of pad rows per low sector -set
372 Int_t fNRowUp1; //number of short pad rows per sector up -set
373 Int_t fNRowUp2; //number of long pad rows per sector up -set
374 Int_t fNRowUp; //number of pad rows per sector up -calculated
375 Int_t fNtRows; //total number of rows in TPC -calculated
376 Float_t fPadRowLow[600]; //Lower sector, pad row radii -calculated
377 Float_t fPadRowUp[600]; //Upper sector, pad row radii -calculated
378 Int_t fNPadsLow[600]; //Lower sector, number of pads per row -calculated
379 Int_t fNPadsUp[600]; //Upper sector, number of pads per row -calculated
380 Float_t fYInner[600]; //Inner sector, wire-length
381 Float_t fYOuter[600]; //Outer sector, wire-length
382 //---------------------------------------------------------------------
383 // ALICE TPC Gas Parameters
384 //--------------------------------------------------------------------
385 Float_t fDiffT; //tangencial diffusion constant
386 Float_t fDiffL; //longutudinal diffusion constant
387 Float_t fGasGain; //gas gain constant
388 Float_t fDriftV; //drift velocity constant
389 Float_t fOmegaTau; //omega tau ExB coeficient
390 Float_t fAttCoef; //attachment coefitients
391 Float_t fOxyCont; //oxygen content
392 //---------------------------------------------------------------------
393 // ALICE TPC Electronics Parameters
394 //--------------------------------------------------------------------
395 Float_t fPadCoupling; //coupling factor ration of anode signal
396 //and total pads signal
397 Int_t fZeroSup; //zero suppresion constant
398 Float_t fNoise; //noise sigma constant
399 Float_t fChipGain; //preamp shaper constant
400 Float_t fChipNorm; //preamp shaper normalisation
401 Float_t fTSample; //sampling time
402 Float_t fZWidth; //derived value calculated using TSample and driftw -computed
403 Float_t fTSigma; //width of the Preamp/Shaper function
404 Int_t fMaxTBin; //maximum time bin number
405 Int_t fADCSat; //saturation value of ADC (10 bits)
406 Float_t fADCDynRange; //input dynamic range (mV)
407 Float_t fTotalNormFac; //full normalisation factor - calculated
408 Float_t fNoiseNormFac; //normalisation factor to transform noise in electron to ADC channel
412 //---------------------------------------------------------------------
413 // ALICE TPC response data
414 //---------------------------------------------------------------------
415 Int_t fNResponseMax; //maximal dimension of response
416 Float_t fResponseThreshold; //threshold for accepted response
417 Int_t fCurrentMax; //!current maximal dimension -calulated
418 Int_t *fResponseBin; //!array with bins -calulated
419 Float_t *fResponseWeight; //!array with response -calulated
421 ClassDef(AliTPCParam,3) //parameter object for set:TPC
425 inline Int_t * AliTPCParam::GetResBin(Int_t i)
427 //return response bin i - bin given by padrow [0] pad[1] timebin[2]
428 if (i<fCurrentMax) return &fResponseBin[i*3];
432 inline Float_t &AliTPCParam::GetResWeight(Int_t i)
434 //return weight of response bin i
435 if (i<fCurrentMax) return fResponseWeight[i];
436 else return fResponseWeight[i];
440 inline void AliTPCParam::AdjustCosSin(Int_t isec, Float_t &cos, Float_t &sin) const
443 //set cosinus and sinus of rotation angles for sector isec
445 cos=fRotAngle[isec*4];
446 sin=fRotAngle[isec*4+1];
449 inline Float_t AliTPCParam::GetAngle(Int_t isec) const
452 //return rotation angle of given sector
454 return fRotAngle[isec*4+2];
458 inline void AliTPCParam::Transform1to2(Float_t *xyz, Int_t *index) const
460 //transformation to rotated coordinates
461 //we must have information about sector!
463 //rotate to given sector
465 AdjustCosSin(index[1],cos,sin);
466 Float_t x1=xyz[0]*cos + xyz[1]*sin;
467 Float_t y1=-xyz[0]*sin + xyz[1]*cos;
470 xyz[2]=fZLength-TMath::Abs(xyz[2]);
474 inline void AliTPCParam::Transform2to1(Float_t *xyz, Int_t *index) const
477 //transformation from rotated coordinates to global coordinates
480 AdjustCosSin(index[1],cos,sin);
481 Float_t x1=xyz[0]*cos - xyz[1]*sin;
482 Float_t y1=xyz[0]*sin + xyz[1]*cos;
485 xyz[2]=fZLength-xyz[2];
486 if (index[1]<fNInnerSector)
487 if ( index[1]>=(fNInnerSector>>1)) xyz[2]*=-1.;
489 if ( (index[1]-fNInnerSector) > (fNOuterSector>>1) ) xyz[2]*=-1;
493 inline void AliTPCParam::Transform2to2(Float_t *xyz, Int_t *index, Int_t *oindex) const
495 //transform rotated coordinats of one sector to rotated
496 //coordinates relative to another sector
497 Transform2to1(xyz,index);
498 Transform1to2(xyz,oindex);
503 inline Float_t AliTPCParam::Transform2to2NearestWire(Float_t *xyz, Int_t *index) const
506 // asigns the x-position of the closest wire to xyz[0], return the
507 // electron to closest wire distance
510 if (index[1]<fNInnerSector) {
511 xnew = fRInnerFirstWire+TMath::Nint((xyz[0]-fRInnerFirstWire)/fInnerWWPitch)*fInnerWWPitch;
514 xnew = fROuterFirstWire+TMath::Nint((xyz[0]-fROuterFirstWire)/fOuterWWPitch)*fOuterWWPitch;
521 inline Int_t AliTPCParam::Transform2to3(Float_t *xyz, Int_t *index) const
524 //calulates coresponding pad row number, sets index[2] for straight rows
525 //does not change xyz[] information
526 //valid only for straight row
528 if (index[1]<fNInnerSector)
529 index[2] =TMath::Nint((xyz[0]-fPadRowLow[0])/fInnerPadPitchLength);
531 if (xyz[0] < fLastWireUp1 )
532 index[2] = TMath::Nint((xyz[0]-fPadRowUp[0])/fOuter1PadPitchLength);
534 index[2] = TMath::Nint(fNRowUp1+(xyz[0]-fPadRowUp[64])/fOuter2PadPitchLength);
539 inline void AliTPCParam::Transform3to4(Float_t *xyz, Int_t *index) const
542 //valid only for straight rows straight rows
543 //calculate xyz[0] position relative to given index
545 if (index[1]<fNInnerSector)
546 xyz[0] -=index[2]*fInnerPadPitchLength+fPadRowLow[0];
548 if (index[2]<fNRowUp1)
549 xyz[0] -=index[2]*fOuter1PadPitchLength+fPadRowUp[0];
551 xyz[0] -=(index[2]-fNRowUp1)*fOuter2PadPitchLength+fPadRowUp[64];
555 inline void AliTPCParam::Transform4to3(Float_t *xyz, Int_t *index) const
558 //valid only for straight rows
559 //transforms relative xyz[0] to the global one within given sector
561 if (index[1]<fNInnerSector)
562 xyz[0] +=index[2]*fInnerPadPitchLength+fPadRowLow[0];
564 if(index[2]<fNRowUp1)
565 xyz[0] +=index[2]*fOuter1PadPitchLength+fPadRowUp[0];
567 xyz[0] +=index[2]*fOuter2PadPitchLength+fPadRowUp[64];
572 inline void AliTPCParam::Transform2to5( Float_t *xyz, Int_t *index) const
575 //transform [x,y,z] to [r,phi,z]
578 Float_t r = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
579 if ((xyz[0]==0)&&(xyz[1]==0)) angle = 0;
582 angle =TMath::ASin(xyz[1]/r);
583 if (xyz[0]<0) angle=TMath::Pi()-angle;
584 if ( (xyz[0]>0) && (xyz[1]<0) ) angle=2*TMath::Pi()+angle;
591 inline void AliTPCParam::Transform5to2( Float_t *xyz, Int_t *index) const
594 //transform [r,rphi,z] to [x,y,z]
597 Float_t angle= xyz[1];
598 xyz[0]=r*TMath::Cos(angle);
599 xyz[1]=r*TMath::Sin(angle);
603 inline void AliTPCParam::Transform4to8(Float_t *xyz, Int_t *index) const
606 //transform xyz coordinates to 'digit' coordinates
610 if (index[1]<fNInnerSector) {
611 xyz[0]/=fInnerPadPitchLength;
612 xyz[1]/=fInnerPadPitchWidth;
615 xyz[1]/=fOuterPadPitchWidth;
616 if (index[2]<fNRowUp1 ) xyz[0]/=fOuter1PadPitchLength;
617 else xyz[0]/=fOuter2PadPitchLength;
622 inline void AliTPCParam::Transform8to4(Float_t *xyz, Int_t *index) const
625 //transforms 'digit' coordinates to xyz coordinates
628 if (index[1]<fNInnerSector) {
629 xyz[0]*=fInnerPadPitchLength;
630 xyz[1]*=fInnerPadPitchWidth;
633 xyz[1]*=fOuterPadPitchWidth;
634 if (index[2] < fNRowUp1 ) xyz[0]*=fOuter1PadPitchLength;
635 else xyz[0]*=fOuter2PadPitchLength;
640 inline void AliTPCParam::Transform6to8(Float_t *xyz, Int_t *index) const
643 //transforms cylindrical xyz coordinates to 'digit' coordinates
646 if (index[1]<fNInnerSector) {
647 xyz[0]/=fInnerPadPitchLength;
648 xyz[1]*=xyz[0]/fInnerPadPitchWidth;
651 xyz[1]*=xyz[0]/fOuterPadPitchWidth;
652 if (index[2] < fNRowUp1 ) xyz[0]/=fOuter1PadPitchLength;
653 else xyz[0]/=fOuter2PadPitchLength;
658 inline void AliTPCParam::Transform8to6(Float_t *xyz, Int_t *index) const
661 //transforms 'digit' coordinates to cylindrical xyz coordinates
664 if (index[1]<fNInnerSector) {
665 xyz[0]*=fInnerPadPitchLength;
666 xyz[1]/=xyz[0]/fInnerPadPitchWidth;
669 xyz[1]/=xyz[0]/fOuterPadPitchWidth;
670 if (index[2] < fNRowUp1 ) xyz[0]*=fOuter1PadPitchLength;
671 else xyz[0]*=fOuter2PadPitchLength;