Added the entry for the IRST code checking utility
[u/mrichter/AliRoot.git] / TPC / AliTPCv1.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Time Projection Chamber version 1 -- detailed TPC and fast simulation //
4// //
5//Begin_Html
6/*
1439f98e 7<img src="picts/AliTPCv1Class.gif">
fe4da5cc 8*/
9//End_Html
10// //
11// //
12///////////////////////////////////////////////////////////////////////////////
13
14#include <TMath.h>
15#include <TGeometry.h>
16#include <TNode.h>
17#include <TBRIK.h>
18#include <TTUBE.h>
19#include "AliTPCv1.h"
20#include "AliRun.h"
21#include <iostream.h>
22#include <fstream.h>
23
24#include "AliMC.h"
25#include "AliConst.h"
26
8c555625 27#include "AliTPCParam.h"
28#include "AliTPCD.h"
29
fe4da5cc 30ClassImp(AliTPCv1)
31
32//_____________________________________________________________________________
33AliTPCv1::AliTPCv1(const char *name, const char *title)
34 :AliTPC(name, title) {
35 //
36 // Standard constructor for Time Projection Chamber
37 //
38 fIdSens1=fIdSens2=0;
39}
40
41//_____________________________________________________________________________
42void AliTPCv1::CreateGeometry()
43{
44 //
45 // Creates geometry for Time Projection Chamber version 1
46 // Detailed geometry -- Fast simulation
47 // Origin M.Kowalski
48 //
49 //Begin_Html
50 /*
1439f98e 51 <img src="picts/AliTPCv1.gif">
fe4da5cc 52 */
53 //End_Html
54 //Begin_Html
55 /*
1439f98e 56 <img src="picts/AliTPCv1Tree.gif">
fe4da5cc 57 */
58 //End_Html
59
ad51aeb0 60 Int_t *idtmed = fIdtmed->GetArray()-399;
8c555625 61
62
63 AliTPCParam * fTPCParam = &(fDigParam->GetParam());
fe4da5cc 64
8c555625 65 Float_t tana, rlsl, wlsl, rssl, rlsu, wssl, wlsu,
fe4da5cc 66 rssu, wssu, alpha, x, y, z, sec_thick;
67
68 Float_t r1, r2, x1, z0, z1, x2, theta1, theta2, theta3, dm[21];
69 Int_t il, iu;
70 Float_t z_side, zz;
71 Int_t idrotm[100];
72
73 Float_t x0l, x0u;
74 Int_t idr;
75 Float_t thl;
76 Int_t ils;
77 Float_t opl;
78 Int_t iss;
8c555625 79 Float_t thu, opu, phi1, phi2, phi3;
fe4da5cc 80
81 // ----------------------------------------------------
82 // FIELD CAGE WITH ENDCAPS - CARBON FIBER
83 // THIS IS ALSO A TPC MOTHER VOLUME
84 // ----------------------------------------------------
85 dm[0] = 76.;
86 dm[1] = 278.;
87 dm[2] = 275.;
88
cfce8870 89 gMC->Gsvolu("TPC ", "TUBE", idtmed[407], dm, 3);
fe4da5cc 90
91 // -------------------------------------------------------
92 // drift gas Ne/CO2 (90/10 volume) - nonsensitive
93 // field cage thickness = 0.52% X0
94 // ----------------------------------------------------
95
96 //Begin_Html
97 /*
1439f98e 98 <img src="picts/spec_tgas1.gif">
fe4da5cc 99 */
100 //End_Html
101
102 dm[0] = 76.+0.09776;
103 dm[1] = 257.;
104 dm[2] = 250.;
105
cfce8870 106 gMC->Gsvolu("TGAS", "TUBE", idtmed[402], dm, 3);
fe4da5cc 107
108 // ------------------------------------------------------
109 // "side" gas volume (the same as drift gas),
110 // here the readout chambers are positioned
111 // ------------------------------------------------------
112
113 //Begin_Html
114 /*
1439f98e 115 <img src="picts/spec_tpsg1.gif">
fe4da5cc 116 */
117 //End_Html
118
119 dm[2] = 12.5;
120 z_side = dm[2];
121
cfce8870 122 gMC->Gsvolu("TPSG", "TUBE", idtmed[401], dm, 3);
fe4da5cc 123 // ------------------------------------------------------
124 // HV midplane - 20 microns of mylar
125 // -----------------------------------------------------
126 dm[2] = .001;
127
cfce8870 128 gMC->Gsvolu("TPHV", "TUBE", idtmed[405], dm, 3);
fe4da5cc 129
130 // ====================================================
131 // lower and upper readout chambers
132 // ====================================================
133 // sectors opening angles in degrees
134 // ---------------------------------------------------
135 opl = 30.;
136 opu = 15.;
137 thl = TMath::Tan(opl * .5 * kDegrad);
138 thu = TMath::Tan(opu * .5 * kDegrad);
139 // ---------------------------------------------------
140 // S and L-sectors radii
141 // ---------------------------------------------------
142 rssl = 88.;
143 rssu = 136.;
144 rlsl = 142.;
145 rlsu = 250.;
146 // --------------------------------------------------
147 // Sectors widths
148 // --------------------------------------------------
149 wssl = 46.5;
150 wssu = 72.2;
151 wlsl = 37.;
152 wlsu = 65.4;
153 // ---------------------------------------------------
154 // Sector thickness 25% of X0 (Al)
155 // ---------------------------------------------------
156 sec_thick = 2.225;
157 // ---------------------------------------------------
158 // S-sectors (lower sectors)
159 // ---------------------------------------------------
160 dm[0] = wssl * .5;
161 dm[1] = wssu * .5;
162 dm[2] = sec_thick * .5;
163 dm[3] = (rssu - rssl) * .5;
164
165 x0l = rssl + dm[3];
166
167 //Begin_Html
168 /*
1439f98e 169 <img src="picts/spec_trcs1.gif">
fe4da5cc 170 */
171 //End_Html
172
173
cfce8870 174 gMC->Gsvolu("TRCS", "TRD1", idtmed[399], dm, 4);
fe4da5cc 175 // -----------------------------------------------------
176 // S-sectors --> "gas sectors"
177 // -----------------------------------------------------
178
179 //Begin_Html
180 /*
1439f98e 181 <img src="picts/spec_tsga1.gif">
fe4da5cc 182 */
183 //End_Html
184
185 dm[2] = (250.-0.001)/2.;
cfce8870 186 gMC->Gsvolu("TSGA", "TRD1", idtmed[402], dm, 4);
fe4da5cc 187 // ---------------------------------------------------
188 // L-sectors (upper sectors)
189 // ---------------------------------------------------
190 dm[0] = wlsl * .5;
191 dm[1] = wlsu * .5;
192 dm[2] = sec_thick * .5;
193 dm[3] = (rlsu - rlsl) * .5;
194
195 x0u = rlsl + dm[3];
196
cfce8870 197 gMC->Gsvolu("TRCL", "TRD1", idtmed[399], dm, 4);
fe4da5cc 198 // -----------------------------------------------------
199 // L-sectors - "gas sectors"
200 // -----------------------------------------------------
201 dm[2] = (250.-0.001)/2.;
cfce8870 202 gMC->Gsvolu("TLGA", "TRD1", idtmed[402], dm, 4);
fe4da5cc 203 // -----------------------------------------------------
204 // thin sensitive strips (100 microns) placed at a center
8c555625 205 // of each pad row in the "drift gas sector"
fe4da5cc 206 // -----------------------------------------------------
cfce8870 207 gMC->Gsvolu("TSST", "TRD1", idtmed[403], dm, 0);
fe4da5cc 208
209 dm[3] = .005;
8c555625 210 z0 = rssl + (rssu - rssl) * .5;
211
212 for (iss = 0; iss < fTPCParam->GetNRowLow(); ++iss) {
213 r1 = fTPCParam->GetPadRowRadiiLow(iss);
fe4da5cc 214 r2 = r1 + dm[3] * 2.;
8c555625 215 dm[0] = r1 * thl - 2.63;
216 dm[1] = r2 * thl - 2.63;
217
218 zz = -z0 + r1+dm[3];
219
cfce8870 220 gMC->Gsposp("TSST", iss+1, "TSGA", 0, 0, zz, 0, "ONLY", dm, 4);
fe4da5cc 221 }
222 // -----------------------------------------------------
223 // thin sensitive strips (100 microns) placed at a center
8c555625 224 // of each pad row in the "drift gas sector"
fe4da5cc 225 // -----------------------------------------------------
cfce8870 226 gMC->Gsvolu("TLST", "TRD1", idtmed[403], dm, 0);
8c555625 227
228 z0 = rlsl+ (rlsu - rlsl) * .5;
fe4da5cc 229
8c555625 230 for (ils = 0; ils < fTPCParam->GetNRowUp(); ++ils) {
231 r1 = fTPCParam->GetPadRowRadiiUp(ils);
fe4da5cc 232 r2 = r1 + dm[3] * 2.;
8c555625 233 dm[0] = r1 * thu - 2.63;
234 dm[1] = r2 * thu - 2.63;
235
236 zz = -z0 + r1 +dm[3];
237
cfce8870 238 gMC->Gsposp("TLST", ils+1, "TLGA", 0, 0, zz, 0, "ONLY", dm, 4);
fe4da5cc 239 }
240 // ------------------------------------------------
241 // positioning of lower sectors (1-12)*2
242 // rotation matrices 1-12
243 // ------------------------------------------------
244 z = (250.+0.001)/2.;
245 z1 = -z_side + sec_thick * .5;
246
247 for (il = 0; il < 12; ++il) {
248 phi1 = il * opl + 270;
249 if (phi1 > 360.) {
250 phi1 += -360;
251 }
252 theta1 = 90.;
253 phi2 = 90.;
254 theta2 = 180.;
255 phi3 = il * opl;
256 theta3 = 90.;
257
258 idr = il+1;
259 AliMatrix(idrotm[idr], theta1, phi1, theta2, phi2, theta3, phi3);
260
261 alpha = il * opl * kDegrad;
262 x = x0l * TMath::Cos(alpha);
263 y = x0l * TMath::Sin(alpha);
264
cfce8870 265 gMC->Gspos("TSGA", il+1, "TGAS", x, y, z, idrotm[idr], "ONLY");
266 gMC->Gspos("TSGA", il+13,"TGAS", x, y, -z, idrotm[idr], "ONLY");
267 gMC->Gspos("TRCS", il+1, "TPSG", x, y, z1, idrotm[idr], "ONLY");
fe4da5cc 268
269 }
270 // ----------------------------------------------------
271 // positioning of upper sectors (1-24)*2
272 // rotation matrices 13-36
273 // ----------------------------------------------------
274 for (iu = 1; iu <= 24; ++iu) {
275 phi1 = (iu - 1) * opu + 270.;
276 if (phi1 > 360.) {
277 phi1 += -360.;
278 }
279 theta1 = 90.;
280 phi2 = 90.;
281 theta2 = 180.;
282 phi3 = (iu - 1) * opu;
283 theta3 = 90.;
284
285 idr = iu + 12;
286 AliMatrix(idrotm[idr], theta1, phi1, theta2, phi2, theta3, phi3);
287
288 alpha = (iu - 1) * opu * kDegrad;
289 x = x0u * TMath::Cos(alpha);
290 y = x0u * TMath::Sin(alpha);
291
cfce8870 292 gMC->Gspos("TLGA", iu, "TGAS", x, y, z, idrotm[idr], "ONLY");
293 gMC->Gspos("TLGA", iu+24, "TGAS", x, y, -z, idrotm[idr], "ONLY");
fe4da5cc 294
cfce8870 295 gMC->Gspos("TRCL", iu, "TPSG", x, y, z1, idrotm[idr], "ONLY");
fe4da5cc 296 }
297 // --------------------------------------------------------
298 // Spoke wheel structures
299 // --------------------------------------------------------
cfce8870 300 gMC->Gsvolu("TSWS", "TUBE", idtmed[399], dm, 0);
fe4da5cc 301
302 z0 = -z_side + 2.;
303
304 dm[0] = 82.;
305 dm[1] = 86.;
306 dm[2] = 1.;
307
cfce8870 308 gMC->Gsposp("TSWS", 1, "TPSG", 0, 0, z0, 0, "ONLY", dm, 3);
fe4da5cc 309
310 dm[0] = 253.;
311 dm[1] = 257.;
312
cfce8870 313 gMC->Gsposp("TSWS", 2, "TPSG", 0, 0, z0, 0, "ONLY", dm, 3);
fe4da5cc 314
315 dm[0] = 140.9;
316 dm[1] = 141.9;
317
cfce8870 318 gMC->Gsposp("TSWS", 3, "TPSG", 0, 0, z0, 0, "ONLY", dm, 3);
fe4da5cc 319
320 // -------------------------------------------------------
321 // this volumes are to avoid overlaping
322 // -------------------------------------------------------
323 z0 = 253.;
324
325 dm[0] = 76.;
326 dm[1] = 76.+0.09776;
327
cfce8870 328 gMC->Gsposp("TSWS", 4, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3);
329 gMC->Gsposp("TSWS", 5, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3);
fe4da5cc 330
331 z0 += 21.;
332
cfce8870 333 gMC->Gsposp("TSWS", 6, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3);
334 gMC->Gsposp("TSWS", 7, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3);
fe4da5cc 335
336 dm[0] = 257.;
337 dm[1] = 257.+0.09776;
338 dm[2] = 11.5;
339
340 z0 = 263.5;
341
cfce8870 342 gMC->Gsposp("TSWS", 8, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3);
343 gMC->Gsposp("TSWS", 9, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3);
fe4da5cc 344 // ==========================================================
345 // wheels
346 // ==========================================================
347 // ----------------------------------------------------------
348 // Large wheel -> positioned in the TPC
349 // ----------------------------------------------------------
350 dm[0] = 257.+0.09776;
351 dm[1] = 278.;
352 dm[2] = 11.5;
cfce8870 353 gMC->Gsvolu("TPW1", "TUBE", idtmed[399], dm, 3);
fe4da5cc 354
355 dm[0] = 259.;
356 dm[1] = 278.;
357 dm[2] = 9.5;
358
cfce8870 359 gMC->Gsvolu("TPW2", "TUBE", idtmed[498], dm, 3);
fe4da5cc 360
cfce8870 361 gMC->Gspos("TPW2", 1, "TPW1", 0, 0, 0, 0, "ONLY");
fe4da5cc 362
cfce8870 363 gMC->Gspos("TPW1", 1, "TPC ", 0, 0, z0, 0, "ONLY");
364 gMC->Gspos("TPW1", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
fe4da5cc 365 // -----------------------------------------------------------
366 // Small wheel -> positioned in the TPSG
367 // -----------------------------------------------------------
368 dm[0] = 76.+0.09776;
369 dm[1] = 82.;
370 dm[2] = 11.5;
371
cfce8870 372 gMC->Gsvolu("TPW3", "TUBE", idtmed[399], dm, 3);
fe4da5cc 373
374 dm[0] = 76.+0.09776;
375 dm[1] = 80.;
376 dm[2] = 9.5;
377
cfce8870 378 gMC->Gsvolu("TPW4", "TUBE", idtmed[401], dm, 3);
fe4da5cc 379
cfce8870 380 gMC->Gspos("TPW4", 1, "TPW3", 0, 0, 0, 0, "ONLY");
fe4da5cc 381
382 z0 = 1.;
383
cfce8870 384 gMC->Gspos("TPW3", 1, "TPSG", 0, 0, z0, 0, "ONLY");
fe4da5cc 385 // ---------------------------------------------------------
386 // spokes, inner and outer, also the inner ring
387 // ---------------------------------------------------------
388
389 //Begin_Html
390 /*
1439f98e 391 <img src="picts/spec_tspo1.gif">
fe4da5cc 392 */
393 //End_Html
394
395 dm[0] = 0.5*(135.9-82.1);
396 dm[1] = 3.;
397 dm[2] = 2.;
398
399 x1 = dm[0] + 82.;
400
cfce8870 401 gMC->Gsvolu("TSPI", "BOX ", idtmed[399], dm, 3);
fe4da5cc 402
403 dm[1] = 2.;
404 dm[2] = 1.;
405
cfce8870 406 gMC->Gsvolu("TSP1", "BOX ", idtmed[498], dm, 3);
fe4da5cc 407
cfce8870 408 gMC->Gspos("TSP1", 1, "TSPI", 0, 0, 0, 0, "ONLY");
fe4da5cc 409
410 dm[0] = 0.5*(256.9-142.1);
411 dm[1] = 3.;
412 dm[2] = 2.;
413
414 x2 = dm[0] + 142.;
415
cfce8870 416 gMC->Gsvolu("TSPO", "BOX ", idtmed[399], dm, 3);
fe4da5cc 417
418 dm[1] = 2.;
419 dm[2] = 1.;
420
cfce8870 421 gMC->Gsvolu("TSP2", "BOX ", idtmed[498], dm, 3);
fe4da5cc 422
cfce8870 423 gMC->Gspos("TSP2", 1, "TSPO", 0, 0, 0, 0, "ONLY");
fe4da5cc 424 // --------------------------------------------------------
425 dm[0] = 136.;
426 dm[1] = 142.;
427 dm[2] = 2.;
428
cfce8870 429 gMC->Gsvolu("TSWH", "TUBE", idtmed[399], dm, 3);
fe4da5cc 430
431 dm[0] = 137.;
432 dm[1] = 141.;
433 dm[2] = 1.;
434
cfce8870 435 gMC->Gsvolu("TSW1", "TUBE", idtmed[498], dm, 3);
fe4da5cc 436
cfce8870 437 gMC->Gspos("TSW1", 1, "TSWH", 0, 0, 0, 0, "ONLY");
fe4da5cc 438
439 z0 = z_side - .16168 - 2.;
440 // --------------------------------------------------------
cfce8870 441 gMC->Gspos("TSWH", 1, "TPSG", 0, 0, z0, 0, "ONLY");
fe4da5cc 442 // -------------------------------------------------------
443 // posiioning of the inner spokes
444 // -------------------------------------------------------
445 for (il = 1; il <= 6; ++il) {
446 phi1 = opl * .5 + (il - 1) * 2. * opl;
447 theta1 = 90.;
448 phi2 = opl * .5 + 90. + (il - 1) * 2. * opl;
449 if (phi2 > 360.) {
450 phi2 += -360.;
451 }
452 theta2 = 90.;
453 phi3 = 0.;
454 theta3 = 0.;
455
456 alpha = phi1 * kDegrad;
457 x = x1 * TMath::Cos(alpha);
458 y = x1 * TMath::Sin(alpha);
459
460 idr = il + 36;
461
462 AliMatrix(idrotm[idr], theta1, phi1, theta2, phi2, theta3, phi3);
cfce8870 463 gMC->Gspos("TSPI", il, "TPSG", x, y, z0, idrotm[idr], "ONLY");
fe4da5cc 464 }
465
466 for (iu = 1; iu <= 12; ++iu) {
467 phi1 = opu * .5 + (iu - 1) * 2. * opu;
468 theta1 = 90.;
469 phi2 = opu * .5 + 90. + (iu - 1) * 2. * opu;
470 if (phi2 > 360.) {
471 phi2 += -360.;
472 }
473 theta2 = 90.;
474 phi3 = 0.;
475 theta3 = 0.;
476
477 alpha = phi1 * kDegrad;
478 x = x2 * TMath::Cos(alpha);
479 y = x2 * TMath::Sin(alpha);
480
481 idr = iu + 42;
482
483 AliMatrix(idrotm[idr], theta1, phi1, theta2, phi2, theta3, phi3);
cfce8870 484 gMC->Gspos("TSPO", iu, "TPSG", x, y, z0, idrotm[idr], "ONLY");
fe4da5cc 485 }
486 // --------------------------------------------------------
487 // endcap cover (C, 0.86% X0)
488 // --------------------------------------------------------
489 dm[0] = 76.+0.09776;
490 dm[1] = 257.;
491 dm[2] = 0.16168*0.5;
492
cfce8870 493 gMC->Gsvolu("TCOV", "TUBE", idtmed[407], dm, 3);
fe4da5cc 494
495 z0 = z_side - dm[2];
496
cfce8870 497 gMC->Gspos("TCOV", 1, "TPSG", 0, 0, z0, 0, "ONLY");
fe4da5cc 498 // --------------------------------------------------------
499 // put the readout chambers into the TPC
500 // --------------------------------------------------------
501 theta1 = 90.;
502 phi1 = 0.;
503 theta2 = 90.;
504 phi2 = 270.;
505 theta3 = 180.;
506 phi3 = 0.;
507
508 AliMatrix(idrotm[55], theta1, phi1, theta2, phi2, theta3, phi3);
509
510 z0 = z_side + 250.;
511
cfce8870 512 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
513 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[55], "ONLY");
fe4da5cc 514 // ---------------------------------------------------------
515 // outer gas insulation (CO2)
516 // ---------------------------------------------------------
517 dm[0] = 257.+0.09776;
518 dm[1] = 278.-0.25004;
519 dm[2] = 275.-23.;
520
cfce8870 521 gMC->Gsvolu("TPOI", "TUBE", idtmed[406], dm, 3);
fe4da5cc 522
cfce8870 523 gMC->Gspos("TPHV", 1, "TGAS", 0, 0, 0, 0, "ONLY");
524 gMC->Gspos("TGAS", 1, "TPC ", 0, 0, 0, 0, "ONLY");
525 gMC->Gspos("TPOI", 1, "TPC ", 0, 0, 0, 0, "ONLY");
fe4da5cc 526
cfce8870 527 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
fe4da5cc 528 // ======================================================
529 // all volumes below are positioned in ALIC
530 // ======================================================
531 // ------------------------------------------------------
532 // the last parts of the smaller wheel (TSWS)
533 // ------------------------------------------------------
534 dm[0] = 74.;
535 dm[1] = 76.;
536 dm[2] = 1.;
537
538 z0 = 253.;
539
cfce8870 540 gMC->Gsposp("TSWS", 10, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3);
541 gMC->Gsposp("TSWS", 11, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3);
fe4da5cc 542
543 dm[0] = 70.;
544
545 z0 += 21.;
546
cfce8870 547 gMC->Gsposp("TSWS", 12, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3);
548 gMC->Gsposp("TSWS", 13, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3);
fe4da5cc 549 // ----------------------------------------------------
550 // Inner vessel (PCON)
551 // This volume is to be positioned directly in ALIC
552 // ----------------------------------------------------
553
554 //Begin_Html
555 /*
1439f98e 556 <img src="picts/spec_tpiv1.gif">
fe4da5cc 557 */
558 //End_Html
559
560 dm[0] = 0.;
561 dm[1] = 360.;
562 dm[2] = 4.;
563
564 dm[3] = -250.;
565 dm[4] = 75.;
566 dm[5] = 76.;
567
568 dm[6] = -64.5;
569 dm[7] = 50.;
570 dm[8] = 76.;
571
572 dm[9] = 64.5;
573 dm[10] = 50.;
574 dm[11] = 76.;
575
576 dm[12] = 250.;
577 dm[13] = 75.;
578 dm[14] = 76.;
579
cfce8870 580 gMC->Gsvolu("TPIV", "PCON", idtmed[407], dm, 15);
fe4da5cc 581 // --------------------------------------------------------
582 // fill the inner vessel with CO2, (HV kDegrader)
583 // cone parts have different thickness
584 // than the central barrel, according to the TP
585 // --------------------------------------------------------
586 tana = 75./185.5;
587
588 dm[0] = 0.;
589 dm[1] = 360.;
590 dm[2] = 6.;
591
592 dm[3] = -(250.-0.2162);
593 dm[4] = (185.5-0.2126)*tana+0.2126;
594 dm[5] = 76-0.001;
595
596 dm[6] = -64.5;
597 dm[7] = 50.+0.2162;
598 dm[8] = 76-0.001;
599
600 dm[9] = -64.5;
601 dm[10] = 50+0.05076;
602 dm[11] = 76-0.001;
603
604 dm[12] = 64.5;
605 dm[13] = 50+0.05076;
606 dm[14] = 76-0.001;
607
608 dm[15] = 64.5;
609 dm[16] = 50.+0.2162;
610 dm[17] = 76-0.001;
611
612 dm[18] = (250.-0.2162);
613 dm[19] = (185.5-0.2126)*tana+0.2126;
614 dm[20] = 76-0.001;
615
cfce8870 616 gMC->Gsvolu("TPVD", "PCON", idtmed[406], dm, 21);
fe4da5cc 617
cfce8870 618 gMC->Gspos("TPVD", 1, "TPIV", 0, 0, 0, 0, "ONLY");
fe4da5cc 619
cfce8870 620 gMC->Gspos("TPIV", 1, "ALIC", 0, 0, 0, 0, "ONLY");
fe4da5cc 621 // ---------------------------------------------------
622 // volumes ordering
623 // ---------------------------------------------------
cfce8870 624 gMC->Gsord("TGAS", 6);
625 gMC->Gsord("TPSG", 6);
626 gMC->Gsord("TSGA", 3);
627 gMC->Gsord("TLGA", 3);
fe4da5cc 628}
629
630//_____________________________________________________________________________
8c555625 631void AliTPCv1::DrawDetector()
fe4da5cc 632{
633 //
634 // Draw a shaded view of the Time Projection Chamber version 1
635 //
636
fe4da5cc 637 // Set everything unseen
cfce8870 638 gMC->Gsatt("*", "seen", -1);
fe4da5cc 639 //
640 // Set ALIC mother transparent
cfce8870 641 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 642 //
643 // Set the volumes visible
cfce8870 644 gMC->Gsatt("TPC","SEEN",0);
645 gMC->Gsatt("TGAS","SEEN",0);
646 gMC->Gsatt("TPSG","SEEN",0);
647 gMC->Gsatt("TPHV","SEEN",1);
648 gMC->Gsatt("TRCS","SEEN",1);
649 gMC->Gsatt("TRCL","SEEN",1);
650 gMC->Gsatt("TSST","SEEN",1);
651 gMC->Gsatt("TLST","SEEN",1);
652 gMC->Gsatt("TSWS","SEEN",1);
653 gMC->Gsatt("TPW1","SEEN",1);
654 gMC->Gsatt("TPW2","SEEN",1);
655 gMC->Gsatt("TPW3","SEEN",1);
656 gMC->Gsatt("TPW4","SEEN",1);
657 gMC->Gsatt("TSPI","SEEN",1);
658 gMC->Gsatt("TSP1","SEEN",0);
659 gMC->Gsatt("TSPO","SEEN",1);
660 gMC->Gsatt("TSP2","SEEN",0);
661 gMC->Gsatt("TSWH","SEEN",1);
662 gMC->Gsatt("TSW1","SEEN",1);
663 gMC->Gsatt("TCOV","SEEN",0);
664 gMC->Gsatt("TPOI","SEEN",1);
665 gMC->Gsatt("TPIV","SEEN",1);
666 gMC->Gsatt("TPVD","SEEN",1);
fe4da5cc 667 //
cfce8870 668 gMC->Gdopt("hide", "on");
669 gMC->Gdopt("shad", "on");
670 gMC->Gsatt("*", "fill", 7);
671 gMC->SetClipBox(".");
672 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
673 gMC->DefaultRange();
674 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
675 gMC->Gdhead(1111, "Time Projection Chamber");
676 gMC->Gdman(18, 4, "MAN");
677 gMC->Gdopt("hide","off");
fe4da5cc 678}
679
680//_____________________________________________________________________________
681void AliTPCv1::CreateMaterials()
682{
683 //
684 // Define materials for Time Projection Chamber
685 //
686 AliTPC::CreateMaterials();
687}
688
689//_____________________________________________________________________________
690void AliTPCv1::Init()
691{
692 //
693 // Initialises TPC detector after it has been created
694 //
cfce8870 695
696 fIdSens1=gMC->VolId("TLST");
697 fIdSens2=gMC->VolId("TSST");
fe4da5cc 698
699 printf("TPC version 1 initialized\n");
700}
701
702//_____________________________________________________________________________
703void AliTPCv1::StepManager()
704{
705 //
706 // Called at every step in the Time Projection Chamber
707 //
0a6d8768 708 Int_t copy, id, i;
fe4da5cc 709 Float_t hits[4];
710 Int_t vol[2];
0a6d8768 711 TLorentzVector p;
fe4da5cc 712 TClonesArray &lhits = *fHits;
cfce8870 713
fe4da5cc 714 //
0a6d8768 715 if(gMC->TrackCharge() && gMC->IsTrackEntering()) {
fe4da5cc 716 //
717 // Only entering charged tracks
0a6d8768 718 if((id=gMC->CurrentVolID(copy))==fIdSens1) {
fe4da5cc 719 vol[1]=copy+23;
0a6d8768 720 id=gMC->CurrentVolOffID(1,copy);
fe4da5cc 721 vol[0]=copy+24;
722 } else if(id==fIdSens2) {
723 vol[1]=copy;
0a6d8768 724 id=gMC->CurrentVolOffID(1,copy);
fe4da5cc 725 vol[0]=copy;
726 } else return;
0a6d8768 727 gMC->TrackPosition(p);
728 for(i=0;i<3;++i) hits[i]=p[i];
fe4da5cc 729 hits[3]=0;
730 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
731 }
732}