]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCParam.cxx
Coding convention rules obeyed
[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
16/*
17$Log$
0bbae0f2 18Revision 1.10 2000/07/10 20:57:39 hristov
19Update of TPC code and macros by M.Kowalski
20
37831078 21Revision 1.9 2000/06/30 12:07:50 kowal2
22Updated from the TPC-PreRelease branch
23
73042f01 24Revision 1.8.4.4 2000/06/26 07:39:42 kowal2
25Changes to obey the coding rules
26
27Revision 1.8.4.3 2000/06/25 08:38:41 kowal2
28Splitted from AliTPCtracking
29
30Revision 1.8.4.2 2000/06/14 16:48:24 kowal2
31Parameter setting improved. Removed compiler warnings
32
33Revision 1.8.4.1 2000/06/09 07:12:21 kowal2
34
35Updated defaults
36
37Revision 1.8 2000/04/17 09:37:33 kowal2
38removed obsolete AliTPCDigitsDisplay.C
39
cc80f89e 40Revision 1.7.8.2 2000/04/10 08:44:51 kowal2
41
42New transformations added
43Different pad and pad-rows geometries for different sectors
44
45Revision 1.7.8.1 2000/04/10 07:56:53 kowal2
46Not used anymore - removed
47
48Revision 1.7 1999/10/08 13:10:35 fca
49Values in SetDefault are in radiants
50
4d89658a 51Revision 1.6 1999/10/08 06:27:59 fca
52Defaults updated
53
683f9fec 54Revision 1.5 1999/10/05 17:18:27 fca
55Correct GetWire check on even/odd fnWires
56
ae4cbe70 57Revision 1.4 1999/09/29 09:24:34 fca
58Introduction of the Copyright and cvs Log
59
4c039060 60*/
61
8c555625 62///////////////////////////////////////////////////////////////////////
63// Manager and of geomety classes for set: TPC //
64// //
1283eee5 65// !sectors are numbered from 0 //
66// !pad rows are numbered from 0 //
67//
68// 12.6. changed z relative
8c555625 69// Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
70// //
71///////////////////////////////////////////////////////////////////////
72
73042f01 73//
8c555625 74
75#include <iostream.h>
76#include <TMath.h>
1283eee5 77#include <TObject.h>
cc80f89e 78#include <TRandom.h>
1283eee5 79#include <AliTPCParam.h>
8c555625 80
81
cc80f89e 82
8c555625 83
73042f01 84ClassImp(AliTPCParam)
8c555625 85
86
87//___________________________________________
88AliTPCParam::AliTPCParam()
89{
cc80f89e 90 //
91 //constructor sets the default parameters
92 //
93
94 fResponseBin = 0;
95 fResponseWeight = 0;
96 fRotAngle = 0;
73042f01 97 SetTitle("75x40_100x60");
8c555625 98 SetDefault();
99}
100
cc80f89e 101AliTPCParam::~AliTPCParam()
1283eee5 102{
103 //
cc80f89e 104 //destructor deletes some dynamicaly alocated variables
105 //
106
107 if (fResponseBin!=0) delete [] fResponseBin;
108 if (fResponseWeight!=0) delete [] fResponseWeight;
109 if (fRotAngle !=0) delete [] fRotAngle;
110
1283eee5 111}
112
113
cc80f89e 114
115
116Int_t AliTPCParam::Transform0to1(Float_t *xyz, Int_t * index) const
117{
118 //
119 // calculates sector number (index[1], undefined on input)
120 // xyz intact
121 //
122
123 Float_t angle,x1;
124 Int_t sector;
125 Float_t r = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
126 if ((xyz[0]==0)&&(xyz[1]==0)) angle = 0.;
127 else
8c555625 128 {
cc80f89e 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;
132 }
3c0f9266 133
cc80f89e 134 sector=Int_t((angle-fInnerAngleShift)/fInnerAngle);
135
8c555625 136 Float_t cos,sin;
cc80f89e 137 AdjustCosSin(sector,cos,sin);
138 x1=xyz[0]*cos + xyz[1]*sin;
8c555625 139
cc80f89e 140 if (x1>fOuterRadiusLow)
141 {
142 sector=Int_t((angle-fOuterAngleShift)/fOuterAngle)+fNInnerSector;
143 if (xyz[2]<0) sector+=(fNOuterSector>>1);
144 }
8c555625 145 else
1283eee5 146 if (xyz[2]<0) sector+=(fNInnerSector>>1);
cc80f89e 147 index[1]=sector; // calculated sector number
148 index[0]=1; // indicates system after transformation
149 return sector;
150}
1283eee5 151
cc80f89e 152Bool_t AliTPCParam::Transform(Float_t *xyz, Int_t *index, Int_t* oindex)
153{
154 //transformation from input coodination system to output coordination system
155 switch (index[0]){
156 case 0:
157 break;
158 };
159
160 return kFALSE;
161
162}
163
164Int_t AliTPCParam::GetPadRow(Float_t *xyz, Int_t *index) const
165{
166 //
167 //calculates pad row of point xyz - transformation to system 8 (digit system)
168 //
169 Int_t system = index[0];
170 if (0==system) {
171 Transform0to1(xyz,index);
172 system=1;
173 }
174 if (1==system) {
175 Transform1to2(xyz,index);
176 system=2;
177 }
178
179 if (fGeometryType==0){ //straight row
180 if (2==system) {
181 Transform2to3(xyz,index);
182 system=3;
183 }
184 if (3==system) {
185 Transform3to4(xyz,index);
186 system=4;
8c555625 187 }
cc80f89e 188 if (4==system) {
189 Transform4to8(xyz,index);
190 system=8;
8c555625 191 }
cc80f89e 192 if (8==system) {
193 index[0]=8;
194 return index[2];
195 }
8c555625 196 }
cc80f89e 197
198 if (fGeometryType==1){ //cylindrical geometry
199 if (2==system) {
200 Transform2to5(xyz,index);
201 system=5;
202 }
203 if (5==system) {
204 Transform2to3(xyz,index);
205 system=6;
206 }
207 if (6==system) {
208 Transform3to4(xyz,index);
209 system=7;
210 }
211 if (8==system) {
212 index[0]=8;
213 return index[2];
214 }
215 }
216 index[0]=system;
217 return -1; //if no reasonable system
8c555625 218}
219
cc80f89e 220void AliTPCParam::SetSectorAngles(Float_t innerangle, Float_t innershift, Float_t outerangle,
221 Float_t outershift)
8c555625 222{
cc80f89e 223 //
224 // set opening angles
73042f01 225 const static Float_t kDegtoRad = 0.01745329251994;
cc80f89e 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;
8c555625 234}
cc80f89e 235
236Float_t AliTPCParam::GetInnerAngle() const
8c555625 237{
cc80f89e 238 //return angle
239 return fInnerAngle;
240
8c555625 241}
242
cc80f89e 243Float_t AliTPCParam::GetInnerAngleShift() const
244{
245 //return angle
246 return fInnerAngleShift;
8c555625 247}
cc80f89e 248Float_t AliTPCParam::GetOuterAngle() const
249{
250 //return angle
251 return fOuterAngle;
252}
253Float_t AliTPCParam::GetOuterAngleShift() const
254{
255 //return angle
256
257 return fOuterAngleShift;
258}
259
8c555625 260
261Int_t AliTPCParam::GetIndex(Int_t sector, Int_t row)
262{
263 //
264 //give index of the given sector and pad row
265 //no control if the sectors and rows are reasonable !!!
266 //
cc80f89e 267 if (sector<fNInnerSector) return sector*fNRowLow+row;
268 return (fNInnerSector*fNRowLow)+(sector-fNInnerSector)*fNRowUp+row;
8c555625 269}
270
cc80f89e 271Bool_t AliTPCParam::AdjustSectorRow(Int_t index, Int_t & sector, Int_t &row) const
8c555625 272{
273 //
274 //return sector and padrow for given index
cc80f89e 275 //if index is reasonable returns true else return false
8c555625 276 //
277 if ( (index<0) || (index>fNtRows)) return kFALSE;
cc80f89e 278 Int_t outindex = fNInnerSector*fNRowLow;
8c555625 279 if (index<outindex) {
cc80f89e 280 sector = index/fNRowLow;
281 row = index - sector*fNRowLow;
8c555625 282 return kTRUE;
283 }
284 index-= outindex;
cc80f89e 285 sector = index/fNRowUp;
286 row = index - sector*fNRowUp;
287 sector += fNInnerSector;
8c555625 288 return kTRUE;
289}
290
cc80f89e 291void AliTPCParam::SetDefault()
8c555625 292{
293 //
cc80f89e 294 //set default parameters
8c555625 295 //
37831078 296 //const static Int_t kMaxRows=600;
73042f01 297 //
298 //sector default parameters
299 //
37831078 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;
73042f01 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;
37831078 310 const static Float_t kInnerWireMount = 1.370825926;
311 const static Float_t kOuterWireMount = 1.370825926;
73042f01 312 const static Float_t kZLength =250.;
313 const static Int_t kGeometryType = 0; //straight rows
314 //
315 //wires default parameters
316 //
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;
323 //
324 //pad default parameters
325 //
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
336
337 //
338 //gas default parameters
339 //
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;
347 //
348 //electronic default parameters
349 //
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.;
360 //
361 //
362 //
363 const static Float_t kBField =0.2;
364 const static Float_t kNPrimLoss =10.9;
365 const static Float_t kNTotalLoss =39.9;
366 //
367 //response constants
368 //
369 const static Int_t kNResponseMax=100;
370 const static Float_t kResponseThreshold=0.01;
8c555625 371 fbStatus = kFALSE;
8c555625 372 //
cc80f89e 373 //set sector parameters
374 //
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);
386 //
387 //set wire parameters
388 //
389 SetInnerNWires(kNInnerWiresPerPad);
390 SetInnerDummyWire(kInnerDummyWire);
391 SetInnerOffWire(kInnerOffWire);
392 SetOuterNWires(kNOuterWiresPerPad);
393 SetOuterDummyWire(kOuterDummyWire);
394 SetOuterOffWire(kOuterOffWire);
395 //
396 //set pad parameter
1283eee5 397 //
cc80f89e 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);
1283eee5 408 //
cc80f89e 409 //set gas paremeters
410 //
411 SetDiffT(kDiffT);
412 SetDiffL(kDiffL);
413 SetGasGain(kGasGain);
414 SetDriftV(kDriftV);
415 SetOmegaTau(kOmegaTau);
416 SetAttCoef(kAttCoef);
417 SetOxyCont(kOxyCont);
418 //
419 //set electronivc parameters
420 //
421 SetPadCoupling(kPadCoupling);
422 SetZeroSup(kZeroSup);
423 SetNoise(kNoise);
424 SetChipGain(kChipGain);
425 SetChipNorm(kChipNorm);
426 SetTSample(kTSample);
427 SetTFWHM(kTFWHM);
428 SetMaxTBin(kMaxTBin);
429 SetADCSat(kADCSat);
430 SetADCDynRange(kADCDynRange);
431 //set magnetic field
432 SetBField(kBField);
433 SetNPrimLoss(kNPrimLoss);
434 SetNTotalLoss(kNTotalLoss);
435 //
436 //set response parameters
437 //
438 SetNResponseMax(kNResponseMax);
439 SetResponseThreshold(kResponseThreshold);
8c555625 440}
cc80f89e 441
8c555625 442
443Bool_t AliTPCParam::Update()
444{
1283eee5 445 //
446 // update some calculated parameter which must be updated after changing "base"
447 // parameters
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 ....
450 //
73042f01 451 const Float_t kQel = 1.602e-19; // elementary charge
8c555625 452 fbStatus = kFALSE;
1283eee5 453
454 Int_t i,j; //loop variables because HP
455 //-----------------Sector section------------------------------------------
456 //calclulate number of sectors
cc80f89e 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
1283eee5 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;
cc80f89e 463
464 if (fRotAngle!=0) delete [] fRotAngle;
465 fRotAngle = new Float_t[4*fNSector];
1283eee5 466 //calculate sin and cosine of rotations angle
467 //sectors angles numbering from 0
cc80f89e 468
469 j=fNInnerSector*2;
1283eee5 470 Float_t angle = fInnerAngleShift;
cc80f89e 471 for (i=0; j<fNInnerSector*4; i+=4, j+=4 , angle +=fInnerAngle){
1283eee5 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];
cc80f89e 476 fRotAngle[i+2] =angle;
477 fRotAngle[j+2] =angle;
1283eee5 478 }
479 angle = fOuterAngleShift;
cc80f89e 480 j=(fNInnerSector+fNOuterSector/2)*4;
481 for (i=fNInnerSector*4; j<fNSector*4; i+=4,j+=4, angle +=fOuterAngle){
1283eee5 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];
cc80f89e 486 fRotAngle[i+2] =angle;
487 fRotAngle[j+2] =angle;
1283eee5 488 }
cc80f89e 489 fZWidth = fTSample*fDriftV;
73042f01 490 fTotalNormFac = fPadCoupling*fChipNorm*kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
491 fNoiseNormFac = kQel*1.e15*fChipGain*fADCSat/fADCDynRange;
cc80f89e 492 //wire section
493 Int_t nwire;
494 Float_t wspace; //available space for wire
495 Float_t dummyspace; //dummyspace for wire
496
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);
504
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);
1283eee5 512
513
8c555625 514 //
cc80f89e 515 //response data
516 //
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];
521
8c555625 522 fbStatus = kTRUE;
523 return kTRUE;
524}
525
526
527
528Bool_t AliTPCParam::GetStatus()
529{
530 //get information about object consistency
531 return fbStatus;
532}
533
534Int_t AliTPCParam::GetNRowLow() const
535{
536 //get the number of pad rows in low sector
cc80f89e 537 return fNRowLow;
8c555625 538}
539Int_t AliTPCParam::GetNRowUp() const
540{
541 //get the number of pad rows in up sector
cc80f89e 542 return fNRowUp;
8c555625 543}
544Float_t AliTPCParam::GetPadRowRadiiLow(Int_t irow) const
545{
546 //get the pad row (irow) radii
cc80f89e 547 if ( !(irow<0) && (irow<fNRowLow) )
8c555625 548 return fPadRowLow[irow];
549 else
550 return 0;
551}
552
553Float_t AliTPCParam::GetPadRowRadiiUp(Int_t irow) const
554{
555 //get the pad row (irow) radii
cc80f89e 556 if ( !(irow<0) && (irow<fNRowUp) )
8c555625 557 return fPadRowUp[irow];
558 else
559 return 0;
560}
561
562Int_t AliTPCParam::GetNPadsLow(Int_t irow) const
563{
564 //get the number of pads in row irow
cc80f89e 565 if ( !(irow<0) && (irow<fNRowLow) )
566 return fNPadsLow[irow];
8c555625 567 else
568 return 0;
569}
570
571
572Int_t AliTPCParam::GetNPadsUp(Int_t irow) const
573{
574 //get the number of pads in row irow
cc80f89e 575 if ( !(irow<0) && (irow<fNRowUp) )
576 return fNPadsUp[irow];
8c555625 577 else
578 return 0;
579}
580