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