Corrected bug in the TPC geometry, thanks to Ivana Hrivnacova
[u/mrichter/AliRoot.git] / TPC / AliTPCv3.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$
e94dd9ca 18Revision 1.12 2000/04/17 09:37:33 kowal2
19removed obsolete AliTPCDigitsDisplay.C
20
cc80f89e 21Revision 1.11.8.2 2000/04/10 08:36:12 kowal2
22
23Updated readout chambers
24Some modifications to StepManager by M. Kowalski
25
26Revision 1.11.8.1 2000/04/10 07:56:53 kowal2
27Not used anymore - removed
28
29Revision 1.11 1999/11/04 17:28:07 fca
30Correct barrel part of HV Degrader
31
a5371c42 32Revision 1.10 1999/10/14 16:52:08 fca
33Only use PDG codes and not GEANT ones
34
69e40cce 35Revision 1.9 1999/10/08 06:27:23 fca
36Corrected bug in the HV degrader geometry, thanks to G.Tabary
37
d183a600 38Revision 1.8 1999/10/04 13:39:55 fca
39Correct array index problem
40
cdde5b1e 41Revision 1.7 1999/09/29 09:24:34 fca
42Introduction of the Copyright and cvs Log
43
4c039060 44*/
45
4b0fdcad 46///////////////////////////////////////////////////////////////////////////////
47// //
48// Time Projection Chamber version 3 -- detailed TPC and slow simulation //
49// //
50//Begin_Html
51/*
52<img src="picts/AliTPCv3Class.gif">
53*/
54//End_Html
55// //
56// //
57///////////////////////////////////////////////////////////////////////////////
58
59#include <stdlib.h>
60#include <TMath.h>
4b0fdcad 61#include "AliTPCv3.h"
62#include "AliRun.h"
63#include "AliConst.h"
cc80f89e 64#include "AliTPCDigitsArray.h"
65#include"AliTPCParam.h"
69e40cce 66#include "AliPDG.h"
4b0fdcad 67
68ClassImp(AliTPCv3)
69
70//_____________________________________________________________________________
71AliTPCv3::AliTPCv3(const char *name, const char *title) :
72 AliTPC(name, title)
73{
74 //
cc80f89e 75 // Standard constructor for Time Projection Chamber version 3
4b0fdcad 76 //
77
78 SetBufferSize(128000);
79}
80
81//_____________________________________________________________________________
82void AliTPCv3::CreateGeometry()
83{
84 //
cc80f89e 85 // Creation of the TPC coarse geometry (version 3)
86 // Origin Marek Kowalski Cracow
4b0fdcad 87 //
88 //Begin_Html
89 /*
1283eee5 90 <img src="picts/AliTPCv0.gif">
4b0fdcad 91 */
92 //End_Html
93 //Begin_Html
94 /*
1283eee5 95 <img src="picts/AliTPCv0Tree.gif">
4b0fdcad 96 */
97 //End_Html
98
1283eee5 99 Int_t *idtmed = fIdtmed->GetArray();
100
101 Float_t dm[21];
62a73ee5 102 Int_t idrotm[120];
1283eee5 103
104 Int_t nRotMat = 0;
105
106
4b0fdcad 107 // ----------------------------------------------------
1283eee5 108 // FIELD CAGE WITH ENDCAPS - G10
4b0fdcad 109 // THIS IS ALSO A TPC MOTHER VOLUME
110 // ----------------------------------------------------
1283eee5 111
4b0fdcad 112 dm[0] = 76.;
113 dm[1] = 278.;
114 dm[2] = 275.;
1283eee5 115
116 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
117
118 //-----------------------------------------------------
119 // Endcap cover c-fibre 0.86% X0
120 //-----------------------------------------------------
121
122 dm[0] = 78.;
123 dm[1] = 258.;
124 dm[2] = 0.95;
125
126 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
127
128 //-----------------------------------------------------
129 // Drift gas , leave 2 cm at the outer radius
130 // and inner raddius
131 //-----------------------------------------------------
132
133 dm[0] = 78.;
134 dm[1] = 258.;
4b0fdcad 135 dm[2] = 250.;
136
1283eee5 137 gMC->Gsvolu("TGAS", "TUBE", idtmed[4], dm, 3);
138
4b0fdcad 139
1283eee5 140 //------------------------------------------------------
141 // membrane holder - carbon fiber
142 //------------------------------------------------------
143
144
145 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
146
147 dm[0] = 252.;
148 dm[1] = 258.;
149 dm[2] = 0.2;
150
151 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
152
153 dm[0] = 78.;
cdde5b1e 154 dm[1] = 82.;
1283eee5 155 dm[2] = 0.1;
156
157 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
158
159 //----------------------------------------------------------
160 // HV membrane - 25 microns of mylar
161 //----------------------------------------------------------
162
163 dm[0] = 82.;
164 dm[1] = 252.;
165 dm[2] = 0.00125;
166
167 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
168
169 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
170
171 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
172
173 //----------------------------------------------------------
174 // "side" gas volume, the same as the drift gas
175 // the readout chambers are placed there.
176 //----------------------------------------------------------
177
178 dm[0] = 78.;
179 dm[1] = 258.;
180 dm[2] = 0.5*(275. - 250.);
181
182 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
183
184 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
185
186 //-----------------------------------------------------------
187 // Readout chambers , 25% of X0, I use Al as the material
188 //-----------------------------------------------------------
189
190 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
191 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
192
193 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
194 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
195
196
197 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
198 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
199
200
cc80f89e 201 Float_t InSecLowEdge = fTPCParam->GetInnerRadiusLow();
202 Float_t InSecUpEdge = fTPCParam->GetInnerRadiusUp();
1283eee5 203
cc80f89e 204 Float_t OuSecLowEdge = fTPCParam->GetOuterRadiusLow();
205 Float_t OuSecUpEdge = fTPCParam->GetOuterRadiusUp();
1283eee5 206
207 Float_t SecThick = 2.225; // Al
208
cc80f89e 209 Float_t LowEdge = fTPCParam->GetInnerFrameSpace();
1283eee5 210
211 // S (Inner) sectors
212
cc80f89e 213 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-LowEdge;
214 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-LowEdge;
1283eee5 215 dm[2] = SecThick;
216 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
217
218 Float_t xCenterS = InSecLowEdge+dm[3];
219
220 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
221
222 // L (Outer) sectors
223
cc80f89e 224 Float_t UpEdge = fTPCParam->GetOuterFrameSpace();
225
226 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-UpEdge;
227 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-UpEdge;
1283eee5 228 dm[2] = SecThick;
229 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
230
231 Float_t xCenterL = OuSecLowEdge+dm[3];
232
233 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
234
235 Float_t z1 = -z_side + SecThick*0.5;
236
237 //------------------------------------------------------------------
238 // Positioning of the S-sector readout chambers
239 //------------------------------------------------------------------
240
241 Int_t ns;
242 Float_t theta1,theta2,theta3;
243 Float_t phi1,phi2,phi3;
244 Float_t alpha;
245 Float_t x,y;
246
247 for(ns=0;ns<nInnerSector;ns++){
248
249 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
250 phi1 *= kRaddeg; // in degrees
251
252 phi1 = (Float_t)TMath::Nint(phi1);
253
254 if (phi1 > 360.) phi1 -= 360.;
255
4b0fdcad 256 theta1 = 90.;
257 phi2 = 90.;
258 theta2 = 180.;
1283eee5 259 phi3 = ns * InnerOpenAngle + InnerAngleShift;
260 phi3 *= kRaddeg; // in degrees
261
262 phi3 = (Float_t)TMath::Nint(phi3);
263
264 if(phi3 > 360.) phi3 -= 360.;
265
4b0fdcad 266 theta3 = 90.;
1283eee5 267
268 alpha = phi3*kDegrad;
269
270 x = xCenterS * TMath::Cos(alpha);
271 y = xCenterS * TMath::Sin(alpha);
272
273 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
274
275 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
276
277 nRotMat++;
278
279 }
4b0fdcad 280
1283eee5 281 //-------------------------------------------------------------------
282 // Positioning of the L-sectors readout chambers
283 //-------------------------------------------------------------------
4b0fdcad 284
1283eee5 285 for(ns=0;ns<nOuterSector;ns++){
286 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
287 phi1 *= kRaddeg; // in degrees
288
289 phi1 = (Float_t)TMath::Nint(phi1);
4b0fdcad 290
1283eee5 291
292 if (phi1 > 360.) phi1 -= 360.;
293
4b0fdcad 294 theta1 = 90.;
295 phi2 = 90.;
296 theta2 = 180.;
1283eee5 297 phi3 = ns * OuterOpenAngle+OuterAngleShift;
298 phi3 *= kRaddeg; // in degrees
299
300 phi3 = (Float_t)TMath::Nint(phi3);
301
302
303 if(phi3 > 360.) phi3 -= 360.;
304
4b0fdcad 305 theta3 = 90.;
1283eee5 306
307 alpha = phi3*kDegrad;
308
309 x = xCenterL * TMath::Cos(alpha);
310 y = xCenterL * TMath::Sin(alpha);
311
312 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
313
314
315 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
316
317 nRotMat++;
318
4b0fdcad 319 }
1283eee5 320
321 Float_t z0 = z_side - 0.95;
322
323 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
324
4b0fdcad 325 // ==========================================================
326 // wheels
327 // ==========================================================
1283eee5 328
329 //
330 // auxilary structures
331 //
332
333
334 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
335
4b0fdcad 336 // ----------------------------------------------------------
337 // Large wheel -> positioned in the TPC
338 // ----------------------------------------------------------
1283eee5 339
340
341 z0 = 263.5; // TPC length - 1/2 spoke wheel width
342
343 dm[0] = 258.;
4b0fdcad 344 dm[1] = 278.;
345 dm[2] = 11.5;
4b0fdcad 346
1283eee5 347 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
348
349 dm[0] = dm[0]+2.;
350 dm[1] = 278.;
351 dm[2] = dm[2]-2.;
352
353 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
354
355 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
356 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
357
358 //
359 // Outer vessel + CO2 HV degrader
360 //
361
362 dm[0] = 260.;
363 dm[1] = 278.;
364 dm[2] = 252.;
365
366 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
367
368 dm[0] = 275.;
4b0fdcad 369 dm[1] = 278.;
4b0fdcad 370
1283eee5 371 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
372
373 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
374
375
1283eee5 376
377 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
378
379
380 //----------------------------------------------------------
381 // Small wheel -> positioned in "side gas
382 //----------------------------------------------------------
383
384 dm[0] = 78.;
4b0fdcad 385 dm[1] = 82.;
386 dm[2] = 11.5;
1283eee5 387
388 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
389
390 dm[0] = 78.;
391 dm[1] = dm[1]-2;
392 dm[2] = dm[2]-2.;
393
394 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
4b0fdcad 395
1283eee5 396 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
397
398 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
399
400 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
401
402
403 // to avoid overlaps
404
405 dm[0] = 76.;
406 dm[1] = 78.;
407 dm[2] = 11.5;
408
409 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
410
4b0fdcad 411 dm[2] = 9.5;
1283eee5 412
413 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
414
415 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
416
417 z0= 263.5;
4b0fdcad 418
1283eee5 419 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
420 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
421
422 // G10 plug
423
424 dm[0] = 76.;
7d7bb9e5 425 dm[1] = 78.;
426 dm[2] = 1.;
1283eee5 427
428 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
429
430 z0 = 251.;
431
432 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
433 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
434
435
436 //---------------------------------------------------------
437 // central wheel 6 (radial direction) x 4 (along z) cm2
438 //---------------------------------------------------------
439
440 dm[0] = 140.;
441 dm[1] = 146.;
4b0fdcad 442 dm[2] = 2.;
4b0fdcad 443
1283eee5 444 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
445
446 dm[0] = dm[0] + 2.;
447 dm[1] = dm[1] - 2.;
448 dm[2] = dm[2] - 1.;
449
450 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
451
452 z0 = z_side - 1.9 - 2.;
453
454 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
455
456 //
457
458 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
459
460
461 //---------------------------------------------------------
462 // inner spokes (nSectorInner)
463 //---------------------------------------------------------
464
465 dm[0] = 0.5*(139.9-82.1);
4b0fdcad 466 dm[1] = 3.;
467 dm[2] = 2.;
1283eee5 468
469 Float_t x1 = dm[0]+82.;
470
471 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
472
473 dm[1] = dm[1]-1.;
474 dm[2] = dm[2]-1.;
475
476 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
477
478 for(ns=0;ns<nInnerSector;ns++){
479
480 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
481 theta1=90.;
482 phi1 *=kRaddeg;
483
484 phi1 = (Float_t)TMath::Nint(phi1);
485
486 phi2 = phi1+90.;
487 if(phi2>360.) phi2 -= 360.;
488 theta2=90.;
489 phi3=0.;
490 theta3=0.;
491
4b0fdcad 492 alpha = phi1 * kDegrad;
493 x = x1 * TMath::Cos(alpha);
1283eee5 494 y = x1 * TMath::Sin(alpha);
495
496 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
497
498 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
499
500 nRotMat++;
501
4b0fdcad 502 }
1283eee5 503
504 //-------------------------------------------------------------
505 // outer spokes (nSectorOuter)
506 //-------------------------------------------------------------
507
508 dm[0] = 0.5*(257.9-146.1);
509 dm[1] = 3.;
510 dm[2] = 2.;
511
512 x1 = dm[0] + 146.;
513
514 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
515
516 dm[1] = dm[1] - 1.;
517 dm[2] = dm[2] - 1.;
518
519 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
520
521 for(ns=0;ns<nOuterSector;ns++){
522
523 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
524 theta1=90.;
525 phi1 *=kRaddeg;
526
527 phi1 = (Float_t)TMath::Nint(phi1);
528
529 phi2 = phi1+90.;
530 if(phi2>360.) phi2 -= 360.;
531 theta2=90.;
532 phi3=0.;
533 theta3=0.;
534
4b0fdcad 535 alpha = phi1 * kDegrad;
1283eee5 536 x = x1 * TMath::Cos(alpha);
537 y = x1 * TMath::Sin(alpha);
538
539 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
540
541 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
542
543 nRotMat++;
544
545 }
4b0fdcad 546
1283eee5 547
4b0fdcad 548
4b0fdcad 549 // --------------------------------------------------------
550 // put the readout chambers into the TPC
551 // --------------------------------------------------------
1283eee5 552
4b0fdcad 553 theta1 = 90.;
554 phi1 = 0.;
555 theta2 = 90.;
556 phi2 = 270.;
557 theta3 = 180.;
558 phi3 = 0.;
559
1283eee5 560 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
4b0fdcad 561
562 z0 = z_side + 250.;
563
564 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
1283eee5 565 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
4b0fdcad 566
567 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
1283eee5 568
569 //----------------------------------------------------
570 // Inner vessel and HV degrader
571 //----------------------------------------------------
572
4b0fdcad 573 dm[0] = 0.;
574 dm[1] = 360.;
575 dm[2] = 4.;
576
577 dm[3] = -250.;
1283eee5 578 dm[4] = 74.4;
4b0fdcad 579 dm[5] = 76.;
1283eee5 580
4b0fdcad 581 dm[6] = -64.5;
582 dm[7] = 50.;
583 dm[8] = 76.;
1283eee5 584
d183a600 585 dm[9] = 64.5;
4b0fdcad 586 dm[10] = 50.;
587 dm[11] = 76.;
1283eee5 588
4b0fdcad 589 dm[12] = 250.;
1283eee5 590 dm[13] = 74.4;
4b0fdcad 591 dm[14] = 76.;
1283eee5 592
593 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
594
595 // cone parts
596
4b0fdcad 597 dm[0] = 0.;
598 dm[1] = 360.;
1283eee5 599 dm[2] = 2.;
600
601 dm[3] = 64.5;
602 dm[4] = 50.;
603 dm[5] = 51.6;
604
605 dm[6] = 250.;
606 dm[7] = 74.4;
607 dm[8] = 76.;
608
609
610 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
611
612 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
613 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
614
615 // barrel part
616
617 dm[0] = 50.;
618 dm[1] = 50.5;
a5371c42 619 dm[2] = 64.5;
1283eee5 620
621 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
622
623 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
624
625 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
626
4b0fdcad 627
1283eee5 628
4b0fdcad 629
1283eee5 630
4b0fdcad 631 // ---------------------------------------------------
632 // volumes ordering
633 // ---------------------------------------------------
634 gMC->Gsord("TPSG", 6);
1283eee5 635
636} // end of function
637
4b0fdcad 638
639
640//_____________________________________________________________________________
641void AliTPCv3::DrawDetector()
642{
643 //
644 // Draw a shaded view of the Time Projection Chamber version 1
645 //
646
647
648 // Set everything unseen
649 gMC->Gsatt("*", "seen", -1);
650 //
651 // Set ALIC mother transparent
652 gMC->Gsatt("ALIC","SEEN",0);
653 //
654 // Set the volumes visible
655 gMC->Gsatt("TPC","SEEN",0);
656 gMC->Gsatt("TGAS","SEEN",0);
657 gMC->Gsatt("TPSG","SEEN",0);
658 gMC->Gsatt("TPHV","SEEN",1);
1283eee5 659 gMC->Gsatt("TPMH","SEEN",1);
660 gMC->Gsatt("TPEC","SEEN",0);
4b0fdcad 661 gMC->Gsatt("TRCS","SEEN",1);
662 gMC->Gsatt("TRCL","SEEN",1);
1283eee5 663 gMC->Gsatt("TPWL","SEEN",1);
664 gMC->Gsatt("TPWI","SEEN",1);
665 gMC->Gsatt("TPWS","SEEN",1);
4b0fdcad 666 gMC->Gsatt("TPW1","SEEN",1);
1283eee5 667 gMC->Gsatt("TPS1","SEEN",1);
668 gMC->Gsatt("TPS2","SEEN",1);
669 gMC->Gsatt("TPG1","SEEN",1);
670 gMC->Gsatt("TPG2","SEEN",1);
671 gMC->Gsatt("TPWC","SEEN",1);
672 gMC->Gsatt("TPSI","SEEN",1);
673 gMC->Gsatt("TPSO","SEEN",1);
674 gMC->Gsatt("TPCO","SEEN",1);
675 gMC->Gsatt("TPOV","SEEN",1);
4b0fdcad 676 gMC->Gsatt("TPVD","SEEN",1);
677 //
678 gMC->Gdopt("hide", "on");
679 gMC->Gdopt("shad", "on");
680 gMC->Gsatt("*", "fill", 7);
681 gMC->SetClipBox(".");
682 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
683 gMC->DefaultRange();
684 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
685 gMC->Gdhead(1111, "Time Projection Chamber");
686 gMC->Gdman(18, 4, "MAN");
687 gMC->Gdopt("hide","off");
688}
689
690//_____________________________________________________________________________
691void AliTPCv3::CreateMaterials()
692{
693 //
694 // Define materials for version 2 of the Time Projection Chamber
695 //
696
697
698 //
699 // Increase maximum number of steps
700 gMC->SetMaxNStep(30000);
701 //
702 AliTPC::CreateMaterials();
703}
704
705//_____________________________________________________________________________
706void AliTPCv3::Init()
707{
708 //
709 // Initialises version 3 of the TPC after that it has been built
710 //
711 Int_t *idtmed = fIdtmed->GetArray()-399;
712
713 AliTPC::Init();
714
715 fIdSens1=gMC->VolId("TGAS"); // drift gas as a sensitive volume
716
717 gMC->SetMaxNStep(30000); // max. number of steps increased
718
719 gMC->Gstpar(idtmed[403],"LOSS",5);
720
721 printf("*** TPC version 3 initialized ***\n");
722 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
723
724 //
725
726}
727
728//_____________________________________________________________________________
729void AliTPCv3::StepManager()
730{
731 //
732 // Called for every step in the Time Projection Chamber
733 //
734
735 //
736 // parameters used for the energy loss calculations
737 //
738 const Float_t prim = 14.35; // number of primary collisions per 1 cm
739 const Float_t poti = 20.77e-9; // first ionization potential for Ne/CO2
740 const Float_t w_ion = 35.97e-9; // energy for the ion-electron pair creation
741
742
743 const Float_t big = 1.e10;
744
745 Int_t id,copy;
746 TLorentzVector pos;
747 Float_t hits[4];
748 Int_t vol[2];
749 TClonesArray &lhits = *fHits;
750
751 vol[1]=0;
752 vol[0]=0;
753
754 //
755
756 gMC->SetMaxStep(big);
757
758 if(!gMC->IsTrackAlive()) return; // particle has disappeared
759
760 Float_t charge = gMC->TrackCharge();
761
762 if(TMath::Abs(charge)<=0.) return; // take only charged particles
763
764
765 id=gMC->CurrentVolID(copy);
766
767 // Check the sensitive volume
768
769 if (id != fIdSens1) return;
770
771 //
772 // charged particle is in the sensitive volume
773 //
774
775 if(gMC->TrackStep() > 0) {
776
777
778 Int_t nel = (Int_t)(((gMC->Edep())-poti)/w_ion) + 1;
779 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
780
781 gMC->TrackPosition(pos);
782 hits[0]=pos[0];
783 hits[1]=pos[1];
784 hits[2]=pos[2];
785
786 //
787 // check the selected side of the TPC
788 //
789
790 if(fSide && fSide*hits[2]<=0.) return;
791
792 hits[3]=(Float_t)nel;
793
794 // Add this hit
795
796 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
797
798 }
799
800 // Stemax calculation for the next step
801
802 Float_t pp;
803 TLorentzVector mom;
804 gMC->TrackMomentum(mom);
805 Float_t ptot=mom.Rho();
806 Float_t beta_gamma = ptot/gMC->TrackMass();
807
69e40cce 808 Int_t pid=gMC->TrackPid();
cc80f89e 809 if((pid==kElectron || pid==kPositron) && ptot > 0.002)
4b0fdcad 810 {
811 pp = prim*1.58; // electrons above 20 MeV/c are on the plateau!
812 }
813 else
814 {
815 pp=prim*BetheBloch(beta_gamma);
816 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
817 }
818
819 Float_t random[1];
820 gMC->Rndm(random,1); // good, old GRNDM from Geant3
821
822 Double_t rnd = (Double_t)random[0];
823
824 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
825
826}
827
828//_____________________________________________________________________________
829Float_t AliTPCv3::BetheBloch(Float_t bg)
830{
831 //
832 // Bethe-Bloch energy loss formula
833 //
834 const Double_t p1=0.76176e-1;
835 const Double_t p2=10.632;
836 const Double_t p3=0.13279e-4;
837 const Double_t p4=1.8631;
838 const Double_t p5=1.9479;
839
840 Double_t dbg = (Double_t) bg;
841
842 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
843
844 Double_t aa = TMath::Power(beta,p4);
845 Double_t bb = TMath::Power(1./dbg,p5);
846
847 bb=TMath::Log(p3+bb);
848
849 return ((Float_t)((p2-aa-bb)*p1/aa));
850}