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