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