]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCParam.cxx
Removing warnibgs (M.Ivanov)
[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 ClassImp(AliTPCParam)
34
35
36 //___________________________________________
37 AliTPCParam::AliTPCParam()
38 {   
39   //
40   //constructor sets the default parameters
41   //
42
43   fResponseBin = 0;
44   fResponseWeight = 0;
45   fRotAngle = 0;
46   SetTitle("75x40_100x60_150x60");
47   SetDefault();  
48 }
49
50 AliTPCParam::~AliTPCParam()
51 {
52   //
53   //destructor deletes some dynamicaly alocated variables
54   //
55
56   if (fResponseBin!=0)    delete [] fResponseBin;
57   if (fResponseWeight!=0) delete [] fResponseWeight;
58   if (fRotAngle      !=0) delete [] fRotAngle;
59
60 }
61
62
63
64
65 Int_t  AliTPCParam::Transform0to1(Float_t *xyz, Int_t * index)  const
66 {
67   //
68   // calculates sector number (index[1], undefined on input)
69   // xyz intact
70   //
71
72   Float_t angle,x1;
73   Int_t sector;
74   Float_t r = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
75   if ((xyz[0]==0)&&(xyz[1]==0)) angle = 0.;
76   else
77     {
78       angle =TMath::ASin(xyz[1]/r);
79       if   (xyz[0]<0)   angle=TMath::Pi()-angle;
80       if ( (xyz[0]>0) && (xyz[1]<0) ) angle=2*TMath::Pi()+angle;
81     }
82
83   sector=Int_t(TMath::Nint((angle-fInnerAngleShift)/fInnerAngle));      
84  
85   Float_t cos,sin;
86   AdjustCosSin(sector,cos,sin);
87   x1=xyz[0]*cos + xyz[1]*sin;
88
89   if (x1>fOuterRadiusLow)
90     {
91       sector=Int_t(TMath::Nint((angle-fOuterAngleShift)/fOuterAngle))+fNInnerSector;      
92       if (xyz[2]<0)     sector+=(fNOuterSector>>1);            
93     }
94     else   
95       if (xyz[2]<0) sector+=(fNInnerSector>>1);    
96   index[1]=sector; // calculated sector number
97   index[0]=1; // indicates system after transformation
98   return sector;
99 }
100
101 Bool_t  AliTPCParam::Transform(Float_t */*xyz*/, Int_t *index, Int_t* /*oindex*/)
102 {
103   //transformation from input coodination system to output coordination system
104   switch (index[0]){
105   case 0:
106     break;
107   };
108
109   return kFALSE;
110
111 }
112
113 Int_t AliTPCParam::GetPadRow(Float_t *xyz, Int_t *index) const 
114 {
115   //
116   //calculates pad row of point xyz - transformation to system 8 (digit system)
117   //
118   Int_t system = index[0];
119   if (0==system) {
120     Transform0to1(xyz,index); 
121     system=1;
122   }
123   if (1==system) {
124     Transform1to2(xyz,index); 
125     system=2;
126   }
127     
128   if (fGeometryType==0){ //straight row    
129     if (2==system) {
130       Transform2to3(xyz,index);       
131       system=3;
132     } 
133     if (3==system) {
134       Transform3to4(xyz,index);
135       system=4; 
136     }
137     if (4==system) {
138       Transform4to8(xyz,index);
139       system=8;     
140     }
141     if (8==system) {
142       index[0]=8;
143       return index[2];
144     } 
145   }
146
147   if (fGeometryType==1){ //cylindrical geometry    
148     if (2==system) {
149       Transform2to5(xyz,index);       
150       system=5;
151     } 
152     if (5==system) {
153       Transform2to3(xyz,index);
154       system=6;
155     }
156     if (6==system) {
157       Transform3to4(xyz,index); 
158       system=7;
159     }
160     if (8==system) {
161       index[0]=8;
162       return index[2];
163     }
164   } 
165   index[0]=system;
166   return -1; //if no reasonable system     
167 }
168
169 void  AliTPCParam::SetSectorAngles(Float_t innerangle, Float_t innershift, Float_t outerangle,
170                         Float_t outershift)
171 {
172   //
173   // set opening angles  
174   static const  Float_t  kDegtoRad = 0.01745329251994;
175   fInnerAngle = innerangle;       //opening angle of Inner sector
176   fInnerAngleShift = innershift;  //shift of first inner sector center to the 0
177   fOuterAngle = outerangle;       //opening angle of outer sector
178   fOuterAngleShift = outershift;  //shift of first sector center to the 0  
179   fInnerAngle *=kDegtoRad;
180   fInnerAngleShift *=kDegtoRad;
181   fOuterAngle *=kDegtoRad;
182   fOuterAngleShift *=kDegtoRad;
183 }
184
185 Float_t  AliTPCParam::GetInnerAngle() const
186 {
187   //return angle 
188   return fInnerAngle;
189
190 }
191
192 Float_t  AliTPCParam::GetInnerAngleShift() const
193 {  
194   //return angle   
195   return fInnerAngleShift;  
196 }
197 Float_t  AliTPCParam::GetOuterAngle() const
198
199   //return angle 
200   return fOuterAngle;
201
202 Float_t  AliTPCParam::GetOuterAngleShift() const
203
204   //return angle 
205
206      return fOuterAngleShift;
207
208
209
210 Int_t AliTPCParam::GetIndex(Int_t sector, Int_t row) const
211 {
212   //
213   //give index of the given sector and pad row 
214   //no control if the sectors and rows  are reasonable !!!
215   //
216   if (sector<fNInnerSector) return sector*fNRowLow+row;
217   return (fNInnerSector*fNRowLow)+(sector-fNInnerSector)*fNRowUp+row;  
218 }
219
220 Bool_t   AliTPCParam::AdjustSectorRow(Int_t index, Int_t & sector, Int_t &row) const
221 {
222   //
223   //return sector and padrow for given index
224   //if index is reasonable returns true else return false
225   //
226   if ( (index<0) || (index>fNtRows))  return kFALSE;
227   Int_t outindex = fNInnerSector*fNRowLow;
228   if (index<outindex) {
229     sector = index/fNRowLow;
230     row    = index - sector*fNRowLow;
231     return kTRUE;
232   }
233   index-= outindex;
234   sector = index/fNRowUp;
235   row    = index - sector*fNRowUp;
236   sector += fNInnerSector;
237   return kTRUE;         
238
239
240 void AliTPCParam::SetDefault()
241 {
242   //
243   //set default parameters
244   //
245   //const static  Int_t kMaxRows=600; 
246   //
247   //sector default parameters
248   //
249   static const  Float_t kInnerRadiusLow = 82.97;
250   static const  Float_t kInnerRadiusUp  = 133.17;
251   static const  Float_t kOuterRadiusLow = 133.58;
252   static const  Float_t kOuterRadiusUp  = 247.78;
253   static const  Float_t kInnerAngle = 20; // 20 degrees
254   static const  Float_t kInnerAngleShift = 10;
255   static const  Float_t kOuterAngle = 20; //  20 degrees
256   static const  Float_t kOuterAngleShift = 10;
257   static const  Float_t kInnerFrameSpace = 1.5;
258   static const  Float_t kOuterFrameSpace = 1.5;
259   static const  Float_t kInnerWireMount = 1.370825926;
260   static const  Float_t kOuterWireMount = 1.370825926;
261   static const  Float_t kZLength =250.;
262   static const  Int_t   kGeometryType = 0; //straight rows 
263   static const Int_t kNRowLow = 63;
264   static const Int_t kNRowUp1 = 64;
265   static const Int_t kNRowUp2 = 32;
266   static const Int_t  kNRowUp = 96;
267   //
268   //wires default parameters
269   //
270   static const Int_t    kNInnerWiresPerPad = 3;
271   static const Int_t    kInnerDummyWire = 2;
272   static const Float_t  kInnerWWPitch = 0.25;
273   static const Float_t  kRInnerFirstWire = 84.445;
274   static const Float_t  kRInnerLastWire = 132.445;
275   static const Float_t  kInnerOffWire = 0.5;
276   static const Int_t    kNOuter1WiresPerPad = 4;
277   static const Int_t    kNOuter2WiresPerPad = 6;
278   static const Float_t  kOuterWWPitch = 0.25;  
279   static const Float_t  kROuterFirstWire = 134.305;
280   static const Float_t  kROuterLastWire = 247.055;
281   static const Int_t    kOuterDummyWire = 2;
282   static const Float_t  kOuterOffWire = 0.5;
283   //
284   //pad default parameters
285   // 
286   static const Float_t  kInnerPadPitchLength = 0.75;
287   static const Float_t  kInnerPadPitchWidth = 0.40;
288   static const Float_t  kInnerPadLength = 0.75;
289   static const Float_t  kInnerPadWidth = 0.40;
290   static const Float_t  kOuter1PadPitchLength = 1.0;
291   static const Float_t  kOuterPadPitchWidth = 0.6;
292   static const Float_t  kOuter1PadLength = 1.0;
293   static const Float_t  kOuterPadWidth = 0.6;
294   static const Float_t  kOuter2PadPitchLength = 1.5;
295   static const Float_t  kOuter2PadLength = 1.5;
296
297   static const Bool_t   kBMWPCReadout = kTRUE; //MWPC readout - another possibility GEM 
298   static const Int_t    kNCrossRows = 1; //number of rows to cross-talk
299   
300   //
301   //gas default parameters
302   //
303   static const  Float_t  kDiffT = 2.2e-2; 
304   static const  Float_t  kDiffL = 2.2e-2;
305   static const  Float_t  kGasGain = 2.e4;
306   static const  Float_t  kDriftV  =2.83e6;
307   static const  Float_t  kOmegaTau = 0.145;
308   static const  Float_t  kAttCoef = 250.;
309   static const  Float_t  kOxyCont = 5.e-6;
310   //
311   //electronic default parameters
312   //
313   static const  Float_t  kPadCoupling=0.5;
314   static const  Int_t    kZeroSup=2;
315   static const  Float_t  kNoise = 1000;                            
316   static const  Float_t  kChipGain = 12;
317   static const  Float_t  kChipNorm = 0.4;
318   static const  Float_t  kTSample = 2.e-7; 
319   static const  Float_t  kTFWHM   = 1.9e-7;  //fwhm of charge distribution
320   static const  Int_t    kMaxTBin =445;  
321   static const  Int_t    kADCSat  =1024;  
322   static const  Float_t  kADCDynRange =2000.;  
323   //
324   //
325   //
326   static const  Float_t kBField =0.2; 
327   static const  Float_t kNPrimLoss =10.9;
328   static const  Float_t kNTotalLoss =39.9;
329   // 
330   //response constants
331   //
332   static const Int_t     kNResponseMax=100;
333   static const Float_t   kResponseThreshold=0.01;     
334   fbStatus = kFALSE;
335   //
336   //set sector parameters
337   //
338   SetInnerRadiusLow(kInnerRadiusLow);
339   SetOuterRadiusLow(kOuterRadiusLow);
340   SetInnerRadiusUp(kInnerRadiusUp);
341   SetOuterRadiusUp(kOuterRadiusUp);
342   SetInnerFrameSpace(kInnerFrameSpace);
343   SetOuterFrameSpace(kOuterFrameSpace);
344   SetInnerWireMount(kInnerWireMount);
345   SetOuterWireMount(kOuterWireMount);
346   SetSectorAngles(kInnerAngle,kInnerAngleShift,kOuterAngle,kOuterAngleShift);
347   SetZLength(kZLength);
348   SetGeometryType(kGeometryType);
349   SetRowNLow(kNRowLow);
350   SetRowNUp1 (kNRowUp1);
351   SetRowNUp2(kNRowUp2);
352   SetRowNUp(kNRowUp);
353   //
354   //set wire parameters
355   //
356   SetInnerNWires(kNInnerWiresPerPad);
357   SetInnerDummyWire(kInnerDummyWire);
358   SetInnerOffWire(kInnerOffWire);
359   SetOuter1NWires(kNOuter1WiresPerPad);
360   SetOuter2NWire(kNOuter2WiresPerPad);
361   SetOuterDummyWire(kOuterDummyWire);
362   SetOuterOffWire(kOuterOffWire);
363   SetInnerWWPitch(kInnerWWPitch);
364   SetRInnerFirstWire(kRInnerFirstWire);
365   SetRInnerLastWire(kRInnerLastWire);
366   SetOuterWWPitch(kOuterWWPitch);
367   SetROuterFirstWire(kROuterFirstWire);
368   SetROuterLastWire(kROuterLastWire);  
369   //
370   //set pad parameter
371   //
372   SetInnerPadPitchLength(kInnerPadPitchLength);
373   SetInnerPadPitchWidth(kInnerPadPitchWidth);
374   SetInnerPadLength(kInnerPadLength);
375   SetInnerPadWidth(kInnerPadWidth);
376   SetOuter1PadPitchLength(kOuter1PadPitchLength); 
377   SetOuter2PadPitchLength(kOuter2PadPitchLength);
378   SetOuterPadPitchWidth(kOuterPadPitchWidth);
379   SetOuter1PadLength(kOuter1PadLength);
380   SetOuter2PadLength(kOuter2PadLength);
381   SetOuterPadWidth(kOuterPadWidth); 
382   SetMWPCReadout(kBMWPCReadout);
383   SetNCrossRows(kNCrossRows);
384   //
385   //set gas paremeters
386   //
387   SetDiffT(kDiffT);
388   SetDiffL(kDiffL);
389   SetGasGain(kGasGain);
390   SetDriftV(kDriftV);
391   SetOmegaTau(kOmegaTau);
392   SetAttCoef(kAttCoef);
393   SetOxyCont(kOxyCont);
394   //
395   //set electronivc parameters  
396   //
397   SetPadCoupling(kPadCoupling);
398   SetZeroSup(kZeroSup);
399   SetNoise(kNoise);
400   SetChipGain(kChipGain);
401   SetChipNorm(kChipNorm);   
402   SetTSample(kTSample);
403   SetTFWHM(kTFWHM);
404   SetMaxTBin(kMaxTBin);
405   SetADCSat(kADCSat);
406   SetADCDynRange(kADCDynRange);
407   //set magnetic field
408   SetBField(kBField);
409   SetNPrimLoss(kNPrimLoss);
410   SetNTotalLoss(kNTotalLoss);
411   //
412   //set response  parameters  
413   //
414   SetNResponseMax(kNResponseMax); 
415   SetResponseThreshold(static_cast<int>(kResponseThreshold));
416 }
417
418           
419 Bool_t AliTPCParam::Update()
420 {
421   //
422   // update some calculated parameter which must be updated after changing "base"
423   // parameters 
424   // for example we can change size of pads and according this recalculate number
425   // of pad rows, number of of pads in given row ....
426   //
427   const Float_t kQel = 1.602e-19; // elementary charge
428   fbStatus = kFALSE;
429
430   Int_t i,j;  //loop variables because HP 
431   //-----------------Sector section------------------------------------------
432   //calclulate number of sectors
433   fNInnerSector = Int_t(4*TMath::Pi()/fInnerAngle+0.2); 
434        // number of inner sectors - factor 0.2 to don't be influnced by inprecision
435   if (fNInnerSector%2) return kFALSE;
436   fNOuterSector = Int_t(4*TMath::Pi()/fOuterAngle+0.2); 
437   if (fNOuterSector%2) return kFALSE;
438   fNSector  = fNInnerSector+fNOuterSector;
439
440   if (fRotAngle!=0) delete [] fRotAngle;
441   fRotAngle = new Float_t[4*fNSector];
442   //calculate sin and cosine of rotations angle     
443   //sectors angles numbering from 0
444
445   j=fNInnerSector*2;
446   Float_t angle = fInnerAngleShift; 
447   for (i=0; j<fNInnerSector*4; i+=4, j+=4 , angle +=fInnerAngle){
448     fRotAngle[i]=TMath::Cos(angle);
449     fRotAngle[i+1]=TMath::Sin(angle);
450     fRotAngle[j] =  fRotAngle[i];
451     fRotAngle[j+1] =  fRotAngle[i+1];
452     fRotAngle[i+2] =angle;
453     fRotAngle[j+2] =angle;    
454   }
455   angle = fOuterAngleShift; 
456   j=(fNInnerSector+fNOuterSector/2)*4;
457   for (i=fNInnerSector*4; j<fNSector*4; i+=4,j+=4, angle +=fOuterAngle){
458     fRotAngle[i]=TMath::Cos(angle);
459     fRotAngle[i+1]=TMath::Sin(angle);
460     fRotAngle[j] =  fRotAngle[i];
461     fRotAngle[j+1] =  fRotAngle[i+1];
462     fRotAngle[i+2] =angle;
463     fRotAngle[j+2] =angle;    
464   }
465   fZWidth = fTSample*fDriftV;  
466   fTotalNormFac = fPadCoupling*fChipNorm*kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
467   fNoiseNormFac = kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
468   //wire section 
469   /*  Int_t nwire;
470   Float_t wspace; //available space for wire
471   Float_t dummyspace; //dummyspace for wire
472  
473   wspace =fInnerRadiusUp-fInnerRadiusLow-2*fInnerOffWire;
474   nwire = Int_t(wspace/fInnerWWPitch);
475   wspace = Float_t(nwire)*fInnerWWPitch;
476   dummyspace =(fInnerRadiusUp-fInnerRadiusLow-wspace)/2.;  
477   wspace =fOuterRadiusUp-fOuterRadiusLow-2*fOuterOffWire;
478   nwire = Int_t(wspace/fOuterWWPitch);
479   wspace = Float_t(nwire)*fOuterWWPitch;
480   dummyspace =(fOuterRadiusUp-fOuterRadiusLow-wspace)/2.; 
481   fROuterFirstWire = fOuterRadiusLow+dummyspace;
482   fROuterLastWire = fROuterFirstWire+fOuterWWPitch*(Float_t)(nwire);
483   */
484   
485   //
486   //response data
487   //
488   if (fResponseBin==0) delete [] fResponseBin;
489   if (fResponseWeight==0) delete [] fResponseBin;
490   fResponseBin    = new Int_t[3*fNResponseMax];
491   fResponseWeight = new Float_t[fNResponseMax];
492   
493   fbStatus = kTRUE;
494   return kTRUE;
495 }
496
497
498
499 Bool_t AliTPCParam::GetStatus() const
500 {
501   //get information about object consistency
502   return fbStatus;
503 }
504
505 Int_t AliTPCParam::GetNRowLow() const
506 {
507   //get the number of pad rows in low sector
508   return fNRowLow;
509 }
510 Int_t AliTPCParam::GetNRowUp() const
511 {
512   //get the number of pad rows in up sector
513   return fNRowUp;
514 }
515 Int_t AliTPCParam::GetNRowUp1() const
516 {
517   //get the number of pad rows in up1 sector
518   return fNRowUp1;
519 }
520 Int_t AliTPCParam::GetNRowUp2() const
521 {
522   //get the number of pad rows in up2 sector
523   return fNRowUp2;
524 }
525 Float_t AliTPCParam::GetPadRowRadiiLow(Int_t irow) const
526 {
527   //get the pad row (irow) radii
528   if ( !(irow<0) && (irow<fNRowLow) ) 
529     return  fPadRowLow[irow];
530   else
531     return 0;
532 }
533
534 Float_t AliTPCParam::GetPadRowRadiiUp(Int_t irow) const
535 {
536   //get the pad row (irow) radii
537  if ( !(irow<0) && (irow<fNRowUp) ) 
538     return  fPadRowUp[irow];
539   else
540     return 0;
541 }
542
543 Int_t AliTPCParam::GetNPadsLow(Int_t irow) const
544 {
545   //get the number of pads in row irow
546   if ( !(irow<0) && (irow<fNRowLow) ) 
547     return  fNPadsLow[irow];
548   else
549     return 0;
550 }
551
552
553 Int_t AliTPCParam::GetNPadsUp(Int_t irow) const
554 {
555   //get the number of pads in row irow
556   if ( !(irow<0) && (irow<fNRowUp) ) 
557     return  fNPadsUp[irow];
558   else
559     return 0;
560 }
561 Float_t AliTPCParam::GetYInner(Int_t irow) const
562 {
563   return fYInner[irow];
564 }
565
566
567 Float_t AliTPCParam::GetYOuter(Int_t irow) const
568 {
569   return fYOuter[irow];
570 }
571
572
573
574
575
576
577
578