]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCv0.cxx
Use gMC and not pMC everywhere
[u/mrichter/AliRoot.git] / TPC / AliTPCv0.cxx
1 ///////////////////////////////////////////////////////////////////////////////
2 //                                                                           //
3 //  Time Projection Chamber version 0 -- "coarse" TPC                        //
4 //                                                                           //
5 //Begin_Html
6 /*
7 <img src="picts/AliTPCv0Class.gif">
8 */
9 //End_Html
10 //                                                                           //
11 //                                                                           //
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #include <TMath.h>
15 #include <TGeometry.h>
16 #include <TNode.h>
17 #include <TTUBE.h>
18 #include "AliTPCv0.h"
19 #include "AliRun.h"
20 #include <iostream.h>
21 #include <fstream.h>
22
23 #include "AliMC.h"
24 #include "AliConst.h"
25
26 ClassImp(AliTPCv0)
27  
28 //_____________________________________________________________________________
29 AliTPCv0::AliTPCv0(const char *name, const char *title) 
30          :AliTPC(name, title)
31 {
32   //
33   // Standard creator for TPC version 0
34   //
35 }
36
37 //_____________________________________________________________________________
38 void AliTPCv0::CreateGeometry()
39 {
40   //
41   // Creation of the TPC coarse geometry (version 0)
42   // Origin Marek Kowalski Crakow
43   //
44   //Begin_Html
45   /*
46     <img src="picts/AliTPCv0.gif">
47   */
48   //End_Html
49   //Begin_Html
50   /*
51     <img src="picts/AliTPCv0Tree.gif">
52   */
53   //End_Html
54
55   Int_t *idtmed = fIdtmed->GetArray()-399;
56
57   Float_t tana, rlsl, wlsl, rssl, rlsu, wssl, wlsu,
58     rssu, wssu, alpha, x, y, sec_thick;
59   
60   Float_t x1, z0, z1, x2, theta1, theta2, theta3, dm[21];
61   Int_t il, iu;
62   Float_t z_side;
63   Int_t idrotm[100];
64   
65   Float_t x0l, x0u;
66   Int_t idr;
67   //Float_t thl, thu;
68   Float_t opl, opu, phi1, phi2, phi3;
69   
70   // ---------------------------------------------------- 
71   //          FIELD CAGE WITH ENDCAPS - CARBON FIBER 
72   //          THIS IS ALSO A TPC MOTHER VOLUME 
73   // ---------------------------------------------------- 
74   dm[0] = 76.;
75   dm[1] = 278.;
76   dm[2] = 275.;
77   
78   gMC->Gsvolu("TPC ", "TUBE", idtmed[407], dm, 3);
79   // ------------------------------------------------------- 
80   //     drift gas Ne/CO2 (90/10 volume) - nonsensitive 
81   //     field cage thickness = 0.52% X0 
82   // ---------------------------------------------------- 
83   dm[0] = 76.+0.09776;
84   dm[1] = 257.;
85   dm[2] = 250.;
86
87   gMC->Gsvolu("TGAS", "TUBE", idtmed[402], dm, 3);
88   // ------------------------------------------------------ 
89   //     "side" gas volume (the same as drift gas) 
90   //     here the readout chambers are positioned 
91   // ------------------------------------------------------ 
92   dm[2]  = 0.5*(275.-250.);
93   z_side = dm[2];
94   
95   gMC->Gsvolu("TPSG", "TUBE", idtmed[401], dm, 3);
96   // ------------------------------------------------------ 
97   //      HV midplane - 20 microns of mylar 
98   // ----------------------------------------------------- 
99   dm[2] = .001;
100   
101   gMC->Gsvolu("TPHV", "TUBE", idtmed[405], dm, 3);
102   
103   // ==================================================== 
104   //   lower and upper readout chambers 
105   // ==================================================== 
106   //   sectros opening angles in degrees 
107   // --------------------------------------------------- 
108   opl = 30.;
109   opu = 15.;
110   //thl = TMath::Tan(opl * .5 * kDegrad);
111   //thu = TMath::Tan(opu * .5 * kDegrad);
112   // --------------------------------------------------- 
113   //         S and L-sectors radii 
114   // --------------------------------------------------- 
115   rssl = 88.;
116   rssu = 136.;
117   rlsl = 142.;
118   rlsu = 250.;
119   // -------------------------------------------------- 
120   //          Sectors widths 
121   // -------------------------------------------------- 
122   wssl = 46.5;
123   wssu = 72.2;
124   wlsl = 37.;
125   wlsu = 65.4;
126   // --------------------------------------------------- 
127   //    Sector thickness 25% of X0 (Al) 
128   // --------------------------------------------------- 
129   sec_thick = 2.225;
130   // --------------------------------------------------- 
131   //     S-sectors readout chambers (lower sectors) 
132   // --------------------------------------------------- 
133   dm[0] = wssl * .5;
134   dm[1] = wssu * .5;
135   dm[2] = sec_thick * .5;
136   dm[3] = (rssu - rssl) * .5;
137   
138   x0l = rssl + dm[3];
139   
140   gMC->Gsvolu("TRCS", "TRD1", idtmed[399], dm, 4);
141   // --------------------------------------------------- 
142   //     L-sectors readout chambers (upper sectors) 
143   // --------------------------------------------------- 
144   dm[0] = wlsl * .5;
145   dm[1] = wlsu * .5;
146   dm[2] = sec_thick * .5;
147   dm[3] = (rlsu - rlsl) * .5;
148   
149   x0u = rlsl + dm[3];
150   
151   gMC->Gsvolu("TRCL", "TRD1", idtmed[399], dm, 4);
152   // ---------------------------------------------------- 
153   //    positioning of the S-sector readout chambers 
154   //    rotation matices 1-12 
155   // ---------------------------------------------------- 
156   z1 = -z_side + sec_thick * .5;
157
158   for (il = 1; il <= 12; ++il) {
159     phi1 = (il - 1) * opl + 270.;
160     if (phi1 > 360.) {
161       phi1 += -360.;
162     }
163     theta1 = 90.;
164     phi2   = 90.;
165     theta2 = 180.;
166     phi3   = (il - 1) * opl;
167     theta3 = 90.;
168     
169     idr = il;
170     
171     alpha = (il - 1) * opl * kDegrad;
172     x     = x0l * TMath::Cos(alpha);
173     y     = x0l * TMath::Sin(alpha);
174     
175     AliMatrix(idrotm[idr], theta1, phi1, theta2, phi2, theta3, phi3);
176     gMC->Gspos("TRCS", il, "TPSG", x, y, z1, idrotm[idr], "ONLY");
177   }
178   // ---------------------------------------------------- 
179   //    positioning of the L-sector readout chambers 
180   //    rotation matices 13-36 
181   // ---------------------------------------------------- 
182   for (iu = 1; iu <= 24; ++iu) {
183     phi1 = (iu - 1) * opu + 270.;
184     if (phi1 > 360.) {
185       phi1 += -360.;
186     }
187     theta1 = 90.;
188     phi2   = 90.;
189     theta2 = 180.;
190     phi3   = (iu - 1) * opu;
191     theta3 = 90.;
192     
193     idr = iu + 12;
194     AliMatrix(idrotm[idr], theta1, phi1, theta2, phi2, theta3, phi3);
195     
196     alpha = (iu - 1) * opu * kDegrad;
197     x     = x0u * TMath::Cos(alpha);
198     y     = x0u * TMath::Sin(alpha);
199     
200     gMC->Gspos("TRCL", iu, "TPSG", x, y, z1, idrotm[idr], "ONLY");
201   }
202   // -------------------------------------------------------- 
203   //             Spoke wheel structures 
204   // -------------------------------------------------------- 
205   gMC->Gsvolu("TSWS", "TUBE", idtmed[399], dm, 0);
206   
207   z0 = -z_side + 2.;
208   
209   dm[0] = 82.;
210   dm[1] = 86.;
211   dm[2] = 1.;
212   
213   gMC->Gsposp("TSWS", 1, "TPSG", 0, 0, z0, 0, "ONLY", dm, 3);
214   
215   dm[0] = 253.;
216   dm[1] = 257.;
217   
218   gMC->Gsposp("TSWS", 2, "TPSG", 0, 0, z0, 0, "ONLY", dm, 3);
219   
220   dm[0] = 140.9;
221   dm[1] = 141.9;
222   
223   gMC->Gsposp("TSWS", 3, "TPSG", 0, 0, z0, 0, "ONLY", dm, 3);
224   
225   // ------------------------------------------------------- 
226   //    this volumes are to avoid overlaping 
227   // ------------------------------------------------------- 
228   z0 = 253.;
229   
230   dm[0] = 76.;
231   dm[1] = 76.+0.09776;
232   
233   gMC->Gsposp("TSWS", 4, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3);
234   gMC->Gsposp("TSWS", 5, "TPC ", 0, 0, -z0,0, "ONLY", dm, 3);
235   
236   z0 += 21.;
237   
238   gMC->Gsposp("TSWS", 6, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3);
239   gMC->Gsposp("TSWS", 7, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3);
240   
241   dm[0] = 257.;
242   dm[1] = 257.+0.09776;
243   dm[2] = 11.5;
244   
245   z0 = 263.5;
246   
247   gMC->Gsposp("TSWS", 8, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3);
248   gMC->Gsposp("TSWS", 9, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3);
249   // ========================================================== 
250   //                  wheels 
251   // ========================================================== 
252   // ---------------------------------------------------------- 
253   //       Large wheel -> positioned in the TPC 
254   // ---------------------------------------------------------- 
255   dm[0] = 257.+0.09776;
256   dm[1] = 278.;
257   dm[2] = 11.5;
258   gMC->Gsvolu("TPW1", "TUBE", idtmed[399], dm, 3);
259   
260   dm[0] = 259.;
261   dm[1] = 278.;
262   dm[2] = 9.5;
263   
264   gMC->Gsvolu("TPW2", "TUBE", idtmed[498], dm, 3);
265   
266   gMC->Gspos("TPW2", 1, "TPW1", 0, 0, 0, 0, "ONLY");
267   
268   gMC->Gspos("TPW1", 1, "TPC ", 0, 0, z0, 0, "ONLY");
269   gMC->Gspos("TPW1", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
270   // ----------------------------------------------------------- 
271   //     Small wheel -> positioned in the TPSG 
272   // ----------------------------------------------------------- 
273   dm[0] = 76.+0.09776;
274   dm[1] = 82.;
275   dm[2] = 11.5;
276   
277   gMC->Gsvolu("TPW3", "TUBE", idtmed[399], dm, 3);
278   
279   dm[0] = 76.+0.09776;
280   dm[1] = 80.;
281   dm[2] = 9.5;
282   
283   gMC->Gsvolu("TPW4", "TUBE", idtmed[401], dm, 3);
284   
285   gMC->Gspos("TPW4", 1, "TPW3", 0, 0, 0, 0, "ONLY");
286   
287   z0 = 1.;
288   
289   gMC->Gspos("TPW3", 1, "TPSG", 0, 0, z0, 0, "ONLY");
290   // --------------------------------------------------------- 
291   //       spokes, inner and outer, also the inner ring 
292   // --------------------------------------------------------- 
293   dm[0] = 0.5*(135.9-82.1);
294   dm[1] = 3.;
295   dm[2] = 2.;
296   
297   x1 = dm[0] + 82.;
298   
299   gMC->Gsvolu("TSPI", "BOX ", idtmed[399], dm, 3);
300   
301   dm[1] = 2.;
302   dm[2] = 1.;
303   
304   gMC->Gsvolu("TSP1", "BOX ", idtmed[498], dm, 3);
305
306   gMC->Gspos("TSP1", 1, "TSPI", 0, 0, 0, 0, "ONLY");
307   
308   dm[0] = 0.5*(256.9-142.1);
309   dm[1] = 3.;
310   dm[2] = 2.;
311   
312   x2 = dm[0] + 142.;
313   
314   gMC->Gsvolu("TSPO", "BOX ", idtmed[399], dm, 3);
315   
316   dm[1] = 2.;
317   dm[2] = 1.;
318   
319   gMC->Gsvolu("TSP2", "BOX ", idtmed[498], dm, 3);
320   
321   gMC->Gspos("TSP2", 1, "TSPO", 0, 0, 0, 0, "ONLY");
322   // -------------------------------------------------------- 
323   dm[0] = 136.;
324   dm[1] = 142.;
325   dm[2] = 2.;
326   
327   gMC->Gsvolu("TSWH", "TUBE", idtmed[399], dm, 3);
328   
329   dm[0] = 137.;
330   dm[1] = 141.;
331   dm[2] = 1.;
332   
333   gMC->Gsvolu("TSW1", "TUBE", idtmed[498], dm, 3);
334   
335   gMC->Gspos("TSW1", 1, "TSWH", 0, 0, 0, 0, "ONLY");
336   
337   z0 = z_side - .16168 - 2.;
338   // -------------------------------------------------------- 
339   gMC->Gspos("TSWH", 1, "TPSG", 0, 0, z0, 0, "ONLY");
340   // ------------------------------------------------------- 
341   //     posiioning of the inner spokes 
342   // ------------------------------------------------------- 
343   for (il = 1; il <= 6; ++il) {
344     phi1 = opl * .5 + (il - 1) * 2. * opl;
345     theta1 = 90.;
346     phi2 = opl * .5 + 90. + (il - 1) * 2. * opl;
347     if (phi2 > 360.) {
348       phi2 += -360.;
349     }
350     theta2 = 90.;
351     phi3   = 0.;
352     theta3 = 0.;
353     
354     alpha = phi1 * kDegrad;
355     x     = x1 * TMath::Cos(alpha);
356     y     = x1 * TMath::Sin(alpha);
357     
358     idr = il + 36;
359     
360     AliMatrix(idrotm[idr], theta1, phi1, theta2, phi2, theta3, phi3);
361     gMC->Gspos("TSPI", il, "TPSG", x, y, z0, idrotm[idr], "ONLY");
362     
363   }
364   
365   for (iu = 1; iu <= 12; ++iu) {
366     phi1 = opu * .5 + (iu - 1) * 2. * opu;
367     theta1 = 90.;
368     phi2 = opu * .5 + 90. + (iu - 1) * 2. * opu;
369     if (phi2 > 360.) {
370       phi2 += -360.;
371     }
372     theta2 = 90.;
373     phi3   = 0.;
374     theta3 = 0.;
375     
376     alpha = phi1 * kDegrad;
377     x     = x2 * TMath::Cos(alpha);
378     y     = x2 * TMath::Sin(alpha);
379     
380     idr = iu + 42;
381     
382     AliMatrix(idrotm[idr], theta1, phi1, theta2, phi2, theta3, phi3);
383     gMC->Gspos("TSPO", iu, "TPSG", x, y, z0, idrotm[idr], "ONLY");
384   }
385   // -------------------------------------------------------- 
386   //       endcap cover (C, 0.86% X0) 
387   // -------------------------------------------------------- 
388   dm[0] = 76.+0.09776;
389   dm[1] = 257.;
390   dm[2] = 0.16168*0.5;
391   
392   gMC->Gsvolu("TCOV", "TUBE", idtmed[407], dm, 3);
393   
394   z0 = z_side - dm[2];
395   
396   gMC->Gspos("TCOV", 1, "TPSG", 0, 0, z0, 0, "ONLY");
397   // -------------------------------------------------------- 
398   //         put the readout chambers into the TPC 
399   // -------------------------------------------------------- 
400   theta1 = 90.;
401   phi1   = 0.;
402   theta2 = 90.;
403   phi2   = 270.;
404   theta3 = 180.;
405   phi3   = 0.;
406   
407   AliMatrix(idrotm[55], theta1, phi1, theta2, phi2, theta3, phi3);
408   
409   z0 = z_side + 250.;
410   
411   gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
412   gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[55], "ONLY");
413   // --------------------------------------------------------- 
414   //     outer gas insulation (CO2) 
415   // --------------------------------------------------------- 
416   dm[0] = 257.+0.09776;
417   dm[1] = 278.-0.25004;
418   dm[2] = 275.-23.;
419   
420   gMC->Gsvolu("TPOI", "TUBE", idtmed[406], dm, 3);
421   
422   gMC->Gspos("TPHV", 1, "TGAS", 0, 0, 0, 0, "ONLY");
423   gMC->Gspos("TGAS", 1, "TPC ", 0, 0, 0, 0, "ONLY");
424   gMC->Gspos("TPOI", 1, "TPC ", 0, 0, 0, 0, "ONLY");
425   
426   gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
427   // ====================================================== 
428   //      all volumes below are positioned in ALIC 
429   // ====================================================== 
430   // ------------------------------------------------------ 
431   //        the last parts of the smaller wheel (TSWS) 
432   // ------------------------------------------------------ 
433   dm[0] = 74.;
434   dm[1] = 76.;
435   dm[2] = 1.;
436   
437   z0 = 253.;
438   
439   gMC->Gsposp("TSWS", 10, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3);
440   gMC->Gsposp("TSWS", 11, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3);
441   
442   dm[0] = 70.;
443   
444   z0 += 21.;
445   
446   gMC->Gsposp("TSWS", 12, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3);
447   gMC->Gsposp("TSWS", 13, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3);
448   // ---------------------------------------------------- 
449   //             Inner vessel (PCON) 
450   //   This volume is to be positioned directly in ALIC 
451   // ---------------------------------------------------- 
452   dm[0] = 0.;
453   dm[1] = 360.;
454   dm[2] = 4.;
455   
456   dm[3] = -250.;
457   dm[4] = 75.;
458   dm[5] = 76.;
459   
460   dm[6] = -64.5;
461   dm[7] = 50.;
462   dm[8] = 76.;
463   
464   dm[9] = 64.5;
465   dm[10] = 50.;
466   dm[11] = 76.;
467   
468   dm[12] = 250.;
469   dm[13] = 75.;
470   dm[14] = 76.;
471   
472   gMC->Gsvolu("TPIV", "PCON", idtmed[407], dm, 15);
473   // -------------------------------------------------------- 
474   //     fill the inner vessel with CO2, (HV kDegrader) 
475   //     cone parts have different thickness 
476   //     than the central barrel, according to the TP 
477   // -------------------------------------------------------- 
478   tana = 75./185.5;
479   
480   dm[0] = 0.;
481   dm[1] = 360.;
482   dm[2] = 6.;
483   
484   dm[3] = -(250.-0.2162);
485   dm[4] = (185.5-0.2126)*tana+0.2126;
486   dm[5] = 76-0.001;
487   
488   dm[6] = -64.5;
489   dm[7] = 50.+0.2162;
490   dm[8] = 76-0.001;
491   
492   dm[9]  = -64.5;
493   dm[10] = 50+0.05076;
494   dm[11] = 76-0.001;
495   
496   dm[12] = 64.5;
497   dm[13] = 50+0.05076;
498   dm[14] = 76-0.001;
499   
500   dm[15] = 64.5;
501   dm[16] = 50.+0.2162;
502   dm[17] = 76-0.001;
503   
504   dm[18] = (250.-0.2162);
505   dm[19] = (185.5-0.2126)*tana+0.2126;
506   dm[20] = 76-0.001;
507   
508   gMC->Gsvolu("TPVD", "PCON", idtmed[406], dm, 21);
509   
510   gMC->Gspos("TPVD", 1, "TPIV", 0, 0, 0, 0, "ONLY");
511   
512   gMC->Gspos("TPIV", 1, "ALIC", 0, 0, 0, 0, "ONLY");
513   // --------------------------------------------------- 
514   //               volumes ordering 
515   // --------------------------------------------------- 
516   gMC->Gsord("TPSG", 6);
517 }
518
519 //_____________________________________________________________________________
520 void AliTPCv0::CreateMaterials()
521 {
522   //
523   // Define materials for the TPC
524   //
525   AliTPC::CreateMaterials();
526 }
527
528 //_____________________________________________________________________________
529 void AliTPCv0::DrawDetector()
530 {
531   //
532   // Draw a shaded view of the Time Projection Chamber version 0
533   //
534
535   // Set everything unseen
536   gMC->Gsatt("*", "seen", -1);
537   // 
538   // Set ALIC mother transparent
539   gMC->Gsatt("ALIC","SEEN",0);
540   //
541   // Set the volumes visible
542   gMC->Gsatt("TPC","SEEN",0);
543   gMC->Gsatt("TGAS","SEEN",0);
544   gMC->Gsatt("TPSG","SEEN",0);
545   gMC->Gsatt("TPHV","SEEN",1);
546   gMC->Gsatt("TRCS","SEEN",1);
547   gMC->Gsatt("TRCL","SEEN",1);
548   gMC->Gsatt("TSWS","SEEN",1);
549   gMC->Gsatt("TPW1","SEEN",1);
550   gMC->Gsatt("TPW2","SEEN",1);
551   gMC->Gsatt("TPW3","SEEN",1);
552   gMC->Gsatt("TPW4","SEEN",1);
553   gMC->Gsatt("TSPI","SEEN",1);
554   gMC->Gsatt("TSP1","SEEN",0);
555   gMC->Gsatt("TSPO","SEEN",1);
556   gMC->Gsatt("TSP2","SEEN",0);
557   gMC->Gsatt("TSWH","SEEN",1);
558   gMC->Gsatt("TSW1","SEEN",1);
559   gMC->Gsatt("TPOI","SEEN",1);
560   gMC->Gsatt("TPIV","SEEN",1);
561   gMC->Gsatt("TPVD","SEEN",1);
562   //
563   gMC->Gdopt("hide", "on");
564   gMC->Gdopt("shad", "on");
565   gMC->Gsatt("*", "fill", 7);
566   gMC->SetClipBox(".");
567   gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
568   gMC->DefaultRange();
569   gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
570   gMC->Gdhead(1111, "Time Projection Chamber");
571   gMC->Gdman(18, 4, "MAN");
572   gMC->Gdopt("hide","off");
573 }
574
575 //_____________________________________________________________________________
576 void AliTPCv0::Init()
577 {
578   //
579   // Initialise Time Projection Chamber version 0
580   //
581   printf("TPC version 0 initialized\n");
582 }
583
584 //_____________________________________________________________________________
585 void AliTPCv0::StepManager()
586 {
587   //
588   // Procedure called at each step in the TPC
589   //
590 }