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