]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STRUCT/AliMAG.cxx
New TGeo features allow us to avoid the use of MANY.
[u/mrichter/AliRoot.git] / STRUCT / AliMAG.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 /* $Id$ */
17
18 ///////////////////////////////////////////////////////////////////////////////
19 //                                                                           //
20 //  L3 Magnet                                                                //
21 //                                                                           //
22 //Begin_Html
23 /*
24 <img src="picts/AliMAGClass.gif">
25 </pre>
26 <br clear=left>
27 <font size=+2 color=red>
28 <p>The responsible person for this module is
29 <a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
30 </font>
31 <pre>
32 */
33 //End_Html
34 //                                                                           //
35 ///////////////////////////////////////////////////////////////////////////////
36  
37 #include <TVirtualMC.h>
38 #include <TGeoMedium.h>
39 #include <TGeoVolume.h>
40 #include <TGeoMatrix.h>
41 #include <TGeoPgon.h>
42 #include <TGeoCompositeShape.h>
43 #include <TGeoManager.h>
44
45 #include "AliMAG.h"
46 #include "AliMagF.h"
47 #include "AliRun.h"
48  
49 ClassImp(AliMAG)
50  
51 //_____________________________________________________________________________
52 AliMAG::AliMAG()
53 {
54   //
55   // Default constructor for L3 magnet
56   //
57 }
58  
59 //_____________________________________________________________________________
60 AliMAG::AliMAG(const char *name, const char *title)
61   : AliModule(name,title)
62 {
63   //
64   // Standard constructor for L3 magnet
65   //
66   //Begin_Html
67   /*
68     <img src="picts/aliMAG.gif">
69   */
70   //End_Html
71   
72   SetMarkerColor(7);
73   SetMarkerStyle(2);
74   SetMarkerSize(0.4);
75 }
76
77 //_____________________________________________________________________________
78 void AliMAG::CreateGeometry()
79 {
80   //
81   // Create geometry for L3 magnet
82   //
83   //Begin_Html
84   /*
85     <img src="picts/mag.gif">
86   */
87   //End_Html
88   //Begin_Html
89   /*
90     <img src="picts/tree_mag.gif">
91   */
92   //End_Html
93   
94   //
95   // Top volume 
96   TGeoVolume* top = gGeoManager->GetVolume("ALIC");
97   // Media 
98   TGeoMedium* medAir  = gGeoManager->GetMedium("MAG_AIR_C1");
99   TGeoMedium* medAlu  = gGeoManager->GetMedium("MAG_ALU_C1");  
100   TGeoMedium* medAluI = gGeoManager->GetMedium("MAG_ALU_C0");
101   TGeoMedium* medFe   = gGeoManager->GetMedium("MAG_FE_C1");
102   TGeoMedium* medFeI  = gGeoManager->GetMedium("MAG_FE_C0");
103   //
104   // Offset between LHC and LEP axis
105   Float_t os = -30.;
106
107   //
108   //  Define Mother 
109   //  
110   TGeoPgon* shMother = new TGeoPgon(22.5, 360., 8, 2);
111   shMother->DefineSection(0, -600., 580., 790.);
112   shMother->DefineSection(1,  600., 580., 790.);  
113   // 
114   TGeoVolume* voMother = new TGeoVolume("L3MO", shMother, medAir);
115   //  
116   // Define coils 
117   //
118   TGeoPgon* shCoils = new TGeoPgon(22.5, 360., 8, 2);
119   shCoils->DefineSection(0, -600., 585., 690.);
120   shCoils->DefineSection(1,  600., 585., 690.);  
121   // 
122   TGeoVolume* voCoils = new TGeoVolume("L3C0", shCoils, medAlu);
123   voMother->AddNode(voCoils, 1, new TGeoTranslation(0., 0., 0.));
124   //
125   TGeoPgon* shCoilsI = new TGeoPgon(22.5, 360., 8, 2);
126   shCoilsI->DefineSection(0, -600., 580., 585.);
127   shCoilsI->DefineSection(1,  600., 580., 585.);  
128   //
129   TGeoVolume* voCoilsI = new TGeoVolume("L3C1", shCoilsI, medAluI);
130   voMother->AddNode(voCoilsI, 1, new TGeoTranslation(0., 0., 0.));
131   //
132   // Define yoke
133   //
134   TGeoPgon* shYoke = new TGeoPgon(22.5, 360., 8, 2);
135   shYoke->DefineSection(0, -600., 690., 790.);
136   shYoke->DefineSection(1,  600., 690., 790.);  
137   // 
138   TGeoVolume* voYoke = new TGeoVolume("L3YO", shYoke, medFe);
139   voMother->AddNode(voYoke, 1, new TGeoTranslation(0., 0., 0.));
140
141   //
142   // Define the return yoke of L3 ("Doors") 
143   //
144   // Original outer part
145   TGeoPgon* shDoorO = new TGeoPgon(22.5, 360., 8, 2);
146   shDoorO->DefineSection(0,  600., 240., 790.);
147   shDoorO->DefineSection(1,  700., 240., 790.);  
148   shDoorO->SetName("A");
149   //
150   // Additional inner part
151   TGeoPgon* shDoorI = new TGeoPgon(22.5, 360., 8, 3);
152   shDoorI->DefineSection(0,  600., 163.5, 270.);
153   shDoorI->DefineSection(1,  670., 163.5, 270.);  
154   shDoorI->DefineSection(2,  700., 213.5, 270.);
155   shDoorI->SetName("B"); 
156   //
157   // For transport: low thresholds close to chambers requires special volume
158   //
159   TGeoPgon* shDoorIe = new TGeoPgon(22.5, 360., 8, 3);
160   shDoorIe->DefineSection(0,  600., 163.5, 168.5);
161   shDoorIe->DefineSection(1,  670., 163.5, 168.5);  
162   shDoorIe->DefineSection(2,  700., 213.5, 218.5);
163   TGeoVolume* voDoorIe = new TGeoVolume("L3DE", shDoorIe, medFeI);
164   //
165   // Use composite shape here to account for the excentric door opening.
166   // This avoids the overlap with the beam shield and the muon tracking station 1
167   //
168   TGeoTranslation* offset = new TGeoTranslation("t1", 0., -os, 0.);
169   offset->RegisterYourself();
170     
171   TGeoCompositeShape* shDoor = new TGeoCompositeShape("L3Door", "A+B:t1");
172   //
173   TGeoVolume* voDoor = new TGeoVolume("L3DO", shDoor, medFe);
174   voDoor->AddNode(voDoorIe, 1, new TGeoTranslation(0., -os, 0.));
175   //
176   // The assembly of everything
177   //
178   TGeoVolumeAssembly* l3 = new TGeoVolumeAssembly("L3TV");
179   TGeoRotation* rotxz = new TGeoRotation("rotxz",  90., 0., 90., 90., 180., 0.);
180   l3->AddNode(voMother, 1, new TGeoTranslation(0., 0., 0.));
181   l3->AddNode(voDoor, 1, new TGeoTranslation(0., 0., 0.));  
182   l3->AddNode(voDoor, 2, new TGeoCombiTrans(0., 0., 0., rotxz));
183   top->AddNode(l3, 1, new TGeoTranslation(0., os, 0.));
184 }
185
186 //_____________________________________________________________________________
187 void AliMAG::CreateMaterials()
188 {
189   //
190   // Create materials for L3 magnet
191   //
192   
193   Int_t   isxfld = gAlice->Field()->Integ();
194   Float_t sxmgmx = gAlice->Field()->Max();
195   Float_t epsil, stmin, deemax, tmaxfd, stemax;
196
197
198   // --- Define the various materials for GEANT --- 
199   
200   Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
201   Float_t zAir[4]={6.,7.,8.,18.};
202   Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
203   Float_t dAir = 1.20479E-3;
204
205
206   //     Aluminum 
207   AliMaterial(9, "Al0$", 26.98, 13., 2.7, 8.9, 37.2);
208   AliMaterial(29, "Al1$", 26.98, 13., 2.7, 8.9, 37.2);
209   
210   //     Iron 
211   AliMaterial(10, "Fe0$", 55.85, 26., 7.87, 1.76, 17.1);
212   AliMaterial(30, "Fe1$", 55.85, 26., 7.87, 1.76, 17.1);
213   
214   //     Air 
215   AliMixture(15, "AIR0$      ", aAir, zAir, dAir, 4, wAir);
216   AliMixture(35, "AIR1$      ", aAir, zAir, dAir, 4, wAir);
217   
218   // **************** 
219   //     Defines tracking media parameters. 
220   //     Les valeurs sont commentees pour laisser le defaut 
221   //     a GEANT (version 3-21, page CONS200), f.m. 
222   epsil  = .001;  // Tracking precision, 
223   stemax = -1.;   // Maximum displacement for multiple scat 
224   tmaxfd = -20.;  // Maximum angle due to field deflection 
225   deemax = -.3;   // Maximum fractional energy loss, DLS 
226   stmin  = -.8;
227   // *************** 
228   
229   //    IRON 
230   
231   AliMedium(10, "FE_C0             ", 10, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
232   AliMedium(30, "FE_C1             ", 30, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
233   
234   //     ALUMINUM 
235
236   AliMedium(9, "ALU_C0            ",  9, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
237   AliMedium(29, "ALU_C1            ", 29, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
238   
239   //     AIR 
240   
241   AliMedium(15, "AIR_C0            ", 15, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
242   AliMedium(35, "AIR_C1            ", 35, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
243 }
244
245 //_____________________________________________________________________________
246 void AliMAG::DrawModule() const
247 {
248   //
249   // Draw a shaded view of the L3 magnet
250   //
251 }
252
253 //_____________________________________________________________________________
254 void AliMAG::Init()
255 {
256   //
257   // Initialise L3 magnet after it has been built
258   Int_t i;
259   //
260   if(AliLog::GetGlobalDebugLevel()>0) {
261     printf("\n%s: ",ClassName());
262     for(i=0;i<35;i++) printf("*");
263     printf(" MAG_INIT ");
264     for(i=0;i<35;i++) printf("*");
265     printf("\n%s: ",ClassName());
266     //
267     // Here the MAG initialisation code (if any!)
268     for(i=0;i<80;i++) printf("*");
269     printf("\n");
270   }
271 }
272