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