b9d347a471ae38a65a2ab62a42731fc7067dcf5c
[u/mrichter/AliRoot.git] / TPC / AliTPCv0.cxx
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$
18 */
19
20 ///////////////////////////////////////////////////////////////////////////////
21 //                                                                           //
22 //  Time Projection Chamber version 0 -- "coarse" TPC                        //
23 //                                                                           //
24 //Begin_Html
25 /*
26 <img src="picts/AliTPCv0Class.gif">
27 */
28 //End_Html
29 //                                                                           //
30 //                                                                           //
31 ///////////////////////////////////////////////////////////////////////////////
32
33 #include <TMath.h>
34 #include <TGeometry.h>
35 #include <TNode.h>
36 #include <TTUBE.h>
37 #include "AliTPCv0.h"
38 #include "AliRun.h"
39 #include <iostream.h>
40 #include <fstream.h>
41
42 #include "AliMC.h"
43 #include "AliConst.h"
44
45 #include "AliTPCParam.h"
46 #include "AliTPCD.h"
47
48 ClassImp(AliTPCv0)
49  
50 //_____________________________________________________________________________
51 AliTPCv0::AliTPCv0(const char *name, const char *title) 
52          :AliTPC(name, title)
53 {
54   //
55   // Standard creator for TPC version 0
56   //
57 }
58
59 //_____________________________________________________________________________
60 void AliTPCv0::CreateGeometry()
61 {
62   //
63   // Creation of the TPC coarse geometry (version 0)
64   // Origin Marek Kowalski Crakow
65   //
66   //Begin_Html
67   /*
68     <img src="picts/AliTPCv0.gif">
69   */
70   //End_Html
71   //Begin_Html
72   /*
73     <img src="picts/AliTPCv0Tree.gif">
74   */
75   //End_Html
76
77   AliTPCParam * fTPCParam = &(fDigParam->GetParam());
78
79   Int_t *idtmed = fIdtmed->GetArray();
80
81   Float_t dm[21];
82   Int_t idrotm[120];
83
84   Int_t nRotMat = 0;
85
86
87   // ---------------------------------------------------- 
88   //          FIELD CAGE WITH ENDCAPS - G10
89   //          THIS IS ALSO A TPC MOTHER VOLUME 
90   // ---------------------------------------------------- 
91
92   dm[0] = 76.;
93   dm[1] = 278.;
94   dm[2] = 275.;
95
96   gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3); 
97
98   //-----------------------------------------------------
99   //  Endcap cover c-fibre 0.86% X0
100   //-----------------------------------------------------
101
102   dm[0] = 78.;
103   dm[1] = 258.;
104   dm[2] = 0.95;
105
106   gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
107
108   //-----------------------------------------------------
109   // Drift gas , leave 2 cm at the outer radius
110   // and inner raddius
111   //-----------------------------------------------------
112
113   dm[0] = 78.;
114   dm[1] = 258.;
115   dm[2] = 250.;
116
117   gMC->Gsvolu("TGAS", "TUBE", idtmed[3], dm, 3);
118
119
120   //------------------------------------------------------
121   //  membrane holder - carbon fiber
122   //------------------------------------------------------
123
124
125   gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
126
127   dm[0] = 252.;
128   dm[1] = 258.;
129   dm[2] = 0.2;
130
131   gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
132  
133   dm[0] = 78.;
134   dm[2] = 82.;
135   dm[2] = 0.1;
136
137   gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
138
139   //----------------------------------------------------------
140   //  HV membrane - 25 microns of mylar
141   //----------------------------------------------------------
142
143   dm[0] = 82.;
144   dm[1] = 252.;
145   dm[2] = 0.00125;
146
147   gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
148
149   gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
150
151   gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
152
153   //----------------------------------------------------------
154   // "side" gas volume, the same as the drift gas
155   // the readout chambers are placed there.  
156   //----------------------------------------------------------
157
158   dm[0] = 78.;
159   dm[1] = 258.;
160   dm[2] = 0.5*(275. - 250.);
161    
162   gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
163
164   Float_t z_side = dm[2]; // 1/2 of the side gas thickness
165
166   //-----------------------------------------------------------
167   //   Readout chambers , 25% of X0, I use Al as the material
168   //-----------------------------------------------------------
169
170   Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
171   Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
172
173   Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
174   Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
175
176
177   Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
178   Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
179
180
181   Float_t InSecLowEdge = fTPCParam->GetInSecLowEdge();
182   Float_t InSecUpEdge =  fTPCParam->GetInSecUpEdge();
183
184   Float_t OuSecLowEdge = fTPCParam->GetOuSecLowEdge();
185   Float_t OuSecUpEdge = fTPCParam->GetOuSecUpEdge();
186
187   Float_t SecThick = 2.225; // Al
188
189   Float_t edge = fTPCParam->GetEdge();
190
191   //  S (Inner) sectors
192
193   dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
194   dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
195   dm[2] = SecThick;
196   dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
197
198   Float_t xCenterS = InSecLowEdge+dm[3];
199
200   gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4); 
201
202   //  L (Outer) sectors
203
204   dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
205   dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
206   dm[2] = SecThick;
207   dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
208
209   Float_t xCenterL = OuSecLowEdge+dm[3];  
210
211   gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
212
213   Float_t z1 = -z_side + SecThick*0.5;
214
215   //------------------------------------------------------------------
216   // Positioning of the S-sector readout chambers
217   //------------------------------------------------------------------
218
219   Int_t ns;
220   Float_t theta1,theta2,theta3;
221   Float_t phi1,phi2,phi3;
222   Float_t alpha;
223   Float_t x,y;
224
225   for(ns=0;ns<nInnerSector;ns++){
226     
227     phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
228     phi1 *= kRaddeg; // in degrees
229
230     phi1 = (Float_t)TMath::Nint(phi1);
231
232     if (phi1 > 360.) phi1 -= 360.;
233       
234     theta1 = 90.;
235     phi2   = 90.;
236     theta2 = 180.;
237     phi3   = ns * InnerOpenAngle + InnerAngleShift;
238     phi3 *= kRaddeg; // in degrees
239
240     phi3 = (Float_t)TMath::Nint(phi3);
241       
242     if(phi3 > 360.) phi3 -= 360.;
243
244     theta3 = 90.;
245
246     alpha = phi3*kDegrad;
247
248     x = xCenterS * TMath::Cos(alpha);
249     y = xCenterS * TMath::Sin(alpha); 
250  
251     AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);  
252      
253     gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
254
255     nRotMat++;     
256
257   }
258     
259   //-------------------------------------------------------------------
260   //  Positioning of the L-sectors readout chambers
261   //-------------------------------------------------------------------
262     
263   for(ns=0;ns<nOuterSector;ns++){
264     phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
265     phi1 *= kRaddeg; // in degrees
266
267     phi1 = (Float_t)TMath::Nint(phi1);
268     
269
270     if (phi1 > 360.) phi1 -= 360.;
271       
272     theta1 = 90.;
273     phi2   = 90.;
274     theta2 = 180.;
275     phi3   = ns * OuterOpenAngle+OuterAngleShift;
276     phi3 *= kRaddeg; // in degrees
277
278     phi3 = (Float_t)TMath::Nint(phi3);
279
280       
281     if(phi3 > 360.) phi3 -= 360.;
282
283     theta3 = 90.;
284
285     alpha = phi3*kDegrad;
286
287     x = xCenterL * TMath::Cos(alpha);
288     y = xCenterL * TMath::Sin(alpha); 
289  
290     AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);  
291      
292
293     gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY"); 
294
295     nRotMat++;   
296
297   }
298
299   Float_t z0 = z_side - 0.95;
300
301   gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
302
303   // ========================================================== 
304   //                  wheels 
305   // ========================================================== 
306
307   //
308   //  auxilary structures
309   //
310
311
312   gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air" 
313
314   // ---------------------------------------------------------- 
315   //       Large wheel -> positioned in the TPC 
316   // ---------------------------------------------------------- 
317   
318
319   z0 = 263.5; // TPC length - 1/2 spoke wheel width
320
321   dm[0] = 258.;
322   dm[1] = 278.;
323   dm[2] = 11.5;
324   
325   gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3); 
326
327   dm[0] = dm[0]+2.;
328   dm[1] = 278.;
329   dm[2] = dm[2]-2.;
330
331   gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
332
333   gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
334   gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
335
336   //
337   //  Outer vessel + CO2 HV degrader
338   //
339
340   dm[0] = 260.;
341   dm[1] = 278.;
342   dm[2] = 252.;
343
344   gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
345
346   dm[0] = 275.;
347   dm[1] = 278.;
348   
349   gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
350
351   gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
352
353
354   // G10 plugs
355
356   dm[0] = 258.;
357   dm[1] = 260.;
358   dm[2] = 1.;
359
360   gMC->Gsvolu("TPG1","TUBE",idtmed[8],dm,3);
361   gMC->Gspos("TPG1",1,"TPCO",0.,0.,251.,0,"ONLY");
362   gMC->Gspos("TPG1",2,"TPCO",0.,0.,-251.,0,"ONLY");  
363
364   gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
365
366
367   //----------------------------------------------------------
368   //  Small wheel -> positioned in "side gas
369   //----------------------------------------------------------
370
371   dm[0] = 78.;
372   dm[1] = 82.;
373   dm[2] = 11.5;
374
375   gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
376
377   dm[0] = 78.;
378   dm[1] = dm[1]-2;
379   dm[2] = dm[2]-2.;
380
381   gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
382   
383   gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
384
385   z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
386
387   gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
388
389
390   // to avoid overlaps
391
392   dm[0] = 76.;
393   dm[1] = 78.;
394   dm[2] = 11.5;
395
396   gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
397
398   dm[2] = 9.5;
399
400   gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
401
402   gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
403
404   z0= 263.5;
405   
406   gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
407   gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
408
409   // G10 plug
410
411   dm[0] = 76.;
412   dm[1] = 78.;
413   dm[2] = 1.;
414
415   gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
416
417   z0 = 251.;
418
419   gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
420   gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
421
422
423   //---------------------------------------------------------
424   //  central wheel  6 (radial direction) x 4 (along z) cm2
425   //---------------------------------------------------------
426
427   dm[0] = 140.;
428   dm[1] = 146.;
429   dm[2] = 2.;
430
431   gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
432
433   dm[0] = dm[0] + 2.;
434   dm[1] = dm[1] - 2.;
435   dm[2] = dm[2] - 1.;
436
437   gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
438
439   z0 = z_side - 1.9 - 2.;
440
441   gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
442
443   //
444
445   gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke 
446
447  
448   //---------------------------------------------------------
449   //  inner spokes (nSectorInner)
450   //---------------------------------------------------------
451
452   dm[0] = 0.5*(139.9-82.1);
453   dm[1] = 3.;
454   dm[2] = 2.;
455
456   Float_t x1 = dm[0]+82.;
457
458   gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
459
460   dm[1] = dm[1]-1.;
461   dm[2] = dm[2]-1.;
462
463   gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
464
465   for(ns=0;ns<nInnerSector;ns++){
466
467     phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
468     theta1=90.;
469     phi1 *=kRaddeg;
470
471     phi1 = (Float_t)TMath::Nint(phi1);
472
473     phi2 = phi1+90.;
474     if(phi2>360.) phi2 -= 360.;
475     theta2=90.;
476     phi3=0.;
477     theta3=0.;
478
479     alpha = phi1 * kDegrad;
480     x     = x1 * TMath::Cos(alpha);
481     y     = x1 * TMath::Sin(alpha);    
482
483    AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
484
485    gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");  
486
487    nRotMat++;
488
489   }
490
491   //-------------------------------------------------------------
492   // outer spokes (nSectorOuter)
493   //-------------------------------------------------------------
494
495   dm[0] = 0.5*(257.9-146.1);
496   dm[1] = 3.;
497   dm[2] = 2.;
498
499   x1 = dm[0] + 146.;
500
501   gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
502
503   dm[1] = dm[1] - 1.;
504   dm[2] = dm[2] - 1.;
505
506   gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
507
508   for(ns=0;ns<nOuterSector;ns++){
509
510     phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
511     theta1=90.;
512     phi1 *=kRaddeg;
513
514     phi1 = (Float_t)TMath::Nint(phi1);
515
516     phi2 = phi1+90.;
517     if(phi2>360.) phi2 -= 360.;
518     theta2=90.;
519     phi3=0.;
520     theta3=0.;
521
522     alpha = phi1 * kDegrad;
523     x     = x1 * TMath::Cos(alpha);
524     y     = x1 * TMath::Sin(alpha);    
525
526    AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
527
528    gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");  
529
530    nRotMat++;
531
532   }  
533   
534
535   
536   // -------------------------------------------------------- 
537   //         put the readout chambers into the TPC 
538   // -------------------------------------------------------- 
539
540   theta1 = 90.;
541   phi1   = 0.;
542   theta2 = 90.;
543   phi2   = 270.;
544   theta3 = 180.;
545   phi3   = 0.;
546   
547   AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
548   
549   z0 = z_side + 250.;
550   
551   gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
552   gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
553   
554   gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
555
556   //----------------------------------------------------
557   //  Inner vessel and HV degrader
558   //----------------------------------------------------
559
560   dm[0] = 0.;
561   dm[1] = 360.;
562   dm[2] = 4.;
563   
564   dm[3] = -250.;
565   dm[4] = 74.4;
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] = 74.4;
578   dm[14] = 76.;
579
580   gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
581
582   // cone parts
583
584   dm[0] = 0.;
585   dm[1] = 360.;
586   dm[2] = 2.;
587
588   dm[3] = 64.5;
589   dm[4] = 50.;
590   dm[5] = 51.6;
591  
592   dm[6] = 250.;
593   dm[7] = 74.4;
594   dm[8] = 76.;
595
596
597   gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
598
599   gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
600   gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
601
602   // barrel part
603
604   dm[0] = 50.;
605   dm[1] = 50.5;
606   dm[2] = 32.25;
607
608   gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
609
610   gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
611
612   gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
613
614   
615
616   
617
618   // --------------------------------------------------- 
619   //               volumes ordering 
620   // --------------------------------------------------- 
621   gMC->Gsord("TPSG", 6);
622  
623 } // end of function
624
625
626 //_____________________________________________________________________________
627 void AliTPCv0::CreateMaterials()
628 {
629   //
630   // Define materials for the TPC
631   //
632   AliTPC::CreateMaterials();
633 }
634
635 //_____________________________________________________________________________
636 void AliTPCv0::DrawDetector()
637 {
638   //
639   // Draw a shaded view of the Time Projection Chamber version 0
640   //
641
642   // Set everything unseen
643   gMC->Gsatt("*", "seen", -1);
644   // 
645   // Set ALIC mother transparent
646   gMC->Gsatt("ALIC","SEEN",0);
647   //
648   // Set the volumes visible
649   gMC->Gsatt("TPC","SEEN",0);
650   gMC->Gsatt("TGAS","SEEN",0);
651   gMC->Gsatt("TPSG","SEEN",0);
652   gMC->Gsatt("TPHV","SEEN",1);
653   gMC->Gsatt("TPMH","SEEN",1);
654   gMC->Gsatt("TPEC","SEEN",0);
655   gMC->Gsatt("TRCS","SEEN",1);
656   gMC->Gsatt("TRCL","SEEN",1);
657   gMC->Gsatt("TPWL","SEEN",1);
658   gMC->Gsatt("TPWI","SEEN",1);
659   gMC->Gsatt("TPWS","SEEN",1);
660   gMC->Gsatt("TPW1","SEEN",1);
661   gMC->Gsatt("TPS1","SEEN",1);
662   gMC->Gsatt("TPS2","SEEN",1);
663   gMC->Gsatt("TPG1","SEEN",1);
664   gMC->Gsatt("TPG2","SEEN",1);
665   gMC->Gsatt("TPWC","SEEN",1);
666   gMC->Gsatt("TPSI","SEEN",1); 
667   gMC->Gsatt("TPSO","SEEN",1);
668   gMC->Gsatt("TPCO","SEEN",1);
669   gMC->Gsatt("TPOV","SEEN",1);
670   gMC->Gsatt("TPVD","SEEN",1);
671   //
672   gMC->Gdopt("hide", "on");
673   gMC->Gdopt("shad", "on");
674   gMC->Gsatt("*", "fill", 7);
675   gMC->SetClipBox(".");
676   gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
677   gMC->DefaultRange();
678   gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
679   gMC->Gdhead(1111, "Time Projection Chamber");
680   gMC->Gdman(18, 4, "MAN");
681   gMC->Gdopt("hide","off");
682 }
683
684 //_____________________________________________________________________________
685 void AliTPCv0::Init()
686 {
687   //
688   // Initialise Time Projection Chamber version 0
689   //
690   printf("TPC version 0 initialized\n");
691 }
692
693 //_____________________________________________________________________________
694 void AliTPCv0::StepManager()
695 {
696   //
697   // Procedure called at each step in the TPC
698   //
699 }