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.14 2002/03/29 06:57:45 kowal2
19 Restored backward compatibility to use the hits from Dec. 2000 production.
21 Revision 1.13 2002/03/18 17:59:13 kowal2
22 Chnges in the pad geometry - 3 pad lengths introduced.
24 Revision 1.12 2002/02/05 09:12:26 hristov
25 Small mods for gcc 3.02
27 Revision 1.11 2000/11/02 07:33:48 kowal2
28 Automatic streamer generation.
30 Revision 1.10 2000/07/10 20:57:39 hristov
31 Update of TPC code and macros by M.Kowalski
33 Revision 1.9 2000/06/30 12:07:50 kowal2
34 Updated from the TPC-PreRelease branch
36 Revision 1.8.4.4 2000/06/26 07:39:42 kowal2
37 Changes to obey the coding rules
39 Revision 1.8.4.3 2000/06/25 08:38:41 kowal2
40 Splitted from AliTPCtracking
42 Revision 1.8.4.2 2000/06/14 16:48:24 kowal2
43 Parameter setting improved. Removed compiler warnings
45 Revision 1.8.4.1 2000/06/09 07:12:21 kowal2
49 Revision 1.8 2000/04/17 09:37:33 kowal2
50 removed obsolete AliTPCDigitsDisplay.C
52 Revision 1.7.8.2 2000/04/10 08:44:51 kowal2
54 New transformations added
55 Different pad and pad-rows geometries for different sectors
57 Revision 1.7.8.1 2000/04/10 07:56:53 kowal2
58 Not used anymore - removed
60 Revision 1.7 1999/10/08 13:10:35 fca
61 Values in SetDefault are in radiants
63 Revision 1.6 1999/10/08 06:27:59 fca
66 Revision 1.5 1999/10/05 17:18:27 fca
67 Correct GetWire check on even/odd fnWires
69 Revision 1.4 1999/09/29 09:24:34 fca
70 Introduction of the Copyright and cvs Log
74 ///////////////////////////////////////////////////////////////////////
75 // Manager and of geomety classes for set: TPC //
77 // !sectors are numbered from 0 //
78 // !pad rows are numbered from 0 //
80 // 12.6. changed z relative
81 // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
83 ///////////////////////////////////////////////////////////////////////
91 #include <AliTPCParam.h>
99 //___________________________________________
100 AliTPCParam::AliTPCParam()
103 //constructor sets the default parameters
109 SetTitle("75x40_100x60_150x60");
113 AliTPCParam::~AliTPCParam()
116 //destructor deletes some dynamicaly alocated variables
119 if (fResponseBin!=0) delete [] fResponseBin;
120 if (fResponseWeight!=0) delete [] fResponseWeight;
121 if (fRotAngle !=0) delete [] fRotAngle;
128 Int_t AliTPCParam::Transform0to1(Float_t *xyz, Int_t * index) const
131 // calculates sector number (index[1], undefined on input)
137 Float_t r = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
138 if ((xyz[0]==0)&&(xyz[1]==0)) angle = 0.;
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;
146 sector=Int_t((angle-fInnerAngleShift)/fInnerAngle);
149 AdjustCosSin(sector,cos,sin);
150 x1=xyz[0]*cos + xyz[1]*sin;
152 if (x1>fOuterRadiusLow)
154 sector=Int_t((angle-fOuterAngleShift)/fOuterAngle)+fNInnerSector;
155 if (xyz[2]<0) sector+=(fNOuterSector>>1);
158 if (xyz[2]<0) sector+=(fNInnerSector>>1);
159 index[1]=sector; // calculated sector number
160 index[0]=1; // indicates system after transformation
164 Bool_t AliTPCParam::Transform(Float_t *xyz, Int_t *index, Int_t* oindex)
166 //transformation from input coodination system to output coordination system
176 Int_t AliTPCParam::GetPadRow(Float_t *xyz, Int_t *index) const
179 //calculates pad row of point xyz - transformation to system 8 (digit system)
181 Int_t system = index[0];
183 Transform0to1(xyz,index);
187 Transform1to2(xyz,index);
191 if (fGeometryType==0){ //straight row
193 Transform2to3(xyz,index);
197 Transform3to4(xyz,index);
201 Transform4to8(xyz,index);
210 if (fGeometryType==1){ //cylindrical geometry
212 Transform2to5(xyz,index);
216 Transform2to3(xyz,index);
220 Transform3to4(xyz,index);
229 return -1; //if no reasonable system
232 void AliTPCParam::SetSectorAngles(Float_t innerangle, Float_t innershift, Float_t outerangle,
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;
248 Float_t AliTPCParam::GetInnerAngle() const
255 Float_t AliTPCParam::GetInnerAngleShift() const
258 return fInnerAngleShift;
260 Float_t AliTPCParam::GetOuterAngle() const
265 Float_t AliTPCParam::GetOuterAngleShift() const
269 return fOuterAngleShift;
273 Int_t AliTPCParam::GetIndex(Int_t sector, Int_t row)
276 //give index of the given sector and pad row
277 //no control if the sectors and rows are reasonable !!!
279 if (sector<fNInnerSector) return sector*fNRowLow+row;
280 return (fNInnerSector*fNRowLow)+(sector-fNInnerSector)*fNRowUp+row;
283 Bool_t AliTPCParam::AdjustSectorRow(Int_t index, Int_t & sector, Int_t &row) const
286 //return sector and padrow for given index
287 //if index is reasonable returns true else return false
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;
297 sector = index/fNRowUp;
298 row = index - sector*fNRowUp;
299 sector += fNInnerSector;
303 void AliTPCParam::SetDefault()
306 //set default parameters
308 //const static Int_t kMaxRows=600;
310 //sector default parameters
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;
331 //wires default parameters
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;
347 //pad default parameters
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;
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
364 //gas default parameters
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;
374 //electronic default parameters
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.;
389 const static Float_t kBField =0.2;
390 const static Float_t kNPrimLoss =10.9;
391 const static Float_t kNTotalLoss =39.9;
395 const static Int_t kNResponseMax=100;
396 const static Float_t kResponseThreshold=0.01;
399 //set sector parameters
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);
417 //set wire parameters
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);
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);
452 SetGasGain(kGasGain);
454 SetOmegaTau(kOmegaTau);
455 SetAttCoef(kAttCoef);
456 SetOxyCont(kOxyCont);
458 //set electronivc parameters
460 SetPadCoupling(kPadCoupling);
461 SetZeroSup(kZeroSup);
463 SetChipGain(kChipGain);
464 SetChipNorm(kChipNorm);
465 SetTSample(kTSample);
467 SetMaxTBin(kMaxTBin);
469 SetADCDynRange(kADCDynRange);
472 SetNPrimLoss(kNPrimLoss);
473 SetNTotalLoss(kNTotalLoss);
475 //set response parameters
477 SetNResponseMax(kNResponseMax);
478 SetResponseThreshold(static_cast<int>(kResponseThreshold));
482 Bool_t AliTPCParam::Update()
485 // update some calculated parameter which must be updated after changing "base"
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 ....
490 const Float_t kQel = 1.602e-19; // elementary charge
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;
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
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;
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;
528 fZWidth = fTSample*fDriftV;
529 fTotalNormFac = fPadCoupling*fChipNorm*kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
530 fNoiseNormFac = kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
533 Float_t wspace; //available space for wire
534 Float_t dummyspace; //dummyspace for wire
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);
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];
562 Bool_t AliTPCParam::GetStatus()
564 //get information about object consistency
568 Int_t AliTPCParam::GetNRowLow() const
570 //get the number of pad rows in low sector
573 Int_t AliTPCParam::GetNRowUp() const
575 //get the number of pad rows in up sector
578 Int_t AliTPCParam::GetNRowUp1() const
580 //get the number of pad rows in up1 sector
583 Int_t AliTPCParam::GetNRowUp2() const
585 //get the number of pad rows in up2 sector
588 Float_t AliTPCParam::GetPadRowRadiiLow(Int_t irow) const
590 //get the pad row (irow) radii
591 if ( !(irow<0) && (irow<fNRowLow) )
592 return fPadRowLow[irow];
597 Float_t AliTPCParam::GetPadRowRadiiUp(Int_t irow) const
599 //get the pad row (irow) radii
600 if ( !(irow<0) && (irow<fNRowUp) )
601 return fPadRowUp[irow];
606 Int_t AliTPCParam::GetNPadsLow(Int_t irow) const
608 //get the number of pads in row irow
609 if ( !(irow<0) && (irow<fNRowLow) )
610 return fNPadsLow[irow];
616 Int_t AliTPCParam::GetNPadsUp(Int_t irow) const
618 //get the number of pads in row irow
619 if ( !(irow<0) && (irow<fNRowUp) )
620 return fNPadsUp[irow];
624 Float_t AliTPCParam::GetYInner(Int_t irow) const
626 return fYInner[irow];
630 Float_t AliTPCParam::GetYOuter(Int_t irow) const
632 return fYOuter[irow];