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.11 2000/11/02 07:33:48 kowal2
19 Automatic streamer generation.
21 Revision 1.10 2000/07/10 20:57:39 hristov
22 Update of TPC code and macros by M.Kowalski
24 Revision 1.9 2000/06/30 12:07:50 kowal2
25 Updated from the TPC-PreRelease branch
27 Revision 1.8.4.4 2000/06/26 07:39:42 kowal2
28 Changes to obey the coding rules
30 Revision 1.8.4.3 2000/06/25 08:38:41 kowal2
31 Splitted from AliTPCtracking
33 Revision 1.8.4.2 2000/06/14 16:48:24 kowal2
34 Parameter setting improved. Removed compiler warnings
36 Revision 1.8.4.1 2000/06/09 07:12:21 kowal2
40 Revision 1.8 2000/04/17 09:37:33 kowal2
41 removed obsolete AliTPCDigitsDisplay.C
43 Revision 1.7.8.2 2000/04/10 08:44:51 kowal2
45 New transformations added
46 Different pad and pad-rows geometries for different sectors
48 Revision 1.7.8.1 2000/04/10 07:56:53 kowal2
49 Not used anymore - removed
51 Revision 1.7 1999/10/08 13:10:35 fca
52 Values in SetDefault are in radiants
54 Revision 1.6 1999/10/08 06:27:59 fca
57 Revision 1.5 1999/10/05 17:18:27 fca
58 Correct GetWire check on even/odd fnWires
60 Revision 1.4 1999/09/29 09:24:34 fca
61 Introduction of the Copyright and cvs Log
65 ///////////////////////////////////////////////////////////////////////
66 // Manager and of geomety classes for set: TPC //
68 // !sectors are numbered from 0 //
69 // !pad rows are numbered from 0 //
71 // 12.6. changed z relative
72 // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
74 ///////////////////////////////////////////////////////////////////////
82 #include <AliTPCParam.h>
90 //___________________________________________
91 AliTPCParam::AliTPCParam()
94 //constructor sets the default parameters
100 SetTitle("75x40_100x60");
104 AliTPCParam::~AliTPCParam()
107 //destructor deletes some dynamicaly alocated variables
110 if (fResponseBin!=0) delete [] fResponseBin;
111 if (fResponseWeight!=0) delete [] fResponseWeight;
112 if (fRotAngle !=0) delete [] fRotAngle;
119 Int_t AliTPCParam::Transform0to1(Float_t *xyz, Int_t * index) const
122 // calculates sector number (index[1], undefined on input)
128 Float_t r = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
129 if ((xyz[0]==0)&&(xyz[1]==0)) angle = 0.;
132 angle =TMath::ASin(xyz[1]/r);
133 if (xyz[0]<0) angle=TMath::Pi()-angle;
134 if ( (xyz[0]>0) && (xyz[1]<0) ) angle=2*TMath::Pi()+angle;
137 sector=Int_t((angle-fInnerAngleShift)/fInnerAngle);
140 AdjustCosSin(sector,cos,sin);
141 x1=xyz[0]*cos + xyz[1]*sin;
143 if (x1>fOuterRadiusLow)
145 sector=Int_t((angle-fOuterAngleShift)/fOuterAngle)+fNInnerSector;
146 if (xyz[2]<0) sector+=(fNOuterSector>>1);
149 if (xyz[2]<0) sector+=(fNInnerSector>>1);
150 index[1]=sector; // calculated sector number
151 index[0]=1; // indicates system after transformation
155 Bool_t AliTPCParam::Transform(Float_t *xyz, Int_t *index, Int_t* oindex)
157 //transformation from input coodination system to output coordination system
167 Int_t AliTPCParam::GetPadRow(Float_t *xyz, Int_t *index) const
170 //calculates pad row of point xyz - transformation to system 8 (digit system)
172 Int_t system = index[0];
174 Transform0to1(xyz,index);
178 Transform1to2(xyz,index);
182 if (fGeometryType==0){ //straight row
184 Transform2to3(xyz,index);
188 Transform3to4(xyz,index);
192 Transform4to8(xyz,index);
201 if (fGeometryType==1){ //cylindrical geometry
203 Transform2to5(xyz,index);
207 Transform2to3(xyz,index);
211 Transform3to4(xyz,index);
220 return -1; //if no reasonable system
223 void AliTPCParam::SetSectorAngles(Float_t innerangle, Float_t innershift, Float_t outerangle,
227 // set opening angles
228 const static Float_t kDegtoRad = 0.01745329251994;
229 fInnerAngle = innerangle; //opening angle of Inner sector
230 fInnerAngleShift = innershift; //shift of first inner sector center to the 0
231 fOuterAngle = outerangle; //opening angle of outer sector
232 fOuterAngleShift = outershift; //shift of first sector center to the 0
233 fInnerAngle *=kDegtoRad;
234 fInnerAngleShift *=kDegtoRad;
235 fOuterAngle *=kDegtoRad;
236 fOuterAngleShift *=kDegtoRad;
239 Float_t AliTPCParam::GetInnerAngle() const
246 Float_t AliTPCParam::GetInnerAngleShift() const
249 return fInnerAngleShift;
251 Float_t AliTPCParam::GetOuterAngle() const
256 Float_t AliTPCParam::GetOuterAngleShift() const
260 return fOuterAngleShift;
264 Int_t AliTPCParam::GetIndex(Int_t sector, Int_t row)
267 //give index of the given sector and pad row
268 //no control if the sectors and rows are reasonable !!!
270 if (sector<fNInnerSector) return sector*fNRowLow+row;
271 return (fNInnerSector*fNRowLow)+(sector-fNInnerSector)*fNRowUp+row;
274 Bool_t AliTPCParam::AdjustSectorRow(Int_t index, Int_t & sector, Int_t &row) const
277 //return sector and padrow for given index
278 //if index is reasonable returns true else return false
280 if ( (index<0) || (index>fNtRows)) return kFALSE;
281 Int_t outindex = fNInnerSector*fNRowLow;
282 if (index<outindex) {
283 sector = index/fNRowLow;
284 row = index - sector*fNRowLow;
288 sector = index/fNRowUp;
289 row = index - sector*fNRowUp;
290 sector += fNInnerSector;
294 void AliTPCParam::SetDefault()
297 //set default parameters
299 //const static Int_t kMaxRows=600;
301 //sector default parameters
303 const static Float_t kInnerRadiusLow = 82.97;
304 const static Float_t kOuterRadiusLow = 133.58;
305 const static Float_t kInnerRadiusUp = 133.17;
306 const static Float_t kOuterRadiusUp = 247.78;
307 const static Float_t kInnerAngle = 20; // 20 degrees
308 const static Float_t kInnerAngleShift = 10;
309 const static Float_t kOuterAngle = 20; // 20 degrees
310 const static Float_t kOuterAngleShift = 10;
311 const static Float_t kInnerFrameSpace = 1.5;
312 const static Float_t kOuterFrameSpace = 1.5;
313 const static Float_t kInnerWireMount = 1.370825926;
314 const static Float_t kOuterWireMount = 1.370825926;
315 const static Float_t kZLength =250.;
316 const static Int_t kGeometryType = 0; //straight rows
318 //wires default parameters
320 const static Int_t kNInnerWiresPerPad = 3;
321 const static Int_t kInnerDummyWire = 2;
322 const static Float_t kInnerOffWire = 0.5;
323 const static Int_t kNOuterWiresPerPad = 4;
324 const static Int_t kOuterDummyWire = 2;
325 const static Float_t kOuterOffWire = 0.5;
327 //pad default parameters
329 const static Float_t kInnerPadPitchLength = 0.75;
330 const static Float_t kInnerPadPitchWidth = 0.40;
331 const static Float_t kInnerPadLength = 0.75;
332 const static Float_t kInnerPadWidth = 0.40;
333 const static Float_t kOuterPadPitchLength = 1.0;
334 const static Float_t kOuterPadPitchWidth = 0.6;
335 const static Float_t kOuterPadLength = 1.0;
336 const static Float_t kOuterPadWidth = 0.6;
337 const static Bool_t kBMWPCReadout = kTRUE; //MWPC readout - another possibility GEM
338 const static Int_t kNCrossRows = 1; //number of rows to cross-talk
341 //gas default parameters
343 const static Float_t kDiffT = 2.2e-2;
344 const static Float_t kDiffL = 2.2e-2;
345 const static Float_t kGasGain = 2.e4;
346 const static Float_t kDriftV =2.83e6;
347 const static Float_t kOmegaTau = 0.145;
348 const static Float_t kAttCoef = 250.;
349 const static Float_t kOxyCont = 5.e-6;
351 //electronic default parameters
353 const static Float_t kPadCoupling=0.5;
354 const static Int_t kZeroSup=2;
355 const static Float_t kNoise = 1000;
356 const static Float_t kChipGain = 12;
357 const static Float_t kChipNorm = 0.4;
358 const static Float_t kTSample = 2.e-7;
359 const static Float_t kTFWHM = 1.9e-7; //fwhm of charge distribution
360 const static Int_t kMaxTBin =445;
361 const static Int_t kADCSat =1024;
362 const static Float_t kADCDynRange =2000.;
366 const static Float_t kBField =0.2;
367 const static Float_t kNPrimLoss =10.9;
368 const static Float_t kNTotalLoss =39.9;
372 const static Int_t kNResponseMax=100;
373 const static Float_t kResponseThreshold=0.01;
376 //set sector parameters
378 SetInnerRadiusLow(kInnerRadiusLow);
379 SetOuterRadiusLow(kOuterRadiusLow);
380 SetInnerRadiusUp(kInnerRadiusUp);
381 SetOuterRadiusUp(kOuterRadiusUp);
382 SetInnerFrameSpace(kInnerFrameSpace);
383 SetOuterFrameSpace(kOuterFrameSpace);
384 SetInnerWireMount(kInnerWireMount);
385 SetOuterWireMount(kOuterWireMount);
386 SetSectorAngles(kInnerAngle,kInnerAngleShift,kOuterAngle,kOuterAngleShift);
387 SetZLength(kZLength);
388 SetGeometryType(kGeometryType);
390 //set wire parameters
392 SetInnerNWires(kNInnerWiresPerPad);
393 SetInnerDummyWire(kInnerDummyWire);
394 SetInnerOffWire(kInnerOffWire);
395 SetOuterNWires(kNOuterWiresPerPad);
396 SetOuterDummyWire(kOuterDummyWire);
397 SetOuterOffWire(kOuterOffWire);
401 SetInnerPadPitchLength(kInnerPadPitchLength);
402 SetInnerPadPitchWidth(kInnerPadPitchWidth);
403 SetInnerPadLength(kInnerPadLength);
404 SetInnerPadWidth(kInnerPadWidth);
405 SetOuterPadPitchLength(kOuterPadPitchLength);
406 SetOuterPadPitchWidth(kOuterPadPitchWidth);
407 SetOuterPadLength(kOuterPadLength);
408 SetOuterPadWidth(kOuterPadWidth);
409 SetMWPCReadout(kBMWPCReadout);
410 SetNCrossRows(kNCrossRows);
416 SetGasGain(kGasGain);
418 SetOmegaTau(kOmegaTau);
419 SetAttCoef(kAttCoef);
420 SetOxyCont(kOxyCont);
422 //set electronivc parameters
424 SetPadCoupling(kPadCoupling);
425 SetZeroSup(kZeroSup);
427 SetChipGain(kChipGain);
428 SetChipNorm(kChipNorm);
429 SetTSample(kTSample);
431 SetMaxTBin(kMaxTBin);
433 SetADCDynRange(kADCDynRange);
436 SetNPrimLoss(kNPrimLoss);
437 SetNTotalLoss(kNTotalLoss);
439 //set response parameters
441 SetNResponseMax(kNResponseMax);
442 SetResponseThreshold(static_cast<int>(kResponseThreshold));
446 Bool_t AliTPCParam::Update()
449 // update some calculated parameter which must be updated after changing "base"
451 // for example we can change size of pads and according this recalculate number
452 // of pad rows, number of of pads in given row ....
454 const Float_t kQel = 1.602e-19; // elementary charge
457 Int_t i,j; //loop variables because HP
458 //-----------------Sector section------------------------------------------
459 //calclulate number of sectors
460 fNInnerSector = Int_t(4*TMath::Pi()/fInnerAngle+0.2);
461 // number of inner sectors - factor 0.2 to don't be influnced by inprecision
462 if (fNInnerSector%2) return kFALSE;
463 fNOuterSector = Int_t(4*TMath::Pi()/fOuterAngle+0.2);
464 if (fNOuterSector%2) return kFALSE;
465 fNSector = fNInnerSector+fNOuterSector;
467 if (fRotAngle!=0) delete [] fRotAngle;
468 fRotAngle = new Float_t[4*fNSector];
469 //calculate sin and cosine of rotations angle
470 //sectors angles numbering from 0
473 Float_t angle = fInnerAngleShift;
474 for (i=0; j<fNInnerSector*4; i+=4, j+=4 , angle +=fInnerAngle){
475 fRotAngle[i]=TMath::Cos(angle);
476 fRotAngle[i+1]=TMath::Sin(angle);
477 fRotAngle[j] = fRotAngle[i];
478 fRotAngle[j+1] = fRotAngle[i+1];
479 fRotAngle[i+2] =angle;
480 fRotAngle[j+2] =angle;
482 angle = fOuterAngleShift;
483 j=(fNInnerSector+fNOuterSector/2)*4;
484 for (i=fNInnerSector*4; j<fNSector*4; i+=4,j+=4, angle +=fOuterAngle){
485 fRotAngle[i]=TMath::Cos(angle);
486 fRotAngle[i+1]=TMath::Sin(angle);
487 fRotAngle[j] = fRotAngle[i];
488 fRotAngle[j+1] = fRotAngle[i+1];
489 fRotAngle[i+2] =angle;
490 fRotAngle[j+2] =angle;
492 fZWidth = fTSample*fDriftV;
493 fTotalNormFac = fPadCoupling*fChipNorm*kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
494 fNoiseNormFac = kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
497 Float_t wspace; //available space for wire
498 Float_t dummyspace; //dummyspace for wire
500 fInnerWWPitch = Float_t((Double_t)fInnerPadPitchLength/(Double_t)fNInnerWiresPerPad);
501 wspace =fInnerRadiusUp-fInnerRadiusLow-2*fInnerOffWire;
502 nwire = Int_t(wspace/fInnerWWPitch);
503 wspace = Float_t(nwire)*fInnerWWPitch;
504 dummyspace =(fInnerRadiusUp-fInnerRadiusLow-wspace)/2.;
505 fRInnerFirstWire = fInnerRadiusLow+dummyspace;
506 fRInnerLastWire = fRInnerFirstWire+fInnerWWPitch*(Float_t)(nwire);
508 fOuterWWPitch = Float_t((Double_t)fOuterPadPitchLength/(Double_t)fNOuterWiresPerPad);
509 wspace =fOuterRadiusUp-fOuterRadiusLow-2*fOuterOffWire;
510 nwire = Int_t(wspace/fOuterWWPitch);
511 wspace = Float_t(nwire)*fOuterWWPitch;
512 dummyspace =(fOuterRadiusUp-fOuterRadiusLow-wspace)/2.;
513 fROuterFirstWire = fOuterRadiusLow+dummyspace;
514 fROuterLastWire = fROuterFirstWire+fOuterWWPitch*(Float_t)(nwire);
520 if (fResponseBin==0) delete [] fResponseBin;
521 if (fResponseWeight==0) delete [] fResponseBin;
522 fResponseBin = new Int_t[3*fNResponseMax];
523 fResponseWeight = new Float_t[fNResponseMax];
531 Bool_t AliTPCParam::GetStatus()
533 //get information about object consistency
537 Int_t AliTPCParam::GetNRowLow() const
539 //get the number of pad rows in low sector
542 Int_t AliTPCParam::GetNRowUp() const
544 //get the number of pad rows in up sector
547 Float_t AliTPCParam::GetPadRowRadiiLow(Int_t irow) const
549 //get the pad row (irow) radii
550 if ( !(irow<0) && (irow<fNRowLow) )
551 return fPadRowLow[irow];
556 Float_t AliTPCParam::GetPadRowRadiiUp(Int_t irow) const
558 //get the pad row (irow) radii
559 if ( !(irow<0) && (irow<fNRowUp) )
560 return fPadRowUp[irow];
565 Int_t AliTPCParam::GetNPadsLow(Int_t irow) const
567 //get the number of pads in row irow
568 if ( !(irow<0) && (irow<fNRowLow) )
569 return fNPadsLow[irow];
575 Int_t AliTPCParam::GetNPadsUp(Int_t irow) const
577 //get the number of pads in row irow
578 if ( !(irow<0) && (irow<fNRowUp) )
579 return fNPadsUp[irow];