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