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