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