]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCv2.cxx
G4 compatibility changes
[u/mrichter/AliRoot.git] / TPC / AliTPCv2.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.18 1999/10/14 16:52:08 fca
19Only use PDG codes and not GEANT ones
20
69e40cce 21Revision 1.17 1999/10/08 06:27:23 fca
22Corrected bug in the HV degrader geometry, thanks to G.Tabary
23
d183a600 24Revision 1.16 1999/10/04 13:39:54 fca
25Correct array index problem
26
cdde5b1e 27Revision 1.15 1999/09/29 09:24:34 fca
28Introduction of the Copyright and cvs Log
29
4c039060 30*/
31
fe4da5cc 32///////////////////////////////////////////////////////////////////////////////
33// //
34// Time Projection Chamber version 2 -- detailed TPC and slow simulation //
35// //
36//Begin_Html
37/*
1439f98e 38<img src="picts/AliTPCv2Class.gif">
fe4da5cc 39*/
40//End_Html
41// //
42// //
43///////////////////////////////////////////////////////////////////////////////
2a49965d 44#include <stdlib.h>
fe4da5cc 45
46#include <TMath.h>
bcac8ae4 47
fe4da5cc 48#include "AliTPCv2.h"
bcac8ae4 49#include "AliTPCD.h"
fe4da5cc 50#include "AliRun.h"
fe4da5cc 51#include "AliConst.h"
69e40cce 52#include "AliPDG.h"
8c555625 53
fe4da5cc 54ClassImp(AliTPCv2)
55
56//_____________________________________________________________________________
57AliTPCv2::AliTPCv2(const char *name, const char *title) :
58 AliTPC(name, title)
59{
60 //
61 // Standard constructor for Time Projection Chamber version 2
62 //
63 fIdSens1=0;
64 fIdSens2=0;
65 SetBufferSize(128000);
66}
67
68//_____________________________________________________________________________
69void AliTPCv2::CreateGeometry()
70{
71 //
72 // Create the geometry of Time Projection Chamber version 2
73 //
74 //Begin_Html
75 /*
1439f98e 76 <img src="picts/AliTPCv2.gif">
fe4da5cc 77 */
78 //End_Html
79 //Begin_Html
80 /*
1439f98e 81 <img src="picts/AliTPCv2Tree.gif">
fe4da5cc 82 */
83 //End_Html
84
8c555625 85 AliTPCParam * fTPCParam = &(fDigParam->GetParam());
86
1283eee5 87 Int_t *idtmed = fIdtmed->GetArray();
88
89 Float_t dm[21];
62a73ee5 90 Int_t idrotm[120];
1283eee5 91
92 Int_t nRotMat = 0;
93
94 Int_t i,ifl1,ifl2;
95
96 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
97 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
fe4da5cc 98
99 // ---------------------------------------------------
100 // sector specification check
101 // ---------------------------------------------------
102 if (fSecAL >= 0) {
103 ifl1 = 0;
104
105 for (i = 0; i < 6; ++i) {
1283eee5 106 if (fSecLows[i] >= 0 && fSecLows[i] < 2*nInnerSector) {
fe4da5cc 107 ifl1 = 1;
108 printf("*** SECTOR %d selected\n",fSecLows[i]);
109 }
110 }
111
112 } else {
113 printf("*** ALL LOWER SECTORS SELECTED ***\n");
8c555625 114 ifl1 = 1;
fe4da5cc 115 }
116
117 if (fSecAU >= 0) {
118 ifl2 = 0;
119
120 for (i = 0; i < 12; ++i) {
1283eee5 121 if (fSecUps[i] > 2*nInnerSector-1 &&
122 fSecUps[i] < 2*(nInnerSector+nOuterSector)) {
fe4da5cc 123 ifl2 = 1;
124 printf("*** SECTOR %d selected\n",fSecUps[i]);
125 }
126 }
127
128 } else {
129 printf("*** ALL UPPER SECTORS SELECTED ***\n");
8c555625 130 ifl1 = 1;
fe4da5cc 131 }
132
133 if (ifl1 == 0 && ifl2 == 0) {
134 printf("*** ERROR: AT LEAST ONE SECTOR MUST BE SPECIFIED ***\n");
135 printf("!!! PROGRAM STOPPED !!!\n");
136 exit(1);
137 }
138
139 if ((fSecAL < 0 || fSecAU < 0) && fSens >= 0) {
140 printf("** ERROR: STRIPS CANNOT BE SPECIFIED FOR ALL SECTORS **\n");
141 printf("!!! PROGRAM STOPPED !!!\n");
142 exit(1);
143 }
1283eee5 144
fe4da5cc 145 // ----------------------------------------------------
1283eee5 146 // FIELD CAGE WITH ENDCAPS - G10
fe4da5cc 147 // THIS IS ALSO A TPC MOTHER VOLUME
148 // ----------------------------------------------------
1283eee5 149
fe4da5cc 150 dm[0] = 76.;
151 dm[1] = 278.;
152 dm[2] = 275.;
1283eee5 153
154 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
155
156 //-----------------------------------------------------
157 // Endcap cover c-fibre 0.86% X0
158 //-----------------------------------------------------
159
160 dm[0] = 78.;
161 dm[1] = 258.;
162 dm[2] = 0.95;
163
164 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
165
166 //-----------------------------------------------------
167 // Drift gas , leave 2 cm at the outer radius
168 // and inner raddius
169 //-----------------------------------------------------
170
171 dm[0] = 78.;
172 dm[1] = 258.;
fe4da5cc 173 dm[2] = 250.;
1283eee5 174
175 gMC->Gsvolu("TGAS", "TUBE", idtmed[3], dm, 3);
176
177 //------------------------------------------------------
178 // membrane holder - carbon fiber
179 //------------------------------------------------------
180
181
182 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
183
184 dm[0] = 252.;
185 dm[1] = 258.;
186 dm[2] = 0.2;
187
188 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
189
190 dm[0] = 78.;
cdde5b1e 191 dm[1] = 82.;
1283eee5 192 dm[2] = 0.1;
193
194 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
195
196 //----------------------------------------------------------
197 // HV membrane - 25 microns of mylar
198 //----------------------------------------------------------
199
200 dm[0] = 82.;
201 dm[1] = 252.;
202 dm[2] = 0.00125;
203
204 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
205
206 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
207
208 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
209
210 //----------------------------------------------------------
211 // "side" gas volume, the same as the drift gas
212 // the readout chambers are placed there.
213 //----------------------------------------------------------
214
215 dm[0] = 78.;
216 dm[1] = 258.;
217 dm[2] = 0.5*(275. - 250.);
218
219 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
220
221 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
222
223 //-----------------------------------------------------------
224 // Readout chambers , 25% of X0, I use Al as the material
225 //-----------------------------------------------------------
226
227 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
228 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
229
230 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
231 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
232
233 Float_t InSecLowEdge = fTPCParam->GetInSecLowEdge();
234 Float_t InSecUpEdge = fTPCParam->GetInSecUpEdge();
235
236 Float_t OuSecLowEdge = fTPCParam->GetOuSecLowEdge();
237 Float_t OuSecUpEdge = fTPCParam->GetOuSecUpEdge();
238
239
240 Float_t SecThick = 2.225; // Al
241
242 Float_t edge = fTPCParam->GetEdge();
243
244 // S (Inner) sectors
245
246 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
247 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
248 dm[2] = 0.5*SecThick;
249 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
250
251 Float_t xCenterS = InSecLowEdge+dm[3];
252
253 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
254
255 // L (Outer) sectors
256
257 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
258 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
259 dm[2] = 0.5*SecThick;
260 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
261
262 Float_t xCenterL = OuSecLowEdge+dm[3];
263
264 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
265
266 Float_t z1 = -z_side + SecThick*0.5;
267
268 //------------------------------------------------------------------
269 // S sectors - "gas sectors" (TRD1)
270 //------------------------------------------------------------------
271
272 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
273 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
274 dm[2] = 0.5*(250. - 0.001);
275 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
276
277 gMC->Gsvolu("TSGA", "TRD1", idtmed[4], dm, 4); // sensitive
278
fe4da5cc 279 // -------------------------------------------------------------
280 // Only for the debugging purpose and resolution calculation
281 // Sensitive strips at the pad-row center
282 // -------------------------------------------------------------
1283eee5 283
284 Int_t ns;
285
286 if(fSens>=0){
287
288 Float_t r1,r2,zz;
289
290 Float_t StripThick = 0.01; // 100 microns
291 Float_t dead = fTPCParam->GetDeadZone();
292
293 gMC->Gsvolu("TSST", "TRD1", idtmed[4], dm, 0);
294
295 dm[2] = 0.5*(250. - 0.002);
296 dm[3] = 0.5 * StripThick;
297
298
299 for (ns = 0; ns < fTPCParam->GetNRowLow(); ns++) {
300
301 r1 = fTPCParam->GetPadRowRadiiLow(ns);
302 r2 = r1 + StripThick;
303 dm[0] = r1 * TMath::Tan(0.5*InnerOpenAngle) - dead;
304 dm[1] = r2 * TMath::Tan(0.5*InnerOpenAngle) - dead;
305
306 zz = -InSecLowEdge -0.5*(InSecUpEdge-InSecLowEdge);
307 zz += r1;
308 zz += dm[3];
309
310 gMC->Gsposp("TSST", ns+1, "TSGA", 0., 0., zz, 0, "ONLY", dm, 4);
311
fe4da5cc 312
1283eee5 313 }
314
315 gMC->Gsord("TSGA", 3);
316
317 } // if strips selected
318
319
320 //-----------------------------------------------------------------
321 // L sectors - "gas sectors" (PGON to avoid overlaps)
322 //-----------------------------------------------------------------
323
324 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
325 dm[0] *= kRaddeg;
326 dm[0] = (Float_t)TMath::Nint(dm[0]);
327
328 dm[1] = OuterOpenAngle*kRaddeg;
329 dm[1] = (Float_t)TMath::Nint(dm[1]);
330
331 dm[2] = 1.;
332 dm[3] = 4.;
333
334 dm[4] = 0.002;
335 dm[5] = OuSecLowEdge;
336 dm[6] = 252.*TMath::Cos(0.5*OuterOpenAngle)-0.002;
337
338 dm[7] = dm[4]+0.2;
339 dm[8] = dm[5];
340 dm[9] = dm[6];
341
342 dm[10] = dm[7];
343 dm[11] = OuSecLowEdge;
344 dm[12] = OuSecUpEdge;
345
346 dm[13] = 250.;
347 dm[14] = dm[11];
348 dm[15] = dm[12];
349
350 gMC->Gsvolu("TLGA","PGON",idtmed[4],dm,16);
8c555625 351
fe4da5cc 352 if (fSens >= 0) {
fe4da5cc 353
1283eee5 354 Float_t rmax = dm[6];
355 Float_t r1,r2;
356 Float_t dead = fTPCParam->GetDeadZone();
8c555625 357
1283eee5 358 Float_t StripThick = 0.01; // 100 microns
8c555625 359
1283eee5 360 gMC->Gsvolu("TLST", "PGON", idtmed[4], dm, 0);
361
362 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
363 dm[0] *= kRaddeg;
364 dm[0] = (Float_t)TMath::Nint(dm[0]);
365
366 dm[1] = OuterOpenAngle*kRaddeg;
367 dm[1] = (Float_t)TMath::Nint(dm[1]);
8c555625 368
fe4da5cc 369 dm[2] = 1.;
1283eee5 370 dm[3] = 2.;
fe4da5cc 371
1283eee5 372 dm[7] = 250.;
fe4da5cc 373
1283eee5 374 Float_t xx = dead/TMath::Tan(0.5*OuterOpenAngle);
fe4da5cc 375
1283eee5 376 for(ns=0;ns<fTPCParam->GetNRowUp();ns++){
fe4da5cc 377
1283eee5 378 r1 = fTPCParam->GetPadRowRadiiUp(ns)-xx;
379 r2 = r1 + StripThick;
380
381 dm[5] = r1;
382 dm[6] = r2;
383
384 dm[8] = r1;
385 dm[9] = r2;
386
387 if(r2+xx < rmax){
388 dm[4] = 0.002;
fe4da5cc 389 }
1283eee5 390 else{
391 dm[4] = 0.202;
392 }
393
394 gMC->Gsposp("TLST",ns+1,"TLGA",xx,0.,0.,0,"ONLY",dm,10);
395
396 }
397
62a73ee5 398 gMC->Gsord("TLGA", 4);
1283eee5 399
400 } // if strips selected
401
402 //------------------------------------------------------------------
403 // Positioning of the S-sector readout chambers
404 //------------------------------------------------------------------
405
406 Float_t zs = 0.5*(250.+0.002);
407
408 Float_t theta1,theta2,theta3;
409 Float_t phi1,phi2,phi3;
410 Float_t alpha;
411 Float_t x,y;
412
413 for(ns=0;ns<nInnerSector;ns++){
414
415 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
416 phi1 *= kRaddeg; // in degrees
417
418 phi1 = (Float_t)TMath::Nint(phi1);
419
420 if (phi1 > 360.) phi1 -= 360.;
fe4da5cc 421
1283eee5 422 theta1 = 90.;
423 phi2 = 90.;
424 theta2 = 180.;
425 phi3 = ns * InnerOpenAngle + InnerAngleShift;
426 phi3 *= kRaddeg; // in degrees
427
428 phi3 = (Float_t)TMath::Nint(phi3);
fe4da5cc 429
1283eee5 430 if(phi3 > 360.) phi3 -= 360.;
431
432 theta3 = 90.;
433
434 alpha = phi3*kDegrad;
435
436 x = xCenterS * TMath::Cos(alpha);
437 y = xCenterS * TMath::Sin(alpha);
438
439 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
440
441 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
442
443 if(fSecAL < 0){
444
445 //---------------------------------------------------------------
446 // position all sectors
447 //---------------------------------------------------------------
448
449 gMC->Gspos("TSGA",ns+1,"TGAS",x,y,zs,idrotm[nRotMat], "ONLY");
450 gMC->Gspos("TSGA",ns+1+nInnerSector,"TGAS",x,y,-zs,idrotm[nRotMat], "ONLY");
fe4da5cc 451 }
1283eee5 452
453 else{
454
455 //---------------------------------------------------------------
456 // position selected sectors
457 //---------------------------------------------------------------
458
459 for(Int_t sel=0;sel<6;sel++){
460
461 if(fSecLows[sel] == ns){
462 gMC->Gspos("TSGA", ns+1, "TGAS", x, y, zs, idrotm[nRotMat], "ONLY");
463 }
464 else if(fSecLows[sel] == ns+nInnerSector){
465 gMC->
466 Gspos("TSGA",ns+1+nInnerSector,"TGAS", x, y,-zs,idrotm[nRotMat],"ONLY");
467 }
fe4da5cc 468 }
fe4da5cc 469 }
1283eee5 470
471 nRotMat++;
472
473 }
fe4da5cc 474
1283eee5 475 //-------------------------------------------------------------------
476 // Positioning of the L-sectors readout chambers
477 //-------------------------------------------------------------------
fe4da5cc 478
1283eee5 479 for(ns=0;ns<nOuterSector;ns++){
480 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
481 phi1 *= kRaddeg; // in degrees
482
483 phi1 = (Float_t)TMath::Nint(phi1);
fe4da5cc 484
1283eee5 485
486 if (phi1 > 360.) phi1 -= 360.;
487
fe4da5cc 488 theta1 = 90.;
1283eee5 489 phi2 = 90.;
490 theta2 = 180.;
491 phi3 = ns * OuterOpenAngle+OuterAngleShift;
492 phi3 *= kRaddeg; // in degrees
fe4da5cc 493
1283eee5 494 phi3 = (Float_t)TMath::Nint(phi3);
fe4da5cc 495
1283eee5 496
497 if(phi3 > 360.) phi3 -= 360.;
498
499 theta3 = 90.;
500
501 alpha = phi3*kDegrad;
502
503 x = xCenterL * TMath::Cos(alpha);
504 y = xCenterL * TMath::Sin(alpha);
505
506 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
507
508
509 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
510
511 nRotMat++;
512
513 }
514
515 //-------------------------------------------------------------------
516 // Positioning of the L-sectors (gas sectors)
517 //-------------------------------------------------------------------
518
519 for(ns=0;ns<nOuterSector;ns++){
520
521 phi1 = ns*OuterOpenAngle + OuterAngleShift;
522 phi1 *= kRaddeg;
fe4da5cc 523
1283eee5 524 phi1 = (Float_t)TMath::Nint(phi1);
525 if(phi1>360.) phi1 -= 360.;
526
527 theta1 = 90.;
528
529 phi2 = 90. + phi1;
530 if(phi2>360.) phi2 -= 360.;
531
532 theta2 = 90.;
533
534 phi3 = 0.;
535 theta3 = 0.;
536
537 if(fSecAU < 0) {
538
539 //--------------------------------------------------------------
540 // position all sectors
541 //--------------------------------------------------------------
542
543 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
544
545 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
546
547 nRotMat++;
548
549 // reflection !!
550
551 phi3 = 0.;
552 theta3 = 180.;
553
554 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
555
556 gMC->Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
557
558 nRotMat++;
559 }
560
561 else{
562
563 //---------------------------------------------------------------
564 // position selected sectors
565 //---------------------------------------------------------------
566
567 for(Int_t sel=0;sel<12;sel++){
568
569 if(fSecUps[sel] == ns+2*nInnerSector){
570
571 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
572 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
573 nRotMat++;
574
575 }
576 else if(fSecUps[sel] == ns+2*nInnerSector+nOuterSector){
577
578 // reflection
579
580 phi3 = 0.;
581 theta3 = 180.;
582
583 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
584 gMC->
585 Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
586 nRotMat++;
587
588 }
589
590 }
591
592 }
593
594 }
595
596 Float_t z0 = z_side - 0.95;
597
598 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
599
600 // ==========================================================
601 // wheels
602 // ==========================================================
603
604 //
605 // auxilary structures
606 //
607
608
609 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
610
611 // ----------------------------------------------------------
612 // Large wheel -> positioned in the TPC
613 // ----------------------------------------------------------
614
615
616 z0 = 263.5; // TPC length - 1/2 spoke wheel width
617
618 dm[0] = 258.;
619 dm[1] = 278.;
620 dm[2] = 11.5;
621
622 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
623
624 dm[0] = dm[0]+2.;
625 dm[1] = 278.;
626 dm[2] = dm[2]-2.;
627
628 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
629
630 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
631 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
632
633 //
634 // Outer vessel + CO2 HV degrader
635 //
636
637 dm[0] = 260.;
638 dm[1] = 278.;
639 dm[2] = 252.;
640
641 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
642
643 dm[0] = 275.;
644 dm[1] = 278.;
645
646 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
647
648 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
649
650
651 // G10 plugs
652
653 dm[0] = 258.;
654 dm[1] = 260.;
655 dm[2] = 1.;
656
657 gMC->Gsvolu("TPG1","TUBE",idtmed[8],dm,3);
658 gMC->Gspos("TPG1",1,"TPCO",0.,0.,251.,0,"ONLY");
659 gMC->Gspos("TPG1",2,"TPCO",0.,0.,-251.,0,"ONLY");
660
661 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
662
663
664 //----------------------------------------------------------
665 // Small wheel -> positioned in "side gas
666 //----------------------------------------------------------
667
668 dm[0] = 78.;
669 dm[1] = 82.;
670 dm[2] = 11.5;
671
672 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
673
674 dm[0] = 78.;
675 dm[1] = dm[1]-2;
676 dm[2] = dm[2]-2.;
677
678 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
679
680 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
681
682 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
683
684 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
685
686
687 // to avoid overlaps
688
689 dm[0] = 76.;
690 dm[1] = 78.;
691 dm[2] = 11.5;
692
693 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
694
695 dm[2] = 9.5;
696
697 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
698
699 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
700
701 z0= 263.5;
702
703 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
704 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
705
706 // G10 plug
707
708 dm[0] = 76.;
7d7bb9e5 709 dm[1] = 78.;
710 dm[2] = 1.;
1283eee5 711
712 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
713
714 z0 = 251.;
715
716 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
717 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
718
719
720 //---------------------------------------------------------
721 // central wheel 6 (radial direction) x 4 (along z) cm2
722 //---------------------------------------------------------
723
724 dm[0] = 140.;
725 dm[1] = 146.;
726 dm[2] = 2.;
727
728 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
729
730 dm[0] = dm[0] + 2.;
731 dm[1] = dm[1] - 2.;
732 dm[2] = dm[2] - 1.;
733
734 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
735
736 z0 = z_side - 1.9 - 2.;
737
738 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
739
740 //
741
742 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
743
744
745 //---------------------------------------------------------
746 // inner spokes (nSectorInner)
747 //---------------------------------------------------------
748
749 dm[0] = 0.5*(139.9-82.1);
750 dm[1] = 3.;
751 dm[2] = 2.;
752
753 Float_t x1 = dm[0]+82.;
754
755 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
756
757 dm[1] = dm[1]-1.;
758 dm[2] = dm[2]-1.;
759
760 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
761
762 for(ns=0;ns<nInnerSector;ns++){
763
764 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
765 theta1=90.;
766 phi1 *=kRaddeg;
767
768 phi1 = (Float_t)TMath::Nint(phi1);
769 if(phi1>360.) phi1 -= 360.;
770
771 phi2 = phi1+90.;
772 if(phi2>360.) phi2 -= 360.;
773 theta2=90.;
774 phi3=0.;
775 theta3=0.;
776
777 alpha = phi1 * kDegrad;
778 x = x1 * TMath::Cos(alpha);
779 y = x1 * TMath::Sin(alpha);
780
781 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
782
783 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
784
785 nRotMat++;
786
787 }
788
789 //-------------------------------------------------------------
790 // outer spokes (nSectorOuter)
791 //-------------------------------------------------------------
792
793 dm[0] = 0.5*(257.9-146.1);
794 dm[1] = 3.;
795 dm[2] = 2.;
796
797 x1 = dm[0] + 146.;
798
799 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
800
801 dm[1] = dm[1] - 1.;
802 dm[2] = dm[2] - 1.;
803
804 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
805
806 for(ns=0;ns<nOuterSector;ns++){
807
808 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
809 theta1=90.;
810 phi1 *=kRaddeg;
811
812 phi1 = (Float_t)TMath::Nint(phi1);
813 if(phi1>360.) phi1 -= 360.;
814
815 phi2 = phi1+90.;
816 if(phi2>360.) phi2 -= 360.;
817 theta2=90.;
818 phi3=0.;
819 theta3=0.;
820
821 alpha = phi1 * kDegrad;
822 x = x1 * TMath::Cos(alpha);
823 y = x1 * TMath::Sin(alpha);
824
825 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
826
827 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
828
829 nRotMat++;
830
831 }
832
833
834
835 // --------------------------------------------------------
836 // put the readout chambers into the TPC
837 // --------------------------------------------------------
838
839 theta1 = 90.;
840 phi1 = 0.;
841 theta2 = 90.;
842 phi2 = 270.;
843 theta3 = 180.;
844 phi3 = 0.;
845
846 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
847
848 z0 = z_side + 250.;
849
850 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
851 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
852
853 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
854
855 //----------------------------------------------------
856 // Inner vessel and HV degrader
857 //----------------------------------------------------
858
859 dm[0] = 0.;
860 dm[1] = 360.;
861 dm[2] = 4.;
862
863 dm[3] = -250.;
864 dm[4] = 74.4;
865 dm[5] = 76.;
866
867 dm[6] = -64.5;
868 dm[7] = 50.;
869 dm[8] = 76.;
870
d183a600 871 dm[9] = 64.5;
1283eee5 872 dm[10] = 50.;
873 dm[11] = 76.;
874
875 dm[12] = 250.;
876 dm[13] = 74.4;
877 dm[14] = 76.;
878
879 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
880
881 // cone parts
882
883 dm[0] = 0.;
884 dm[1] = 360.;
885 dm[2] = 2.;
886
887 dm[3] = 64.5;
888 dm[4] = 50.;
889 dm[5] = 51.6;
890
891 dm[6] = 250.;
892 dm[7] = 74.4;
893 dm[8] = 76.;
894
895
896 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
897
898 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
899 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
900
901 // barrel part
902
903 dm[0] = 50.;
904 dm[1] = 50.5;
a5371c42 905 dm[2] = 64.5;
1283eee5 906
907 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
908
909 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
910
911 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
912
913
914 // ---------------------------------------------------
915 // volumes ordering
916 // ---------------------------------------------------
917
918 gMC->Gsord("TGAS", 6);
919 gMC->Gsord("TPSG", 6);
920
921
922
923} // end of function
fe4da5cc 924
925//_____________________________________________________________________________
8c555625 926void AliTPCv2::DrawDetector()
fe4da5cc 927{
928 //
929 // Draw a shaded view of the Time Projection Chamber version 1
930 //
931
fe4da5cc 932 // Set everything unseen
cfce8870 933 gMC->Gsatt("*", "seen", -1);
fe4da5cc 934 //
935 // Set ALIC mother transparent
cfce8870 936 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 937 //
938 // Set the volumes visible
cfce8870 939 gMC->Gsatt("TPC","SEEN",0);
940 gMC->Gsatt("TGAS","SEEN",0);
941 gMC->Gsatt("TPSG","SEEN",0);
942 gMC->Gsatt("TPHV","SEEN",1);
1283eee5 943 gMC->Gsatt("TPMH","SEEN",1);
944 gMC->Gsatt("TPEC","SEEN",0);
cfce8870 945 gMC->Gsatt("TRCS","SEEN",1);
946 gMC->Gsatt("TRCL","SEEN",1);
1283eee5 947 gMC->Gsatt("TPWL","SEEN",1);
948 gMC->Gsatt("TPWI","SEEN",1);
949 gMC->Gsatt("TPWS","SEEN",1);
cfce8870 950 gMC->Gsatt("TPW1","SEEN",1);
1283eee5 951 gMC->Gsatt("TPS1","SEEN",1);
952 gMC->Gsatt("TPS2","SEEN",1);
953 gMC->Gsatt("TPG1","SEEN",1);
954 gMC->Gsatt("TPG2","SEEN",1);
955 gMC->Gsatt("TPWC","SEEN",1);
956 gMC->Gsatt("TPSI","SEEN",1);
957 gMC->Gsatt("TPSO","SEEN",1);
958 gMC->Gsatt("TPCO","SEEN",1);
959 gMC->Gsatt("TPOV","SEEN",1);
cfce8870 960 gMC->Gsatt("TPVD","SEEN",1);
fe4da5cc 961 //
cfce8870 962 gMC->Gdopt("hide", "on");
963 gMC->Gdopt("shad", "on");
964 gMC->Gsatt("*", "fill", 7);
965 gMC->SetClipBox(".");
966 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
967 gMC->DefaultRange();
968 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
969 gMC->Gdhead(1111, "Time Projection Chamber");
970 gMC->Gdman(18, 4, "MAN");
971 gMC->Gdopt("hide","off");
fe4da5cc 972}
973
974//_____________________________________________________________________________
975void AliTPCv2::CreateMaterials()
976{
977 //
978 // Define materials for version 2 of the Time Projection Chamber
979 //
980
fe4da5cc 981 //
982 // Increase maximum number of steps
cfce8870 983 gMC->SetMaxNStep(30000);
fe4da5cc 984 //
985 AliTPC::CreateMaterials();
986}
987
988//_____________________________________________________________________________
989void AliTPCv2::Init()
990{
991 //
992 // Initialises version 2 of the TPC after that it has been built
993 //
ad51aeb0 994 Int_t *idtmed = fIdtmed->GetArray()-399;
fe4da5cc 995 AliTPC::Init();
cfce8870 996 fIdSens1=gMC->VolId("TLGA"); // L-sector
997 fIdSens2=gMC->VolId("TSGA"); // S-sector
998 fIdSens3=gMC->VolId("TSST"); // strip - S-sector (not always used)
999 fIdSens4=gMC->VolId("TLST"); // strip - S-sector (not always used)
fe4da5cc 1000
cfce8870 1001 gMC->SetMaxNStep(30000); // max. number of steps increased
fe4da5cc 1002
cfce8870 1003 gMC->Gstpar(idtmed[403],"LOSS",5);
fe4da5cc 1004
1005 printf("*** TPC version 2 initialized ***\n");
cfce8870 1006 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
fe4da5cc 1007
1008 //
1009
1010}
1011
1012//_____________________________________________________________________________
1013void AliTPCv2::StepManager()
1014{
1015 //
1016 // Called for every step in the Time Projection Chamber
1017 //
1018
1019 //
1020 // parameters used for the energy loss calculations
1021 //
62a73ee5 1022 const Float_t prim = 14.35; // number of primary collisions per 1 cm
1023 const Float_t poti = 20.77e-9; // first ionization potential for Ne/CO2
1024 const Float_t w_ion = 35.97e-9; // energy for the ion-electron pair creation
8022212f 1025
1026 // const Float_t prim = 17.65;
1027 // const Float_t poti = 19.02e-9;
1028 // const Float_t w_ion = 33.06e-9;
fe4da5cc 1029
1030
1031 const Float_t big = 1.e10;
1032
1033 Int_t id,copy;
1034 Float_t hits[4];
1035 Int_t vol[2];
1036 TClonesArray &lhits = *fHits;
0a6d8768 1037 TLorentzVector pos;
1283eee5 1038
1039 AliTPCParam *fTPCParam = &(fDigParam->GetParam());
fe4da5cc 1040
1041 vol[1]=0;
1042
1043 //
1044
cfce8870 1045 gMC->SetMaxStep(big);
fe4da5cc 1046
0a6d8768 1047 if(!gMC->IsTrackAlive()) return; // particle has disappeared
fe4da5cc 1048
cfce8870 1049 Float_t charge = gMC->TrackCharge();
fe4da5cc 1050
1051 if(TMath::Abs(charge)<=0.) return; // take only charged particles
1052
1053
0a6d8768 1054 id=gMC->CurrentVolID(copy);
fe4da5cc 1055
1056 // Check the sensitive volume
1057
1058 if(id == fIdSens1)
1059 {
1283eee5 1060 vol[0] = copy + fTPCParam->GetNInnerSector()-1; // L-sector number
fe4da5cc 1061 }
1062 else if(id == fIdSens2)
1063 {
1283eee5 1064 vol[0] = copy-1; // S-sector number
fe4da5cc 1065 }
0a6d8768 1066 else if(id == fIdSens3 && gMC->IsTrackEntering())
fe4da5cc 1067 {
1283eee5 1068 vol[1] = copy-1; // row number
0a6d8768 1069 id = gMC->CurrentVolOffID(1,copy);
1283eee5 1070 vol[0] = copy-1; // sector number (S-sector)
fe4da5cc 1071
0a6d8768 1072 gMC->TrackPosition(pos);
1073 hits[0]=pos[0];
1074 hits[1]=pos[1];
1075 hits[2]=pos[2];
fe4da5cc 1076 hits[3]=0.; // this hit has no energy loss
1077 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1078 }
0a6d8768 1079 else if(id == fIdSens4 && gMC->IsTrackEntering())
fe4da5cc 1080 {
1283eee5 1081 vol[1] = copy-1; // row number
0a6d8768 1082 id = gMC->CurrentVolOffID(1,copy);
1283eee5 1083 vol[0] = copy+fTPCParam->GetNInnerSector()-1; // sector number (L-sector)
fe4da5cc 1084
0a6d8768 1085 gMC->TrackPosition(pos);
1086 hits[0]=pos[0];
1087 hits[1]=pos[1];
1088 hits[2]=pos[2];
fe4da5cc 1089 hits[3]=0.; // this hit has no energy loss
1090 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1091 }
1092 else return;
1093
1094 //
1095 // charged particle is in the sensitive volume
1096 //
1097
cfce8870 1098 if(gMC->TrackStep() > 0) {
fe4da5cc 1099
cfce8870 1100 Int_t nel = (Int_t)(((gMC->Edep())-poti)/w_ion) + 1;
fe4da5cc 1101 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
1102
0a6d8768 1103 gMC->TrackPosition(pos);
1104 hits[0]=pos[0];
1105 hits[1]=pos[1];
1106 hits[2]=pos[2];
fe4da5cc 1107 hits[3]=(Float_t)nel;
1108
1109 // Add this hit
1110
1111 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1112
1113 }
1114
1115 // Stemax calculation for the next step
1116
1117 Float_t pp;
0a6d8768 1118 TLorentzVector mom;
1119 gMC->TrackMomentum(mom);
1120 Float_t ptot=mom.Rho();
1121 Float_t beta_gamma = ptot/gMC->TrackMass();
fe4da5cc 1122
69e40cce 1123 Int_t pid=gMC->TrackPid();
1124 if((pid==kElectron || pid==kPositron || pid==kGamma) && ptot > 0.002)
fe4da5cc 1125 {
1126 pp = prim*1.58; // electrons above 20 MeV/c are on the plateau!
1127 }
1128 else
1129 {
1130 pp=prim*BetheBloch(beta_gamma);
1131 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
1132 }
1133
1134 Float_t random[1];
cfce8870 1135 gMC->Rndm(random,1); // good, old GRNDM from Geant3
fe4da5cc 1136
1137 Double_t rnd = (Double_t)random[0];
1138
cfce8870 1139 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
fe4da5cc 1140
1141}
1142
1143//_____________________________________________________________________________
1144Float_t AliTPCv2::BetheBloch(Float_t bg)
1145{
1146 //
1147 // Bethe-Bloch energy loss formula
1148 //
1149 const Double_t p1=0.76176e-1;
1150 const Double_t p2=10.632;
1151 const Double_t p3=0.13279e-4;
1152 const Double_t p4=1.8631;
1153 const Double_t p5=1.9479;
1154
1155 Double_t dbg = (Double_t) bg;
1156
1157 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
1158
1159 Double_t aa = TMath::Power(beta,p4);
1160 Double_t bb = TMath::Power(1./dbg,p5);
1161
1162 bb=TMath::Log(p3+bb);
1163
1164 return ((Float_t)((p2-aa-bb)*p1/aa));
1165}