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