1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.10 2000/07/10 20:57:39 hristov
19 Update of TPC code and macros by M.Kowalski
21 Revision 1.9 2000/06/30 12:07:50 kowal2
22 Updated from the TPC-PreRelease branch
24 Revision 1.8.4.4 2000/06/26 07:39:42 kowal2
25 Changes to obey the coding rules
27 Revision 1.8.4.3 2000/06/25 08:38:41 kowal2
28 Splitted from AliTPCtracking
30 Revision 1.8.4.2 2000/06/14 16:48:24 kowal2
31 Parameter setting improved. Removed compiler warnings
33 Revision 1.8.4.1 2000/06/09 07:12:21 kowal2
37 Revision 1.8 2000/04/17 09:37:33 kowal2
38 removed obsolete AliTPCDigitsDisplay.C
40 Revision 1.7.8.2 2000/04/10 08:44:51 kowal2
42 New transformations added
43 Different pad and pad-rows geometries for different sectors
45 Revision 1.7.8.1 2000/04/10 07:56:53 kowal2
46 Not used anymore - removed
48 Revision 1.7 1999/10/08 13:10:35 fca
49 Values in SetDefault are in radiants
51 Revision 1.6 1999/10/08 06:27:59 fca
54 Revision 1.5 1999/10/05 17:18:27 fca
55 Correct GetWire check on even/odd fnWires
57 Revision 1.4 1999/09/29 09:24:34 fca
58 Introduction of the Copyright and cvs Log
62 ///////////////////////////////////////////////////////////////////////
63 // Manager and of geomety classes for set: TPC //
65 // !sectors are numbered from 0 //
66 // !pad rows are numbered from 0 //
68 // 12.6. changed z relative
69 // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
71 ///////////////////////////////////////////////////////////////////////
79 #include <AliTPCParam.h>
87 //___________________________________________
88 AliTPCParam::AliTPCParam()
91 //constructor sets the default parameters
97 SetTitle("75x40_100x60");
101 AliTPCParam::~AliTPCParam()
104 //destructor deletes some dynamicaly alocated variables
107 if (fResponseBin!=0) delete [] fResponseBin;
108 if (fResponseWeight!=0) delete [] fResponseWeight;
109 if (fRotAngle !=0) delete [] fRotAngle;
116 Int_t AliTPCParam::Transform0to1(Float_t *xyz, Int_t * index) const
119 // calculates sector number (index[1], undefined on input)
125 Float_t r = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
126 if ((xyz[0]==0)&&(xyz[1]==0)) angle = 0.;
129 angle =TMath::ASin(xyz[1]/r);
130 if (xyz[0]<0) angle=TMath::Pi()-angle;
131 if ( (xyz[0]>0) && (xyz[1]<0) ) angle=2*TMath::Pi()+angle;
134 sector=Int_t((angle-fInnerAngleShift)/fInnerAngle);
137 AdjustCosSin(sector,cos,sin);
138 x1=xyz[0]*cos + xyz[1]*sin;
140 if (x1>fOuterRadiusLow)
142 sector=Int_t((angle-fOuterAngleShift)/fOuterAngle)+fNInnerSector;
143 if (xyz[2]<0) sector+=(fNOuterSector>>1);
146 if (xyz[2]<0) sector+=(fNInnerSector>>1);
147 index[1]=sector; // calculated sector number
148 index[0]=1; // indicates system after transformation
152 Bool_t AliTPCParam::Transform(Float_t *xyz, Int_t *index, Int_t* oindex)
154 //transformation from input coodination system to output coordination system
164 Int_t AliTPCParam::GetPadRow(Float_t *xyz, Int_t *index) const
167 //calculates pad row of point xyz - transformation to system 8 (digit system)
169 Int_t system = index[0];
171 Transform0to1(xyz,index);
175 Transform1to2(xyz,index);
179 if (fGeometryType==0){ //straight row
181 Transform2to3(xyz,index);
185 Transform3to4(xyz,index);
189 Transform4to8(xyz,index);
198 if (fGeometryType==1){ //cylindrical geometry
200 Transform2to5(xyz,index);
204 Transform2to3(xyz,index);
208 Transform3to4(xyz,index);
217 return -1; //if no reasonable system
220 void AliTPCParam::SetSectorAngles(Float_t innerangle, Float_t innershift, Float_t outerangle,
224 // set opening angles
225 const static Float_t kDegtoRad = 0.01745329251994;
226 fInnerAngle = innerangle; //opening angle of Inner sector
227 fInnerAngleShift = innershift; //shift of first inner sector center to the 0
228 fOuterAngle = outerangle; //opening angle of outer sector
229 fOuterAngleShift = outershift; //shift of first sector center to the 0
230 fInnerAngle *=kDegtoRad;
231 fInnerAngleShift *=kDegtoRad;
232 fOuterAngle *=kDegtoRad;
233 fOuterAngleShift *=kDegtoRad;
236 Float_t AliTPCParam::GetInnerAngle() const
243 Float_t AliTPCParam::GetInnerAngleShift() const
246 return fInnerAngleShift;
248 Float_t AliTPCParam::GetOuterAngle() const
253 Float_t AliTPCParam::GetOuterAngleShift() const
257 return fOuterAngleShift;
261 Int_t AliTPCParam::GetIndex(Int_t sector, Int_t row)
264 //give index of the given sector and pad row
265 //no control if the sectors and rows are reasonable !!!
267 if (sector<fNInnerSector) return sector*fNRowLow+row;
268 return (fNInnerSector*fNRowLow)+(sector-fNInnerSector)*fNRowUp+row;
271 Bool_t AliTPCParam::AdjustSectorRow(Int_t index, Int_t & sector, Int_t &row) const
274 //return sector and padrow for given index
275 //if index is reasonable returns true else return false
277 if ( (index<0) || (index>fNtRows)) return kFALSE;
278 Int_t outindex = fNInnerSector*fNRowLow;
279 if (index<outindex) {
280 sector = index/fNRowLow;
281 row = index - sector*fNRowLow;
285 sector = index/fNRowUp;
286 row = index - sector*fNRowUp;
287 sector += fNInnerSector;
291 void AliTPCParam::SetDefault()
294 //set default parameters
296 //const static Int_t kMaxRows=600;
298 //sector default parameters
300 const static Float_t kInnerRadiusLow = 82.97;
301 const static Float_t kOuterRadiusLow = 133.58;
302 const static Float_t kInnerRadiusUp = 133.17;
303 const static Float_t kOuterRadiusUp = 247.78;
304 const static Float_t kInnerAngle = 20; // 20 degrees
305 const static Float_t kInnerAngleShift = 10;
306 const static Float_t kOuterAngle = 20; // 20 degrees
307 const static Float_t kOuterAngleShift = 10;
308 const static Float_t kInnerFrameSpace = 1.5;
309 const static Float_t kOuterFrameSpace = 1.5;
310 const static Float_t kInnerWireMount = 1.370825926;
311 const static Float_t kOuterWireMount = 1.370825926;
312 const static Float_t kZLength =250.;
313 const static Int_t kGeometryType = 0; //straight rows
315 //wires default parameters
317 const static Int_t kNInnerWiresPerPad = 3;
318 const static Int_t kInnerDummyWire = 2;
319 const static Float_t kInnerOffWire = 0.5;
320 const static Int_t kNOuterWiresPerPad = 4;
321 const static Int_t kOuterDummyWire = 2;
322 const static Float_t kOuterOffWire = 0.5;
324 //pad default parameters
326 const static Float_t kInnerPadPitchLength = 0.75;
327 const static Float_t kInnerPadPitchWidth = 0.40;
328 const static Float_t kInnerPadLength = 0.75;
329 const static Float_t kInnerPadWidth = 0.40;
330 const static Float_t kOuterPadPitchLength = 1.0;
331 const static Float_t kOuterPadPitchWidth = 0.6;
332 const static Float_t kOuterPadLength = 1.0;
333 const static Float_t kOuterPadWidth = 0.6;
334 const static Bool_t kBMWPCReadout = kTRUE; //MWPC readout - another possibility GEM
335 const static Int_t kNCrossRows = 1; //number of rows to cross-talk
338 //gas default parameters
340 const static Float_t kDiffT = 2.2e-2;
341 const static Float_t kDiffL = 2.2e-2;
342 const static Float_t kGasGain = 2.e4;
343 const static Float_t kDriftV =2.83e6;
344 const static Float_t kOmegaTau = 0.145;
345 const static Float_t kAttCoef = 250.;
346 const static Float_t kOxyCont = 5.e-6;
348 //electronic default parameters
350 const static Float_t kPadCoupling=0.5;
351 const static Int_t kZeroSup=2;
352 const static Float_t kNoise = 1000;
353 const static Float_t kChipGain = 12;
354 const static Float_t kChipNorm = 0.4;
355 const static Float_t kTSample = 2.e-7;
356 const static Float_t kTFWHM = 1.9e-7; //fwhm of charge distribution
357 const static Int_t kMaxTBin =445;
358 const static Int_t kADCSat =1024;
359 const static Float_t kADCDynRange =2000.;
363 const static Float_t kBField =0.2;
364 const static Float_t kNPrimLoss =10.9;
365 const static Float_t kNTotalLoss =39.9;
369 const static Int_t kNResponseMax=100;
370 const static Float_t kResponseThreshold=0.01;
373 //set sector parameters
375 SetInnerRadiusLow(kInnerRadiusLow);
376 SetOuterRadiusLow(kOuterRadiusLow);
377 SetInnerRadiusUp(kInnerRadiusUp);
378 SetOuterRadiusUp(kOuterRadiusUp);
379 SetInnerFrameSpace(kInnerFrameSpace);
380 SetOuterFrameSpace(kOuterFrameSpace);
381 SetInnerWireMount(kInnerWireMount);
382 SetOuterWireMount(kOuterWireMount);
383 SetSectorAngles(kInnerAngle,kInnerAngleShift,kOuterAngle,kOuterAngleShift);
384 SetZLength(kZLength);
385 SetGeometryType(kGeometryType);
387 //set wire parameters
389 SetInnerNWires(kNInnerWiresPerPad);
390 SetInnerDummyWire(kInnerDummyWire);
391 SetInnerOffWire(kInnerOffWire);
392 SetOuterNWires(kNOuterWiresPerPad);
393 SetOuterDummyWire(kOuterDummyWire);
394 SetOuterOffWire(kOuterOffWire);
398 SetInnerPadPitchLength(kInnerPadPitchLength);
399 SetInnerPadPitchWidth(kInnerPadPitchWidth);
400 SetInnerPadLength(kInnerPadLength);
401 SetInnerPadWidth(kInnerPadWidth);
402 SetOuterPadPitchLength(kOuterPadPitchLength);
403 SetOuterPadPitchWidth(kOuterPadPitchWidth);
404 SetOuterPadLength(kOuterPadLength);
405 SetOuterPadWidth(kOuterPadWidth);
406 SetMWPCReadout(kBMWPCReadout);
407 SetNCrossRows(kNCrossRows);
413 SetGasGain(kGasGain);
415 SetOmegaTau(kOmegaTau);
416 SetAttCoef(kAttCoef);
417 SetOxyCont(kOxyCont);
419 //set electronivc parameters
421 SetPadCoupling(kPadCoupling);
422 SetZeroSup(kZeroSup);
424 SetChipGain(kChipGain);
425 SetChipNorm(kChipNorm);
426 SetTSample(kTSample);
428 SetMaxTBin(kMaxTBin);
430 SetADCDynRange(kADCDynRange);
433 SetNPrimLoss(kNPrimLoss);
434 SetNTotalLoss(kNTotalLoss);
436 //set response parameters
438 SetNResponseMax(kNResponseMax);
439 SetResponseThreshold(kResponseThreshold);
443 Bool_t AliTPCParam::Update()
446 // update some calculated parameter which must be updated after changing "base"
448 // for example we can change size of pads and according this recalculate number
449 // of pad rows, number of of pads in given row ....
451 const Float_t kQel = 1.602e-19; // elementary charge
454 Int_t i,j; //loop variables because HP
455 //-----------------Sector section------------------------------------------
456 //calclulate number of sectors
457 fNInnerSector = Int_t(4*TMath::Pi()/fInnerAngle+0.2);
458 // number of inner sectors - factor 0.2 to don't be influnced by inprecision
459 if (fNInnerSector%2) return kFALSE;
460 fNOuterSector = Int_t(4*TMath::Pi()/fOuterAngle+0.2);
461 if (fNOuterSector%2) return kFALSE;
462 fNSector = fNInnerSector+fNOuterSector;
464 if (fRotAngle!=0) delete [] fRotAngle;
465 fRotAngle = new Float_t[4*fNSector];
466 //calculate sin and cosine of rotations angle
467 //sectors angles numbering from 0
470 Float_t angle = fInnerAngleShift;
471 for (i=0; j<fNInnerSector*4; i+=4, j+=4 , angle +=fInnerAngle){
472 fRotAngle[i]=TMath::Cos(angle);
473 fRotAngle[i+1]=TMath::Sin(angle);
474 fRotAngle[j] = fRotAngle[i];
475 fRotAngle[j+1] = fRotAngle[i+1];
476 fRotAngle[i+2] =angle;
477 fRotAngle[j+2] =angle;
479 angle = fOuterAngleShift;
480 j=(fNInnerSector+fNOuterSector/2)*4;
481 for (i=fNInnerSector*4; j<fNSector*4; i+=4,j+=4, angle +=fOuterAngle){
482 fRotAngle[i]=TMath::Cos(angle);
483 fRotAngle[i+1]=TMath::Sin(angle);
484 fRotAngle[j] = fRotAngle[i];
485 fRotAngle[j+1] = fRotAngle[i+1];
486 fRotAngle[i+2] =angle;
487 fRotAngle[j+2] =angle;
489 fZWidth = fTSample*fDriftV;
490 fTotalNormFac = fPadCoupling*fChipNorm*kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
491 fNoiseNormFac = kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
494 Float_t wspace; //available space for wire
495 Float_t dummyspace; //dummyspace for wire
497 fInnerWWPitch = Float_t((Double_t)fInnerPadPitchLength/(Double_t)fNInnerWiresPerPad);
498 wspace =fInnerRadiusUp-fInnerRadiusLow-2*fInnerOffWire;
499 nwire = Int_t(wspace/fInnerWWPitch);
500 wspace = Float_t(nwire)*fInnerWWPitch;
501 dummyspace =(fInnerRadiusUp-fInnerRadiusLow-wspace)/2.;
502 fRInnerFirstWire = fInnerRadiusLow+dummyspace;
503 fRInnerLastWire = fRInnerFirstWire+fInnerWWPitch*(Float_t)(nwire);
505 fOuterWWPitch = Float_t((Double_t)fOuterPadPitchLength/(Double_t)fNOuterWiresPerPad);
506 wspace =fOuterRadiusUp-fOuterRadiusLow-2*fOuterOffWire;
507 nwire = Int_t(wspace/fOuterWWPitch);
508 wspace = Float_t(nwire)*fOuterWWPitch;
509 dummyspace =(fOuterRadiusUp-fOuterRadiusLow-wspace)/2.;
510 fROuterFirstWire = fOuterRadiusLow+dummyspace;
511 fROuterLastWire = fROuterFirstWire+fOuterWWPitch*(Float_t)(nwire);
517 if (fResponseBin==0) delete [] fResponseBin;
518 if (fResponseWeight==0) delete [] fResponseBin;
519 fResponseBin = new Int_t[3*fNResponseMax];
520 fResponseWeight = new Float_t[fNResponseMax];
528 Bool_t AliTPCParam::GetStatus()
530 //get information about object consistency
534 Int_t AliTPCParam::GetNRowLow() const
536 //get the number of pad rows in low sector
539 Int_t AliTPCParam::GetNRowUp() const
541 //get the number of pad rows in up sector
544 Float_t AliTPCParam::GetPadRowRadiiLow(Int_t irow) const
546 //get the pad row (irow) radii
547 if ( !(irow<0) && (irow<fNRowLow) )
548 return fPadRowLow[irow];
553 Float_t AliTPCParam::GetPadRowRadiiUp(Int_t irow) const
555 //get the pad row (irow) radii
556 if ( !(irow<0) && (irow<fNRowUp) )
557 return fPadRowUp[irow];
562 Int_t AliTPCParam::GetNPadsLow(Int_t irow) const
564 //get the number of pads in row irow
565 if ( !(irow<0) && (irow<fNRowLow) )
566 return fNPadsLow[irow];
572 Int_t AliTPCParam::GetNPadsUp(Int_t irow) const
574 //get the number of pads in row irow
575 if ( !(irow<0) && (irow<fNRowUp) )
576 return fNPadsUp[irow];