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