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