]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCParam.cxx
Set higher precision magnetic field integration method,
[u/mrichter/AliRoot.git] / TPC / AliTPCParam.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 ///////////////////////////////////////////////////////////////////////
19 //  Manager and of geomety  classes for set: TPC                     //
20 //                                                                   //
21 //  !sectors are numbered from  0                                     //
22 //  !pad rows are numbered from 0                                     //
23 //  
24 //  12.6.   changed z relative 
25 //  Origin:  Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk // 
26 //                                                                   //  
27 ///////////////////////////////////////////////////////////////////////
28
29 //
30
31 #include <AliTPCParam.h>
32
33 #include <TGeoManager.h>
34 #include <TGeoPhysicalNode.h>
35 #include "AliAlignObj.h"
36 #include "AliAlignObjAngles.h"
37 #include "AliLog.h"
38
39 ClassImp(AliTPCParam)
40
41
42 //___________________________________________
43 AliTPCParam::AliTPCParam()
44 {   
45   //
46   //constructor sets the default parameters
47   //
48
49   fResponseBin = 0;
50   fResponseWeight = 0;
51   fRotAngle = 0;
52   fTrackingMatrix = fClusterMatrix = fGlobalMatrix = 0;
53   SetTitle("75x40_100x60_150x60");
54   SetDefault();  
55 }
56
57 AliTPCParam::~AliTPCParam()
58 {
59   //
60   //destructor deletes some dynamicaly alocated variables
61   //
62
63   if (fResponseBin!=0)    delete [] fResponseBin;
64   if (fResponseWeight!=0) delete [] fResponseWeight;
65   if (fRotAngle      !=0) delete [] fRotAngle;
66
67   if (fTrackingMatrix) {
68     for(Int_t i = 0; i < fNSector; i++)
69       delete fTrackingMatrix[i];
70     delete [] fTrackingMatrix;
71   }
72
73   if (fClusterMatrix) {
74     for(Int_t i = 0; i < fNSector; i++)
75       delete fClusterMatrix[i];
76     delete [] fClusterMatrix;
77   }
78
79   if (fGlobalMatrix) {
80     for(Int_t i = 0; i < fNSector; i++)
81       delete fGlobalMatrix[i];
82     delete [] fGlobalMatrix;
83   }
84
85 }
86
87
88
89
90 Int_t  AliTPCParam::Transform0to1(Float_t *xyz, Int_t * index)  const
91 {
92   //
93   // calculates sector number (index[1], undefined on input)
94   // xyz intact
95   //
96
97   Float_t angle,x1;
98   Int_t sector;
99   Float_t r = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
100   if ((xyz[0]==0)&&(xyz[1]==0)) angle = 0.;
101   else
102     {
103       angle =TMath::ASin(xyz[1]/r);
104       if   (xyz[0]<0)   angle=TMath::Pi()-angle;
105       if ( (xyz[0]>0) && (xyz[1]<0) ) angle=2*TMath::Pi()+angle;
106     }
107
108   sector=Int_t(TMath::Nint((angle-fInnerAngleShift)/fInnerAngle));      
109  
110   Float_t cos,sin;
111   AdjustCosSin(sector,cos,sin);
112   x1=xyz[0]*cos + xyz[1]*sin;
113
114   if (x1>fOuterRadiusLow)
115     {
116       sector=Int_t(TMath::Nint((angle-fOuterAngleShift)/fOuterAngle))+fNInnerSector;      
117       if (xyz[2]<0)     sector+=(fNOuterSector>>1);            
118     }
119     else   
120       if (xyz[2]<0) sector+=(fNInnerSector>>1);    
121   index[1]=sector; // calculated sector number
122   index[0]=1; // indicates system after transformation
123   return sector;
124 }
125
126 Bool_t  AliTPCParam::Transform(Float_t */*xyz*/, Int_t *index, Int_t* /*oindex*/)
127 {
128   //transformation from input coodination system to output coordination system
129   switch (index[0]){
130   case 0:
131     break;
132   };
133
134   return kFALSE;
135
136 }
137
138 Int_t AliTPCParam::GetPadRow(Float_t *xyz, Int_t *index) const 
139 {
140   //
141   //calculates pad row of point xyz - transformation to system 8 (digit system)
142   //
143   Int_t system = index[0];
144   if (0==system) {
145     Transform0to1(xyz,index); 
146     system=1;
147   }
148   if (1==system) {
149     Transform1to2(xyz,index); 
150     system=2;
151   }
152     
153   if (fGeometryType==0){ //straight row    
154     if (2==system) {
155       Transform2to3(xyz,index);       
156       system=3;
157     } 
158     if (3==system) {
159       Transform3to4(xyz,index);
160       system=4; 
161     }
162     if (4==system) {
163       Transform4to8(xyz,index);
164       system=8;     
165     }
166     if (8==system) {
167       index[0]=8;
168       return index[2];
169     } 
170   }
171
172   if (fGeometryType==1){ //cylindrical geometry    
173     if (2==system) {
174       Transform2to5(xyz,index);       
175       system=5;
176     } 
177     if (5==system) {
178       Transform2to3(xyz,index);
179       system=6;
180     }
181     if (6==system) {
182       Transform3to4(xyz,index); 
183       system=7;
184     }
185     if (8==system) {
186       index[0]=8;
187       return index[2];
188     }
189   } 
190   index[0]=system;
191   return -1; //if no reasonable system     
192 }
193
194 void  AliTPCParam::SetSectorAngles(Float_t innerangle, Float_t innershift, Float_t outerangle,
195                         Float_t outershift)
196 {
197   //
198   // set opening angles  
199   static const  Float_t  kDegtoRad = 0.01745329251994;
200   fInnerAngle = innerangle;       //opening angle of Inner sector
201   fInnerAngleShift = innershift;  //shift of first inner sector center to the 0
202   fOuterAngle = outerangle;       //opening angle of outer sector
203   fOuterAngleShift = outershift;  //shift of first sector center to the 0  
204   fInnerAngle *=kDegtoRad;
205   fInnerAngleShift *=kDegtoRad;
206   fOuterAngle *=kDegtoRad;
207   fOuterAngleShift *=kDegtoRad;
208 }
209
210 Float_t  AliTPCParam::GetInnerAngle() const
211 {
212   //return angle 
213   return fInnerAngle;
214
215 }
216
217 Float_t  AliTPCParam::GetInnerAngleShift() const
218 {  
219   //return angle   
220   return fInnerAngleShift;  
221 }
222 Float_t  AliTPCParam::GetOuterAngle() const
223
224   //return angle 
225   return fOuterAngle;
226
227 Float_t  AliTPCParam::GetOuterAngleShift() const
228
229   //return angle 
230
231      return fOuterAngleShift;
232
233
234
235 Int_t AliTPCParam::GetIndex(Int_t sector, Int_t row) const
236 {
237   //
238   //give index of the given sector and pad row 
239   //no control if the sectors and rows  are reasonable !!!
240   //
241   if (sector<fNInnerSector) return sector*fNRowLow+row;
242   return (fNInnerSector*fNRowLow)+(sector-fNInnerSector)*fNRowUp+row;  
243 }
244
245 Bool_t   AliTPCParam::AdjustSectorRow(Int_t index, Int_t & sector, Int_t &row) const
246 {
247   //
248   //return sector and padrow for given index
249   //if index is reasonable returns true else return false
250   //
251   if ( (index<0) || (index>fNtRows))  return kFALSE;
252   Int_t outindex = fNInnerSector*fNRowLow;
253   if (index<outindex) {
254     sector = index/fNRowLow;
255     row    = index - sector*fNRowLow;
256     return kTRUE;
257   }
258   index-= outindex;
259   sector = index/fNRowUp;
260   row    = index - sector*fNRowUp;
261   sector += fNInnerSector;
262   return kTRUE;         
263
264
265 void AliTPCParam::SetDefault()
266 {
267   //
268   //set default parameters
269   //
270   //const static  Int_t kMaxRows=600; 
271   //
272   //sector default parameters
273   //
274   static const  Float_t kInnerRadiusLow = 83.65;
275   static const  Float_t kInnerRadiusUp  = 133.3;
276   static const  Float_t kOuterRadiusLow = 133.5;
277   static const  Float_t kOuterRadiusUp  = 247.7;
278   static const  Float_t kInnerAngle = 20; // 20 degrees
279   static const  Float_t kInnerAngleShift = 10;
280   static const  Float_t kOuterAngle = 20; //  20 degrees
281   static const  Float_t kOuterAngleShift = 10;
282   static const  Float_t kInnerFrameSpace = 1.5;
283   static const  Float_t kOuterFrameSpace = 1.5;
284   static const  Float_t kInnerWireMount = 1.2;
285   static const  Float_t kOuterWireMount = 1.4;
286   static const  Float_t kZLength =250.;
287   static const  Int_t   kGeometryType = 0; //straight rows 
288   static const Int_t kNRowLow = 63;
289   static const Int_t kNRowUp1 = 64;
290   static const Int_t kNRowUp2 = 32;
291   static const Int_t  kNRowUp = 96;
292   //
293   //wires default parameters
294   //
295   static const Int_t    kNInnerWiresPerPad = 3;
296   static const Int_t    kInnerDummyWire = 2;
297   static const Float_t  kInnerWWPitch = 0.25;
298   static const Float_t  kRInnerFirstWire = 84.475;
299   static const Float_t  kRInnerLastWire = 132.475;
300   static const Float_t  kInnerOffWire = 0.5;
301   static const Int_t    kNOuter1WiresPerPad = 4;
302   static const Int_t    kNOuter2WiresPerPad = 6;
303   static const Float_t  kOuterWWPitch = 0.25;  
304   static const Float_t  kROuterFirstWire = 134.225;
305   static const Float_t  kROuterLastWire = 246.975;
306   static const Int_t    kOuterDummyWire = 2;
307   static const Float_t  kOuterOffWire = 0.5;
308   //
309   //pad default parameters
310   // 
311   static const Float_t  kInnerPadPitchLength = 0.75;
312   static const Float_t  kInnerPadPitchWidth = 0.40;
313   static const Float_t  kInnerPadLength = 0.75;
314   static const Float_t  kInnerPadWidth = 0.40;
315   static const Float_t  kOuter1PadPitchLength = 1.0;
316   static const Float_t  kOuterPadPitchWidth = 0.6;
317   static const Float_t  kOuter1PadLength = 1.0;
318   static const Float_t  kOuterPadWidth = 0.6;
319   static const Float_t  kOuter2PadPitchLength = 1.5;
320   static const Float_t  kOuter2PadLength = 1.5;
321
322   static const Bool_t   kBMWPCReadout = kTRUE; //MWPC readout - another possibility GEM 
323   static const Int_t    kNCrossRows = 1; //number of rows to cross-talk
324   
325   //
326   //gas default parameters
327   //
328   static const  Float_t  kDiffT = 2.2e-2; 
329   static const  Float_t  kDiffL = 2.2e-2;
330   static const  Float_t  kGasGain = 2.e4;
331   static const  Float_t  kDriftV  =2.83e6;
332   static const  Float_t  kOmegaTau = 0.145;
333   static const  Float_t  kAttCoef = 250.;
334   static const  Float_t  kOxyCont = 5.e-6;
335   //
336   //electronic default parameters
337   //
338   static const  Float_t  kPadCoupling=0.5;
339   static const  Int_t    kZeroSup=2;
340   static const  Float_t  kNoise = 1000;                            
341   static const  Float_t  kChipGain = 12;
342   static const  Float_t  kChipNorm = 0.4;
343   static const  Float_t  kTSample = 2.e-7; 
344   static const  Float_t  kTFWHM   = 1.9e-7;  //fwhm of charge distribution
345   static const  Int_t    kMaxTBin =445;  
346   static const  Int_t    kADCSat  =1024;  
347   static const  Float_t  kADCDynRange =2000.;  
348   // 
349   //response constants
350   //
351   static const Int_t     kNResponseMax=100;
352   static const Float_t   kResponseThreshold=0.01;     
353   //L1 constants
354   //  static const Float_t   kGateDelay=6.1e-6; //In s
355   static const Float_t   kGateDelay=0.; //For the moment no gating
356   //  static const Float_t   kL1Delay=6.5e-6; //In s
357   static const Float_t   kL1Delay=0.; //For the moment no delay
358   //  static const UShort_t  kNTBinsBeforeL1=14;
359   static const UShort_t  kNTBinsBeforeL1=0; //For the moment no shift
360   fbStatus = kFALSE;
361   //
362   //set sector parameters
363   //
364   SetInnerRadiusLow(kInnerRadiusLow);
365   SetOuterRadiusLow(kOuterRadiusLow);
366   SetInnerRadiusUp(kInnerRadiusUp);
367   SetOuterRadiusUp(kOuterRadiusUp);
368   SetInnerFrameSpace(kInnerFrameSpace);
369   SetOuterFrameSpace(kOuterFrameSpace);
370   SetInnerWireMount(kInnerWireMount);
371   SetOuterWireMount(kOuterWireMount);
372   SetSectorAngles(kInnerAngle,kInnerAngleShift,kOuterAngle,kOuterAngleShift);
373   SetZLength(kZLength);
374   SetGeometryType(kGeometryType);
375   SetRowNLow(kNRowLow);
376   SetRowNUp1 (kNRowUp1);
377   SetRowNUp2(kNRowUp2);
378   SetRowNUp(kNRowUp);
379   //
380   //set wire parameters
381   //
382   SetInnerNWires(kNInnerWiresPerPad);
383   SetInnerDummyWire(kInnerDummyWire);
384   SetInnerOffWire(kInnerOffWire);
385   SetOuter1NWires(kNOuter1WiresPerPad);
386   SetOuter2NWire(kNOuter2WiresPerPad);
387   SetOuterDummyWire(kOuterDummyWire);
388   SetOuterOffWire(kOuterOffWire);
389   SetInnerWWPitch(kInnerWWPitch);
390   SetRInnerFirstWire(kRInnerFirstWire);
391   SetRInnerLastWire(kRInnerLastWire);
392   SetOuterWWPitch(kOuterWWPitch);
393   SetROuterFirstWire(kROuterFirstWire);
394   SetROuterLastWire(kROuterLastWire);  
395   //
396   //set pad parameter
397   //
398   SetInnerPadPitchLength(kInnerPadPitchLength);
399   SetInnerPadPitchWidth(kInnerPadPitchWidth);
400   SetInnerPadLength(kInnerPadLength);
401   SetInnerPadWidth(kInnerPadWidth);
402   SetOuter1PadPitchLength(kOuter1PadPitchLength); 
403   SetOuter2PadPitchLength(kOuter2PadPitchLength);
404   SetOuterPadPitchWidth(kOuterPadPitchWidth);
405   SetOuter1PadLength(kOuter1PadLength);
406   SetOuter2PadLength(kOuter2PadLength);
407   SetOuterPadWidth(kOuterPadWidth); 
408   SetMWPCReadout(kBMWPCReadout);
409   SetNCrossRows(kNCrossRows);
410   //
411   //set gas paremeters
412   //
413   SetDiffT(kDiffT);
414   SetDiffL(kDiffL);
415   SetGasGain(kGasGain);
416   SetDriftV(kDriftV);
417   SetOmegaTau(kOmegaTau);
418   SetAttCoef(kAttCoef);
419   SetOxyCont(kOxyCont);
420   //
421   //set electronivc parameters  
422   //
423   SetPadCoupling(kPadCoupling);
424   SetZeroSup(kZeroSup);
425   SetNoise(kNoise);
426   SetChipGain(kChipGain);
427   SetChipNorm(kChipNorm);   
428   SetTSample(kTSample);
429   SetTFWHM(kTFWHM);
430   SetMaxTBin(kMaxTBin);
431   SetADCSat(kADCSat);
432   SetADCDynRange(kADCDynRange);
433 //   //set magnetic field
434 //   SetBField(kBField);
435 //   SetNPrimLoss(kNPrimLoss);
436 //   SetNTotalLoss(kNTotalLoss);
437   //
438   //set response  parameters  
439   //
440   SetNResponseMax(kNResponseMax); 
441   SetResponseThreshold(static_cast<int>(kResponseThreshold));
442   //L1 data
443   SetGateDelay(kGateDelay);
444   SetL1Delay(kL1Delay);
445   SetNTBinsBeforeL1(kNTBinsBeforeL1);
446 }
447
448           
449 Bool_t AliTPCParam::Update()
450 {
451   //
452   // update some calculated parameter which must be updated after changing "base"
453   // parameters 
454   // for example we can change size of pads and according this recalculate number
455   // of pad rows, number of of pads in given row ....
456   //
457   const Float_t kQel = 1.602e-19; // elementary charge
458   fbStatus = kFALSE;
459
460   Int_t i,j;  //loop variables because HP 
461   //-----------------Sector section------------------------------------------
462   //calclulate number of sectors
463   fNInnerSector = Int_t(4*TMath::Pi()/fInnerAngle+0.2); 
464        // number of inner sectors - factor 0.2 to don't be influnced by inprecision
465   if (fNInnerSector%2) return kFALSE;
466   fNOuterSector = Int_t(4*TMath::Pi()/fOuterAngle+0.2); 
467   if (fNOuterSector%2) return kFALSE;
468   fNSector  = fNInnerSector+fNOuterSector;
469
470   if (fRotAngle!=0) delete [] fRotAngle;
471   fRotAngle = new Float_t[4*fNSector];
472   //calculate sin and cosine of rotations angle     
473   //sectors angles numbering from 0
474
475   j=fNInnerSector*2;
476   Float_t angle = fInnerAngleShift; 
477   for (i=0; j<fNInnerSector*4; i+=4, j+=4 , angle +=fInnerAngle){
478     fRotAngle[i]=TMath::Cos(angle);
479     fRotAngle[i+1]=TMath::Sin(angle);
480     fRotAngle[j] =  fRotAngle[i];
481     fRotAngle[j+1] =  fRotAngle[i+1];
482     fRotAngle[i+2] =angle;
483     fRotAngle[j+2] =angle;    
484   }
485   angle = fOuterAngleShift; 
486   j=(fNInnerSector+fNOuterSector/2)*4;
487   for (i=fNInnerSector*4; j<fNSector*4; i+=4,j+=4, angle +=fOuterAngle){
488     fRotAngle[i]=TMath::Cos(angle);
489     fRotAngle[i+1]=TMath::Sin(angle);
490     fRotAngle[j] =  fRotAngle[i];
491     fRotAngle[j+1] =  fRotAngle[i+1];
492     fRotAngle[i+2] =angle;
493     fRotAngle[j+2] =angle;    
494   }
495
496   fZWidth = fTSample*fDriftV;  
497   fTotalNormFac = fPadCoupling*fChipNorm*kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
498   fNoiseNormFac = kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
499   //wire section 
500   /*  Int_t nwire;
501   Float_t wspace; //available space for wire
502   Float_t dummyspace; //dummyspace for wire
503  
504   wspace =fInnerRadiusUp-fInnerRadiusLow-2*fInnerOffWire;
505   nwire = Int_t(wspace/fInnerWWPitch);
506   wspace = Float_t(nwire)*fInnerWWPitch;
507   dummyspace =(fInnerRadiusUp-fInnerRadiusLow-wspace)/2.;  
508   wspace =fOuterRadiusUp-fOuterRadiusLow-2*fOuterOffWire;
509   nwire = Int_t(wspace/fOuterWWPitch);
510   wspace = Float_t(nwire)*fOuterWWPitch;
511   dummyspace =(fOuterRadiusUp-fOuterRadiusLow-wspace)/2.; 
512   fROuterFirstWire = fOuterRadiusLow+dummyspace;
513   fROuterLastWire = fROuterFirstWire+fOuterWWPitch*(Float_t)(nwire);
514   */
515   
516   //
517   //response data
518   //
519   if (fResponseBin==0) delete [] fResponseBin;
520   if (fResponseWeight==0) delete [] fResponseBin;
521   fResponseBin    = new Int_t[3*fNResponseMax];
522   fResponseWeight = new Float_t[fNResponseMax];
523
524   //L1 data
525   fNTBinsL1 = fL1Delay/fTSample - (Float_t)fNTBinsBeforeL1;
526   fbStatus = kTRUE;
527   return kTRUE;
528 }
529
530
531
532 Bool_t AliTPCParam::ReadGeoMatrices(){
533   //
534   //read geo matrixes
535   //
536   if (!gGeoManager){
537     AliFatal("Geo manager not initialized\n");
538   }
539   AliAlignObjAngles o;
540   //
541   if (fTrackingMatrix) delete [] fTrackingMatrix;
542   fTrackingMatrix = new TGeoHMatrix*[fNSector];
543   if (fClusterMatrix) delete [] fClusterMatrix;
544   fClusterMatrix = new TGeoHMatrix*[fNSector];
545   if (fGlobalMatrix) delete [] fGlobalMatrix;
546   fGlobalMatrix = new TGeoHMatrix*[fNSector];
547   //
548   for (Int_t isec=0; isec<fNSector; isec++) {
549     fGlobalMatrix[isec] = 0;
550     fClusterMatrix[isec]= 0;
551     fTrackingMatrix[isec]=0;   
552     AliAlignObj::ELayerID iLayer;
553     Int_t iModule;
554
555     if(isec<fNInnerSector) {
556       iLayer = AliAlignObj::kTPC1;
557       iModule = isec;
558     }
559     else {
560       iLayer = AliAlignObj::kTPC2;
561       iModule = isec - fNInnerSector;
562     }
563
564     UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
565     const char *path = AliAlignObj::GetVolPath(volid);
566     gGeoManager->cd(path);
567     TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
568     //
569     TGeoRotation mchange; 
570     mchange.RotateY(90); mchange.RotateX(90);
571     Float_t ROCcenter[3]; 
572     GetChamberCenter(isec,ROCcenter);
573     //
574     // Convert to global coordinate system
575     //
576     fGlobalMatrix[isec] = new TGeoHMatrix(*m);
577     fGlobalMatrix[isec]->Multiply(&(mchange.Inverse()));
578     TGeoTranslation center("center",-ROCcenter[0],-ROCcenter[1],-ROCcenter[2]);
579     fGlobalMatrix[isec]->Multiply(&center);
580     //
581     //  cluster correction matrix
582     //
583     fClusterMatrix[isec] = new TGeoHMatrix;
584     Double_t sectorAngle = 20.*(isec%18)+10;
585     TGeoHMatrix  rotMatrix;
586     rotMatrix.RotateZ(sectorAngle);
587     if (GetGlobalMatrix(isec)->GetTranslation()[2]>0){
588       //
589       // mirrored system 
590       //
591       TGeoRotation mirrorZ;
592       mirrorZ.SetAngles(90,0,90,90,180,0);
593       fClusterMatrix[isec]->Multiply(&mirrorZ);
594     }
595     TGeoTranslation trans(0,0,GetZLength());
596     fClusterMatrix[isec]->MultiplyLeft(&trans);
597     fClusterMatrix[isec]->MultiplyLeft((GetGlobalMatrix(isec)));        
598     fClusterMatrix[isec]->MultiplyLeft(&(rotMatrix.Inverse()));
599   }
600   return kTRUE;
601 }
602
603
604 Bool_t AliTPCParam::GetStatus() const
605 {
606   //get information about object consistency
607   return fbStatus;
608 }
609
610 Int_t AliTPCParam::GetNRowLow() const
611 {
612   //get the number of pad rows in low sector
613   return fNRowLow;
614 }
615 Int_t AliTPCParam::GetNRowUp() const
616 {
617   //get the number of pad rows in up sector
618   return fNRowUp;
619 }
620 Int_t AliTPCParam::GetNRowUp1() const
621 {
622   //get the number of pad rows in up1 sector
623   return fNRowUp1;
624 }
625 Int_t AliTPCParam::GetNRowUp2() const
626 {
627   //get the number of pad rows in up2 sector
628   return fNRowUp2;
629 }
630 Float_t AliTPCParam::GetPadRowRadiiLow(Int_t irow) const
631 {
632   //get the pad row (irow) radii
633   if ( !(irow<0) && (irow<fNRowLow) ) 
634     return  fPadRowLow[irow];
635   else
636     return 0;
637 }
638
639 Float_t AliTPCParam::GetPadRowRadiiUp(Int_t irow) const
640 {
641   //get the pad row (irow) radii
642  if ( !(irow<0) && (irow<fNRowUp) ) 
643     return  fPadRowUp[irow];
644   else
645     return 0;
646 }
647
648 Int_t AliTPCParam::GetNPadsLow(Int_t irow) const
649 {
650   //get the number of pads in row irow
651   if ( !(irow<0) && (irow<fNRowLow) ) 
652     return  fNPadsLow[irow];
653   else
654     return 0;
655 }
656
657
658 Int_t AliTPCParam::GetNPadsUp(Int_t irow) const
659 {
660   //get the number of pads in row irow
661   if ( !(irow<0) && (irow<fNRowUp) ) 
662     return  fNPadsUp[irow];
663   else
664     return 0;
665 }
666 Float_t AliTPCParam::GetYInner(Int_t irow) const
667 {
668   return fYInner[irow];
669 }
670
671
672 Float_t AliTPCParam::GetYOuter(Int_t irow) const
673 {
674   return fYOuter[irow];
675 }
676
677 Int_t AliTPCParam::GetSectorIndex(Float_t angle, Int_t row, Float_t z) const
678 {
679   // returns the sector index
680   // takes as input the angle, index of the pad row and z position
681   if(row<0) return -1;
682
683   if (angle > 2.*TMath::Pi()) angle -= 2.*TMath::Pi();
684   if (angle < 0.            ) angle += 2.*TMath::Pi();
685  
686   Int_t sector;
687   if(row<fNRowLow) {
688     sector=Int_t(TMath::Nint((angle-fInnerAngleShift)/fInnerAngle));
689     if (z<0) sector += (fNInnerSector>>1);
690   }
691   else {
692     sector=Int_t(TMath::Nint((angle-fOuterAngleShift)/fOuterAngle))+fNInnerSector;      
693     if (z<0) sector += (fNOuterSector>>1);
694   }    
695   
696   return sector;
697 }
698
699 Float_t AliTPCParam::GetChamberCenter(Int_t isec, Float_t * center) const
700 {
701   // returns the default radial position
702   // of the readout chambers
703
704   const Float_t kROCcenterIn = 110.2;
705   const Float_t kROCcenterOut = 188.45;
706
707   if (isec<fNInnerSector){
708     if (center){
709       center[0] = kROCcenterIn;
710       center[1] = 0; 
711       center[2] = -5.51; 
712     }
713     return kROCcenterIn;
714   }
715   else{
716     if (center){
717       center[0] = kROCcenterOut;
718       center[1] = 0; 
719       center[2] = -5.61; 
720     }
721     return kROCcenterOut;
722   }
723 }
724
725
726