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