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