Corrected bug in the TPC geometry, thanks to Ivana Hrivnacova
[u/mrichter/AliRoot.git] / TPC / AliTPCv1.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$
e94dd9ca 18Revision 1.16 2000/04/17 09:37:33 kowal2
19removed obsolete AliTPCDigitsDisplay.C
20
cc80f89e 21Revision 1.15.8.2 2000/04/10 08:29:48 kowal2
22
23Different pad geometry for different sectors
24Updated readouch chambers geometry
25
26Revision 1.15.8.1 2000/04/10 07:56:53 kowal2
27Not used anymore - removed
28
29Revision 1.15 1999/11/04 17:28:07 fca
30Correct barrel part of HV Degrader
31
a5371c42 32Revision 1.14 1999/10/08 06:27:23 fca
33Corrected bug in the HV degrader geometry, thanks to G.Tabary
34
d183a600 35Revision 1.13 1999/10/04 13:39:54 fca
36Correct array index problem
37
cdde5b1e 38Revision 1.12 1999/09/29 09:24:34 fca
39Introduction of the Copyright and cvs Log
40
4c039060 41*/
42
fe4da5cc 43///////////////////////////////////////////////////////////////////////////////
44// //
45// Time Projection Chamber version 1 -- detailed TPC and fast simulation //
46// //
47//Begin_Html
48/*
1439f98e 49<img src="picts/AliTPCv1Class.gif">
fe4da5cc 50*/
51//End_Html
52// //
53// //
54///////////////////////////////////////////////////////////////////////////////
55
56#include <TMath.h>
57#include <TGeometry.h>
58#include <TNode.h>
59#include <TBRIK.h>
60#include <TTUBE.h>
61#include "AliTPCv1.h"
62#include "AliRun.h"
63#include <iostream.h>
64#include <fstream.h>
65
66#include "AliMC.h"
67#include "AliConst.h"
68
8c555625 69#include "AliTPCParam.h"
cc80f89e 70#include "AliTPCDigitsArray.h"
8c555625 71
fe4da5cc 72ClassImp(AliTPCv1)
73
74//_____________________________________________________________________________
75AliTPCv1::AliTPCv1(const char *name, const char *title)
76 :AliTPC(name, title) {
77 //
78 // Standard constructor for Time Projection Chamber
79 //
80 fIdSens1=fIdSens2=0;
81}
82
83//_____________________________________________________________________________
84void AliTPCv1::CreateGeometry()
85{
86 //
87 // Creates geometry for Time Projection Chamber version 1
88 // Detailed geometry -- Fast simulation
89 // Origin M.Kowalski
90 //
91 //Begin_Html
92 /*
1439f98e 93 <img src="picts/AliTPCv1.gif">
fe4da5cc 94 */
95 //End_Html
96 //Begin_Html
97 /*
1439f98e 98 <img src="picts/AliTPCv1Tree.gif">
fe4da5cc 99 */
100 //End_Html
101
8c555625 102
1283eee5 103 Int_t *idtmed = fIdtmed->GetArray();
8c555625 104
1283eee5 105 Float_t dm[21];
62a73ee5 106 Int_t idrotm[120];
1283eee5 107
108 Int_t nRotMat = 0;
109
110
fe4da5cc 111 // ----------------------------------------------------
1283eee5 112 // FIELD CAGE WITH ENDCAPS - G10
fe4da5cc 113 // THIS IS ALSO A TPC MOTHER VOLUME
114 // ----------------------------------------------------
1283eee5 115
fe4da5cc 116 dm[0] = 76.;
117 dm[1] = 278.;
118 dm[2] = 275.;
1283eee5 119
120 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
121
122 //-----------------------------------------------------
123 // Endcap cover c-fibre 0.86% X0
124 //-----------------------------------------------------
125
126 dm[0] = 78.;
127 dm[1] = 258.;
128 dm[2] = 0.95;
129
130 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
131
132 //-----------------------------------------------------
133 // Drift gas , leave 2 cm at the outer radius
134 // and inner raddius
135 //-----------------------------------------------------
136
137 dm[0] = 78.;
138 dm[1] = 258.;
fe4da5cc 139 dm[2] = 250.;
fe4da5cc 140
1283eee5 141 gMC->Gsvolu("TGAS", "TUBE", idtmed[3], dm, 3);
142
143
144 //------------------------------------------------------
145 // membrane holder - carbon fiber
146 //------------------------------------------------------
147
148
149 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
150
151 dm[0] = 252.;
152 dm[1] = 258.;
153 dm[2] = 0.2;
154
155 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
156
157 dm[0] = 78.;
cdde5b1e 158 dm[1] = 82.;
1283eee5 159 dm[2] = 0.1;
160
161 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
162
163 //----------------------------------------------------------
164 // HV membrane - 25 microns of mylar
165 //----------------------------------------------------------
166
167 dm[0] = 82.;
168 dm[1] = 252.;
169 dm[2] = 0.00125;
170
171 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
172
173 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
174
175 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
176
177 //----------------------------------------------------------
178 // "side" gas volume, the same as the drift gas
179 // the readout chambers are placed there.
180 //----------------------------------------------------------
181
182 dm[0] = 78.;
183 dm[1] = 258.;
184 dm[2] = 0.5*(275. - 250.);
185
186 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
187
188 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
189
190 //-----------------------------------------------------------
191 // Readout chambers , 25% of X0, I use Al as the material
192 //-----------------------------------------------------------
193
194 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
195 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
196
197 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
198 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
199
200
201 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
202 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
203
204
cc80f89e 205 Float_t InSecLowEdge = fTPCParam->GetInnerRadiusLow();
206 Float_t InSecUpEdge = fTPCParam->GetInnerRadiusUp();
1283eee5 207
cc80f89e 208 Float_t OuSecLowEdge = fTPCParam->GetOuterRadiusLow();
209 Float_t OuSecUpEdge = fTPCParam->GetOuterRadiusUp();
1283eee5 210
211 Float_t SecThick = 2.225; // Al
212
1283eee5 213 // S (Inner) sectors
214
cc80f89e 215 Float_t LowEdge = fTPCParam->GetInnerFrameSpace();
216
217 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-LowEdge;
218 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-LowEdge;
1283eee5 219 dm[2] = 0.5*SecThick;
220 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
221
222 Float_t xCenterS = InSecLowEdge+dm[3];
223
224 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
225
226 // L (Outer) sectors
227
cc80f89e 228 Float_t UpEdge = fTPCParam->GetOuterFrameSpace();
229
230 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-UpEdge;
231 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-UpEdge;
1283eee5 232 dm[2] = 0.5*SecThick;
233 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
234
235 Float_t xCenterL = OuSecLowEdge+dm[3];
236
237 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
238
239 Float_t z1 = -z_side + SecThick*0.5;
240
241 //------------------------------------------------------------------
242 // S sectors - "gas sectors" (TRD1)
243 //------------------------------------------------------------------
244
245 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
246 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
247 dm[2] = 0.5*(250. - 0.001);
248 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
249
250 gMC->Gsvolu("TSGA", "TRD1", idtmed[3], dm, 4); // nonsensitive
251
252 //------------------------------------------------------------------
253 // sensitive strips - "pad rows"
254 //------------------------------------------------------------------
255
256 Int_t ns;
257 Float_t r1,r2,zz;
258
259 Float_t StripThick = 0.01; // 100 microns
cc80f89e 260 Float_t dead;
1283eee5 261
262 gMC->Gsvolu("TSST", "TRD1", idtmed[4], dm, 0);
263
264 dm[2] = 0.5*(250. - 0.002);
265 dm[3] = 0.5 * StripThick;
266
8c555625 267
1283eee5 268 // S-sector
8c555625 269
cc80f89e 270 dead = fTPCParam->GetInnerWireMount();
271
1283eee5 272 for (ns = 0; ns < fTPCParam->GetNRowLow(); ns++) {
273
274 r1 = fTPCParam->GetPadRowRadiiLow(ns);
275 r2 = r1 + StripThick;
276 dm[0] = r1 * TMath::Tan(0.5*InnerOpenAngle) - dead;
277 dm[1] = r2 * TMath::Tan(0.5*InnerOpenAngle) - dead;
278
279 zz = -InSecLowEdge -0.5*(InSecUpEdge-InSecLowEdge);
280 zz += r1;
281 zz += dm[3];
282
283 gMC->Gsposp("TSST", ns+1, "TSGA", 0., 0., zz, 0, "ONLY", dm, 4);
284
8c555625 285
fe4da5cc 286 }
8c555625 287
1283eee5 288 //-----------------------------------------------------------------
289 // L sectors - "gas sectors" (PGON to avoid overlaps)
290 //-----------------------------------------------------------------
291
292 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
293 dm[0] *= kRaddeg;
294 dm[0] = (Float_t)TMath::Nint(dm[0]);
295
296 dm[1] = OuterOpenAngle*kRaddeg;
297 dm[1] = (Float_t)TMath::Nint(dm[1]);
298
299 dm[2] = 1.;
300 dm[3] = 4.;
301
302 dm[4] = 0.002;
303 dm[5] = OuSecLowEdge;
304 dm[6] = 252.*TMath::Cos(0.5*OuterOpenAngle)-0.002;
305
306 dm[7] = dm[4]+0.2;
307 dm[8] = dm[5];
308 dm[9] = dm[6];
309
310 dm[10] = dm[7];
311 dm[11] = OuSecLowEdge;
312 dm[12] = OuSecUpEdge;
313
314 dm[13] = 250.;
315 dm[14] = dm[11];
316 dm[15] = dm[12];
317
318 gMC->Gsvolu("TLGA","PGON",idtmed[3],dm,16);
319
320 //------------------------------------------------------------------
321 // sensitive strips - "pad rows"
322 //------------------------------------------------------------------
323
324 Float_t rmax = dm[6];
325
326 // L-sectors
327
328 gMC->Gsvolu("TLST", "PGON", idtmed[4], dm, 0);
329
330 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
331 dm[0] *= kRaddeg;
332 dm[0] = (Float_t)TMath::Nint(dm[0]);
333
334 dm[1] = OuterOpenAngle*kRaddeg;
335 dm[1] = (Float_t)TMath::Nint(dm[1]);
336
337 dm[2] = 1.;
338 dm[3] = 2.;
339
340 dm[7] = 250.;
341
cc80f89e 342 dead = fTPCParam->GetOuterWireMount();
343
1283eee5 344 Float_t xx = dead/TMath::Tan(0.5*OuterOpenAngle);
345
346 for(ns=0;ns<fTPCParam->GetNRowUp();ns++){
347
348 r1 = fTPCParam->GetPadRowRadiiUp(ns)-xx;
349 r2 = r1 + StripThick;
8c555625 350
1283eee5 351 dm[5] = r1;
352 dm[6] = r2;
353
354 dm[8] = r1;
355 dm[9] = r2;
356
357 if(r2+xx < rmax){
358 dm[4] = 0.002;
359 }
360 else{
361 dm[4] = 0.202;
362 }
363
364 gMC->Gsposp("TLST",ns+1,"TLGA",xx,0.,0.,0,"ONLY",dm,10);
8c555625 365
fe4da5cc 366 }
fe4da5cc 367
1283eee5 368 //------------------------------------------------------------------
369 // Positioning of the S-sector readout chambers
370 //------------------------------------------------------------------
371
372 Float_t zs = 0.5*(250.+0.002);
373
374 Float_t theta1,theta2,theta3;
375 Float_t phi1,phi2,phi3;
376 Float_t alpha;
377 Float_t x,y;
378
379 for(ns=0;ns<nInnerSector;ns++){
380
381 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
382 phi1 *= kRaddeg; // in degrees
383
384 phi1 = (Float_t)TMath::Nint(phi1);
385
386 if (phi1 > 360.) phi1 -= 360.;
62a73ee5 387
1283eee5 388
fe4da5cc 389 theta1 = 90.;
390 phi2 = 90.;
391 theta2 = 180.;
1283eee5 392 phi3 = ns * InnerOpenAngle + InnerAngleShift;
393 phi3 *= kRaddeg; // in degrees
394
395 phi3 = (Float_t)TMath::Nint(phi3);
396
397 if(phi3 > 360.) phi3 -= 360.;
398
fe4da5cc 399 theta3 = 90.;
1283eee5 400
401 alpha = phi3*kDegrad;
402
403 x = xCenterS * TMath::Cos(alpha);
404 y = xCenterS * TMath::Sin(alpha);
405
406 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
407
408 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
409
410 gMC->Gspos("TSGA",ns+1,"TGAS",x,y,zs,idrotm[nRotMat], "ONLY");
411 gMC->Gspos("TSGA",ns+1+nInnerSector,"TGAS",x,y,-zs,idrotm[nRotMat], "ONLY");
412
413 nRotMat++;
414
415 }
fe4da5cc 416
1283eee5 417 //-------------------------------------------------------------------
418 // Positioning of the L-sectors readout chambers
419 //-------------------------------------------------------------------
fe4da5cc 420
1283eee5 421 for(ns=0;ns<nOuterSector;ns++){
422 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
423 phi1 *= kRaddeg; // in degrees
fe4da5cc 424
1283eee5 425 phi1 = (Float_t)TMath::Nint(phi1);
fe4da5cc 426
1283eee5 427
428 if (phi1 > 360.) phi1 -= 360.;
429
fe4da5cc 430 theta1 = 90.;
431 phi2 = 90.;
432 theta2 = 180.;
1283eee5 433 phi3 = ns * OuterOpenAngle+OuterAngleShift;
434 phi3 *= kRaddeg; // in degrees
435
436 phi3 = (Float_t)TMath::Nint(phi3);
437
438
439 if(phi3 > 360.) phi3 -= 360.;
440
fe4da5cc 441 theta3 = 90.;
1283eee5 442
443 alpha = phi3*kDegrad;
444
445 x = xCenterL * TMath::Cos(alpha);
446 y = xCenterL * TMath::Sin(alpha);
447
448 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
449
450
451 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
452
453 nRotMat++;
454
fe4da5cc 455 }
fe4da5cc 456
1283eee5 457 //-------------------------------------------------------------------
458 // Positioning of the L-sectors (gas sectors)
459 //-------------------------------------------------------------------
460
461 for(ns=0;ns<nOuterSector;ns++){
462
463 phi1 = ns*OuterOpenAngle + OuterAngleShift;
464 phi1 *= kRaddeg;
465
466 phi1 = (Float_t)TMath::Nint(phi1);
467 if(phi1>360.) phi1 -= 360.;
468
469 theta1 = 90.;
470
471 phi2 = 90. + phi1;
472 if(phi2>360.) phi2 -= 360.;
473
474 theta2 = 90.;
475
476 phi3 = 0.;
477 theta3 = 0.;
478
479 alpha = phi1*kDegrad;
480
481
482 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
483
484
485 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
486
487 nRotMat++;
488
489 // reflection !!
490
491 phi3 = 0.;
492 theta3 = 180.;
493
494 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
495
496 gMC->Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
497
498 nRotMat++;
499 }
fe4da5cc 500
1283eee5 501 Float_t z0 = z_side - 0.95;
502
503 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
504
fe4da5cc 505 // ==========================================================
506 // wheels
507 // ==========================================================
1283eee5 508
509 //
510 // auxilary structures
511 //
512
513
514 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
515
fe4da5cc 516 // ----------------------------------------------------------
517 // Large wheel -> positioned in the TPC
518 // ----------------------------------------------------------
1283eee5 519
520
521 z0 = 263.5; // TPC length - 1/2 spoke wheel width
522
523 dm[0] = 258.;
fe4da5cc 524 dm[1] = 278.;
525 dm[2] = 11.5;
fe4da5cc 526
1283eee5 527 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
528
529 dm[0] = dm[0]+2.;
530 dm[1] = 278.;
531 dm[2] = dm[2]-2.;
532
533 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
534
535 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
536 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
537
538 //
539 // Outer vessel + CO2 HV degrader
540 //
541
542 dm[0] = 260.;
543 dm[1] = 278.;
544 dm[2] = 252.;
545
546 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
547
548 dm[0] = 275.;
fe4da5cc 549 dm[1] = 278.;
fe4da5cc 550
1283eee5 551 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
552
553 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
554
555
e94dd9ca 556
1283eee5 557
558 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
559
560
561 //----------------------------------------------------------
562 // Small wheel -> positioned in "side gas
563 //----------------------------------------------------------
564
565 dm[0] = 78.;
fe4da5cc 566 dm[1] = 82.;
567 dm[2] = 11.5;
1283eee5 568
569 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
570
571 dm[0] = 78.;
572 dm[1] = dm[1]-2;
573 dm[2] = dm[2]-2.;
574
575 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
fe4da5cc 576
1283eee5 577 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
578
579 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
580
581 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
582
583
584 // to avoid overlaps
585
586 dm[0] = 76.;
587 dm[1] = 78.;
588 dm[2] = 11.5;
589
590 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
591
fe4da5cc 592 dm[2] = 9.5;
1283eee5 593
594 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
595
596 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
597
598 z0= 263.5;
fe4da5cc 599
1283eee5 600 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
601 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
602
603 // G10 plug
604
605 dm[0] = 76.;
7d7bb9e5 606 dm[1] = 78.;
607 dm[2] = 1.;
1283eee5 608
609 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
610
611 z0 = 251.;
612
613 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
614 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
615
616
617 //---------------------------------------------------------
618 // central wheel 6 (radial direction) x 4 (along z) cm2
619 //---------------------------------------------------------
620
621 dm[0] = 140.;
622 dm[1] = 146.;
fe4da5cc 623 dm[2] = 2.;
1283eee5 624
625 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
626
627 dm[0] = dm[0] + 2.;
628 dm[1] = dm[1] - 2.;
629 dm[2] = dm[2] - 1.;
630
631 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
632
633 z0 = z_side - 1.9 - 2.;
634
635 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
636
637 //
638
639 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
640
641
642 //---------------------------------------------------------
643 // inner spokes (nSectorInner)
644 //---------------------------------------------------------
645
646 dm[0] = 0.5*(139.9-82.1);
fe4da5cc 647 dm[1] = 3.;
648 dm[2] = 2.;
1283eee5 649
650 Float_t x1 = dm[0]+82.;
651
652 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
653
654 dm[1] = dm[1]-1.;
655 dm[2] = dm[2]-1.;
656
657 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
658
659 for(ns=0;ns<nInnerSector;ns++){
660
661 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
662 theta1=90.;
663 phi1 *=kRaddeg;
664
665 phi1 = (Float_t)TMath::Nint(phi1);
666 if(phi1>360.) phi1 -= 360.;
667
668 phi2 = phi1+90.;
669 if(phi2>360.) phi2 -= 360.;
670 theta2=90.;
671 phi3=0.;
672 theta3=0.;
673
fe4da5cc 674 alpha = phi1 * kDegrad;
675 x = x1 * TMath::Cos(alpha);
1283eee5 676 y = x1 * TMath::Sin(alpha);
677
678 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
679
680 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
681
682 nRotMat++;
683
fe4da5cc 684 }
1283eee5 685
686 //-------------------------------------------------------------
687 // outer spokes (nSectorOuter)
688 //-------------------------------------------------------------
689
690 dm[0] = 0.5*(257.9-146.1);
691 dm[1] = 3.;
692 dm[2] = 2.;
693
694 x1 = dm[0] + 146.;
695
696 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
697
698 dm[1] = dm[1] - 1.;
699 dm[2] = dm[2] - 1.;
700
701 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
702
703 for(ns=0;ns<nOuterSector;ns++){
704
705 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
706 theta1=90.;
707 phi1 *=kRaddeg;
708
709 phi1 = (Float_t)TMath::Nint(phi1);
710 if(phi1>360.) phi1 -= 360.;
711
712 phi2 = phi1+90.;
713 if(phi2>360.) phi2 -= 360.;
714 theta2=90.;
715 phi3=0.;
716 theta3=0.;
717
fe4da5cc 718 alpha = phi1 * kDegrad;
1283eee5 719 x = x1 * TMath::Cos(alpha);
720 y = x1 * TMath::Sin(alpha);
721
722 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
723
724 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
725
726 nRotMat++;
727
728 }
fe4da5cc 729
1283eee5 730
fe4da5cc 731
fe4da5cc 732 // --------------------------------------------------------
733 // put the readout chambers into the TPC
734 // --------------------------------------------------------
1283eee5 735
fe4da5cc 736 theta1 = 90.;
737 phi1 = 0.;
738 theta2 = 90.;
739 phi2 = 270.;
740 theta3 = 180.;
741 phi3 = 0.;
742
1283eee5 743 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
fe4da5cc 744
745 z0 = z_side + 250.;
746
cfce8870 747 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
1283eee5 748 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
fe4da5cc 749
cfce8870 750 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
fe4da5cc 751
1283eee5 752 //----------------------------------------------------
753 // Inner vessel and HV degrader
754 //----------------------------------------------------
fe4da5cc 755
fe4da5cc 756 dm[0] = 0.;
757 dm[1] = 360.;
758 dm[2] = 4.;
759
760 dm[3] = -250.;
1283eee5 761 dm[4] = 74.4;
fe4da5cc 762 dm[5] = 76.;
1283eee5 763
fe4da5cc 764 dm[6] = -64.5;
765 dm[7] = 50.;
766 dm[8] = 76.;
1283eee5 767
d183a600 768 dm[9] = 64.5;
fe4da5cc 769 dm[10] = 50.;
770 dm[11] = 76.;
1283eee5 771
fe4da5cc 772 dm[12] = 250.;
1283eee5 773 dm[13] = 74.4;
fe4da5cc 774 dm[14] = 76.;
1283eee5 775
776 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
777
778 // cone parts
fe4da5cc 779
780 dm[0] = 0.;
781 dm[1] = 360.;
1283eee5 782 dm[2] = 2.;
783
784 dm[3] = 64.5;
785 dm[4] = 50.;
786 dm[5] = 51.6;
787
788 dm[6] = 250.;
789 dm[7] = 74.4;
790 dm[8] = 76.;
791
792
793 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
794
795 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
796 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
797
798 // barrel part
799
800 dm[0] = 50.;
801 dm[1] = 50.5;
a5371c42 802 dm[2] = 64.5;
1283eee5 803
804 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
805
806 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
807
808 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
809
fe4da5cc 810
1283eee5 811
fe4da5cc 812
1283eee5 813
fe4da5cc 814 // ---------------------------------------------------
815 // volumes ordering
816 // ---------------------------------------------------
cfce8870 817 gMC->Gsord("TGAS", 6);
818 gMC->Gsord("TPSG", 6);
819 gMC->Gsord("TSGA", 3);
8022212f 820 gMC->Gsord("TLGA", 4);
1283eee5 821
822} // end of function
823
fe4da5cc 824
825//_____________________________________________________________________________
8c555625 826void AliTPCv1::DrawDetector()
fe4da5cc 827{
828 //
829 // Draw a shaded view of the Time Projection Chamber version 1
830 //
831
fe4da5cc 832 // Set everything unseen
cfce8870 833 gMC->Gsatt("*", "seen", -1);
fe4da5cc 834 //
835 // Set ALIC mother transparent
cfce8870 836 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 837 //
838 // Set the volumes visible
cfce8870 839 gMC->Gsatt("TPC","SEEN",0);
840 gMC->Gsatt("TGAS","SEEN",0);
841 gMC->Gsatt("TPSG","SEEN",0);
842 gMC->Gsatt("TPHV","SEEN",1);
1283eee5 843 gMC->Gsatt("TPMH","SEEN",1);
844 gMC->Gsatt("TPEC","SEEN",0);
cfce8870 845 gMC->Gsatt("TRCS","SEEN",1);
846 gMC->Gsatt("TRCL","SEEN",1);
1283eee5 847 gMC->Gsatt("TPWL","SEEN",1);
848 gMC->Gsatt("TPWI","SEEN",1);
849 gMC->Gsatt("TPWS","SEEN",1);
cfce8870 850 gMC->Gsatt("TPW1","SEEN",1);
1283eee5 851 gMC->Gsatt("TPS1","SEEN",1);
852 gMC->Gsatt("TPS2","SEEN",1);
853 gMC->Gsatt("TPG1","SEEN",1);
854 gMC->Gsatt("TPG2","SEEN",1);
855 gMC->Gsatt("TPWC","SEEN",1);
856 gMC->Gsatt("TPSI","SEEN",1);
857 gMC->Gsatt("TPSO","SEEN",1);
858 gMC->Gsatt("TPCO","SEEN",1);
859 gMC->Gsatt("TPOV","SEEN",1);
cfce8870 860 gMC->Gsatt("TPVD","SEEN",1);
cc80f89e 861
cfce8870 862 gMC->Gdopt("hide", "on");
863 gMC->Gdopt("shad", "on");
864 gMC->Gsatt("*", "fill", 7);
865 gMC->SetClipBox(".");
866 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
867 gMC->DefaultRange();
868 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
869 gMC->Gdhead(1111, "Time Projection Chamber");
870 gMC->Gdman(18, 4, "MAN");
871 gMC->Gdopt("hide","off");
fe4da5cc 872}
873
874//_____________________________________________________________________________
875void AliTPCv1::CreateMaterials()
876{
877 //
878 // Define materials for Time Projection Chamber
879 //
880 AliTPC::CreateMaterials();
881}
882
883//_____________________________________________________________________________
884void AliTPCv1::Init()
885{
886 //
887 // Initialises TPC detector after it has been created
888 //
cfce8870 889
1283eee5 890 fIdSens1=gMC->VolId("TLST"); // L-sector
891 fIdSens2=gMC->VolId("TSST"); // S-sector
fe4da5cc 892
893 printf("TPC version 1 initialized\n");
894}
895
896//_____________________________________________________________________________
897void AliTPCv1::StepManager()
898{
899 //
900 // Called at every step in the Time Projection Chamber
901 //
0a6d8768 902 Int_t copy, id, i;
fe4da5cc 903 Float_t hits[4];
904 Int_t vol[2];
0a6d8768 905 TLorentzVector p;
fe4da5cc 906 TClonesArray &lhits = *fHits;
1283eee5 907
fe4da5cc 908 //
1283eee5 909
0a6d8768 910 if(gMC->TrackCharge() && gMC->IsTrackEntering()) {
fe4da5cc 911 //
912 // Only entering charged tracks
1283eee5 913 //
0a6d8768 914 if((id=gMC->CurrentVolID(copy))==fIdSens1) {
1283eee5 915
916 // L
917
918 vol[1]=copy-1; // row
0a6d8768 919 id=gMC->CurrentVolOffID(1,copy);
1283eee5 920 vol[0]=copy+fTPCParam->GetNInnerSector()-1; // sector
cc80f89e 921
922 //I.Belikov's modification
923 if (vol[1]==0) {
924 gMC->TrackMomentum(p);
925 hits[0]=p[0];
926 hits[1]=p[1];
927 hits[2]=p[2];
928 hits[3]=0.; // this hit has no energy loss
929 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
930
931 gMC->TrackPosition(p);
932 hits[0]=p[0];
933 hits[1]=p[1];
934 hits[2]=p[2];
935 hits[3]=0.; // this hit has no energy loss
936 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
937 }
938 //end of I.Belikov's modification
fe4da5cc 939 } else if(id==fIdSens2) {
1283eee5 940
941 // S
942
943 vol[1]=copy-1; // row
944 id=gMC->CurrentVolOffID(1,copy); // sector
945 vol[0]=copy-1;
cc80f89e 946
947 //I.Belikov's modification
948 if (vol[1]==0) {
949 gMC->TrackMomentum(p);
950 hits[0]=p[0];
951 hits[1]=p[1];
952 hits[2]=p[2];
953 hits[3]=0.; // this hit has no energy loss
954 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
955
956 gMC->TrackPosition(p);
957 hits[0]=p[0];
958 hits[1]=p[1];
959 hits[2]=p[2];
960 hits[3]=0.; // this hit has no energy loss
961 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
962 }
963 //end of I.Belikov's modification
964
fe4da5cc 965 } else return;
1283eee5 966
0a6d8768 967 gMC->TrackPosition(p);
968 for(i=0;i<3;++i) hits[i]=p[i];
cc80f89e 969 hits[3]=1; //I'd like to have something positive here (I.Belikov)
fe4da5cc 970 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
971 }
972}
1283eee5 973
974
975