New methods needed in order to srt alignment objects by their geometry level
[u/mrichter/AliRoot.git] / STRUCT / AliMAG.cxx
CommitLineData
4c039060 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
eeacf08b 16/* $Id$ */
4c039060 17
fe4da5cc 18///////////////////////////////////////////////////////////////////////////////
19// //
20// L3 Magnet //
21// //
22//Begin_Html
23/*
1439f98e 24<img src="picts/AliMAGClass.gif">
fe4da5cc 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>
208c5bb6 32
fe4da5cc 33*/
34//End_Html
35// //
36///////////////////////////////////////////////////////////////////////////////
37
88cb7938 38#include <TVirtualMC.h>
73d5f5aa 39#include <TGeoMedium.h>
40#include <TGeoVolume.h>
41#include <TGeoMatrix.h>
42#include <TGeoPgon.h>
43#include <TGeoCompositeShape.h>
44#include <TGeoManager.h>
88cb7938 45
fe4da5cc 46#include "AliMAG.h"
94de3818 47#include "AliMagF.h"
88cb7938 48#include "AliRun.h"
fe4da5cc 49
50ClassImp(AliMAG)
51
52//_____________________________________________________________________________
53AliMAG::AliMAG()
54{
55 //
56 // Default constructor for L3 magnet
57 //
58}
59
60//_____________________________________________________________________________
61AliMAG::AliMAG(const char *name, const char *title)
b8032157 62 : AliModule(name,title)
fe4da5cc 63{
64 //
65 // Standard constructor for L3 magnet
66 //
67 //Begin_Html
68 /*
1439f98e 69 <img src="picts/aliMAG.gif">
fe4da5cc 70 */
71 //End_Html
72
73 SetMarkerColor(7);
74 SetMarkerStyle(2);
75 SetMarkerSize(0.4);
76}
77
78//_____________________________________________________________________________
fe4da5cc 79void AliMAG::CreateGeometry()
80{
81 //
82 // Create geometry for L3 magnet
83 //
84 //Begin_Html
85 /*
1439f98e 86 <img src="picts/mag.gif">
fe4da5cc 87 */
88 //End_Html
208c5bb6 89
fe4da5cc 90 //Begin_Html
91 /*
1439f98e 92 <img src="picts/tree_mag.gif">
208c5bb6 93 <br> Dimensions taken from drawing: ALIL3___00010
fe4da5cc 94 //End_Html
208c5bb6 95 */
96// Octagon
97 const Int_t kNSides = 8;
98 const Float_t kStartAngle = 22.5; // deg
99 const Float_t kFullAngle = 360.0; // deg
100// Mother volume
101 const Float_t kRBMotherInner = 560.00; // cm
102 const Float_t kRBMotherOuter = 790.50; // cm
103 const Float_t kLBMother = 706.00; // cm
104// Yoke
105 const Float_t kRYokeInner = 703.50; // cm
106 const Float_t kRYokeOuter = 790.50; // cm
107 const Float_t kLYoke = 620.00; // cm
108// Coil
109 const Float_t kRCoilInner = 593.00; // cm
110 const Float_t kRCoilOuter = 682.00; // cm
2cadb10d 111 const Float_t kLCoil = 588.00; // cm
112// Cooling
113 const Float_t kRCoolingOuter = 1.70; // cm
114 const Float_t kRCoolingInner = 1.00; // cm
208c5bb6 115// Thermal Shield
116 const Float_t kRThermalShieldInner = 566.00; // cm
117 const Float_t kRThermalShieldOuter = 571.00; // cm
118// Crown
119 const Float_t kRCrownInner = 560.00; // cm
120 const Float_t kRCrownOuter = 785.50; // cm
121 const Float_t kLCrown1 = 605.00; // cm
122 const Float_t kLCrown2 = 620.00; // cm
123 const Float_t kLCrown3 = 706.00; // cm
124// Door
125 const Float_t kRDoorInner = 246.50; // cm
126 const Float_t kRDoorOuter = 560.00; // cm
127 const Float_t kLDoor1 = 615.50; // cm
128 const Float_t kLDoor2 = 714.60; // cm
129
130
73d5f5aa 131 //
132 // Top volume
133 TGeoVolume* top = gGeoManager->GetVolume("ALIC");
134 // Media
2cadb10d 135 TGeoMedium* medAir = gGeoManager->GetMedium("MAG_AIR_C1");
136 TGeoMedium* medAlu = gGeoManager->GetMedium("MAG_ALU_C1");
137 TGeoMedium* medAluI = gGeoManager->GetMedium("MAG_ALU_C0");
138 TGeoMedium* medFe = gGeoManager->GetMedium("MAG_FE_C1");
139 TGeoMedium* medFeI = gGeoManager->GetMedium("MAG_FE_C0");
140 TGeoMedium* medWater = gGeoManager->GetMedium("MAG_WATER");
73d5f5aa 141 //
142 // Offset between LHC and LEP axis
143 Float_t os = -30.;
144
145 //
208c5bb6 146 // Define Barrel Mother
73d5f5aa 147 //
208c5bb6 148 TGeoPgon* shBMother = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 2);
149 shBMother->DefineSection(0, -kLBMother, kRBMotherInner, kRBMotherOuter);
150 shBMother->DefineSection(1, kLBMother, kRBMotherInner, kRBMotherOuter);
151 //
152 TGeoVolume* voBMother = new TGeoVolume("L3BM", shBMother, medAir);
153 //
154 // Define Thermal Shield
155 //
2cadb10d 156 // Only one layer
157 // This can be improved: replace by (protection - shield - insulation) !
158 //
208c5bb6 159 TGeoPgon* shThermSh = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 2);
160 shThermSh->DefineSection(0, -kLCoil, kRThermalShieldInner, kRThermalShieldOuter);
161 shThermSh->DefineSection(1, kLCoil, kRThermalShieldInner, kRThermalShieldOuter);
73d5f5aa 162 //
208c5bb6 163 TGeoVolume* voThermSh = new TGeoVolume("L3TS", shThermSh, medAluI);
164 voBMother->AddNode(voThermSh, 1, new TGeoTranslation(0., 0., 0.));
73d5f5aa 165 //
2cadb10d 166 // Define Coils and cooling circuits
73d5f5aa 167 //
2cadb10d 168 TGeoPgon* shCoilMother = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 2);
169 shCoilMother->DefineSection(0, -kLCoil, kRCoilInner - 2. * kRCoolingOuter, kRCoilOuter + 2. * kRCoolingOuter);
170 shCoilMother->DefineSection(1, kLCoil, kRCoilInner - 2. * kRCoolingOuter, kRCoilOuter + 2. * kRCoolingOuter);
171 //
172 // Coils
173 TGeoVolume* voCoilMother = new TGeoVolume("L3CM", shCoilMother, medAir);
174 voBMother->AddNode(voCoilMother, 1, new TGeoTranslation(0., 0., 0.));
175 // Devide into the 168 turns
176 TGeoVolume* voCoilTurn = voCoilMother->Divide("L3CD", 3, 168, 0., 0.);
208c5bb6 177 TGeoPgon* shCoils = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 2);
2cadb10d 178 shCoils->DefineSection(0, -3., kRCoilInner, kRCoilOuter);
179 shCoils->DefineSection(1, 3., kRCoilInner, kRCoilOuter);
73d5f5aa 180 //
181 TGeoVolume* voCoils = new TGeoVolume("L3C0", shCoils, medAlu);
2cadb10d 182 voCoilTurn->AddNode(voCoils, 1, new TGeoTranslation(0., 0., 0.));
183 //
184 // Hexagonal Cooling circuits
185 //
186 const Float_t kRCC = kRCoolingOuter;
187 const Float_t kRCW = kRCoolingInner;
188 const Float_t kRCL = kRCC * TMath::Tan(30. / 180. * TMath::Pi());
189 const Float_t kRWL = kRCW * TMath::Tan(30. / 180. * TMath::Pi());
190 // Outer Circuits
191 //
192 // Pipe
193 TGeoPgon* shCoolingPipeO = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 4);
194 shCoolingPipeO->DefineSection(0, -kRCC, kRCoilOuter + kRCC, kRCoilOuter + kRCC + 0.01);
195 shCoolingPipeO->DefineSection(1, -kRCL, kRCoilOuter, kRCoilOuter + 2. * kRCC);
196 shCoolingPipeO->DefineSection(2, kRCL, kRCoilOuter, kRCoilOuter + 2. * kRCC);
197 shCoolingPipeO->DefineSection(3, kRCC, kRCoilOuter + kRCC, kRCoilOuter + kRCC + 0.01);
198 //
199 TGeoVolume* voCoolingPipeO = new TGeoVolume("L3CCO", shCoolingPipeO, medAlu);
200 voCoilTurn->AddNode(voCoolingPipeO, 1, new TGeoTranslation(0., 0., 0.));
201 //
202 TGeoPgon* shCoolingWaterO = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 4);
203 shCoolingWaterO->DefineSection(0, -kRCW, kRCoilOuter + kRCC, kRCoilOuter + kRCC + 0.01);
204 shCoolingWaterO->DefineSection(1, -kRWL, kRCoilOuter + (kRCC - kRCW), kRCoilOuter + kRCC + kRCW);
205 shCoolingWaterO->DefineSection(2, kRWL, kRCoilOuter + (kRCC - kRCW), kRCoilOuter + kRCC + kRCW);
206 shCoolingWaterO->DefineSection(3, kRCW, kRCoilOuter + kRCC, kRCoilOuter + kRCC + 0.01);
207 //
208 TGeoVolume* voCoolingWaterO = new TGeoVolume("L3CWO", shCoolingWaterO, medWater);
209 voCoolingPipeO->AddNode(voCoolingWaterO, 1, new TGeoTranslation(0., 0., 0.));
210
211 // Inner Circuits
212 //
213 // Pipe
214 TGeoPgon* shCoolingPipeI = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 4);
215 shCoolingPipeI->DefineSection(0, -kRCC, kRCoilInner - kRCC, kRCoilInner - kRCC + 0.01);
216 shCoolingPipeI->DefineSection(1, -kRCL, kRCoilInner - 2. * kRCC, kRCoilInner);
217 shCoolingPipeI->DefineSection(2, kRCL, kRCoilInner - 2. * kRCC, kRCoilInner);
218 shCoolingPipeI->DefineSection(3, kRCC, kRCoilInner - kRCC, kRCoilInner - kRCC + 0.01);
219 //
220 TGeoVolume* voCoolingPipeI = new TGeoVolume("L3CCI", shCoolingPipeI, medAlu);
221 voCoilTurn->AddNode(voCoolingPipeI, 1, new TGeoTranslation(0., 0., 0.));
222 //
223 TGeoPgon* shCoolingWaterI = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 4);
224 shCoolingWaterI->DefineSection(0, -kRCW, kRCoilInner - kRCC, kRCoilInner - kRCC + 0.01);
225 shCoolingWaterI->DefineSection(1, -kRWL, kRCoilInner - kRCC - kRCW, kRCoilInner - (kRCC - kRCW));
226 shCoolingWaterI->DefineSection(2, kRWL, kRCoilInner - kRCC - kRCW, kRCoilInner - (kRCC - kRCW));
227 shCoolingWaterI->DefineSection(3, kRCW, kRCoilInner - kRCC, kRCoilInner - kRCC + 0.01);
228 //
229 TGeoVolume* voCoolingWaterI = new TGeoVolume("L3CWI", shCoolingWaterI, medWater);
230 voCoolingPipeI->AddNode(voCoolingWaterI, 1, new TGeoTranslation(0., 0., 0.));
231
73d5f5aa 232 //
208c5bb6 233 // Define Yoke
73d5f5aa 234 //
208c5bb6 235 TGeoPgon* shYoke = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 2);
236 shYoke->DefineSection(0, -kLYoke, kRYokeInner, kRYokeOuter);
237 shYoke->DefineSection(1, +kLYoke, kRYokeInner, kRYokeOuter);
73d5f5aa 238 //
239 TGeoVolume* voYoke = new TGeoVolume("L3YO", shYoke, medFe);
208c5bb6 240 voBMother->AddNode(voYoke, 1, new TGeoTranslation(0., 0., 0.));
a00df67b 241
73d5f5aa 242 //
208c5bb6 243 // Define Crown
244 //
245 TGeoPgon* shCrown = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 4);
246 shCrown->DefineSection(0, kLCrown1, kRCrownInner, kRYokeInner);
247 shCrown->DefineSection(1, kLCrown2, kRCrownInner, kRYokeInner);
248 shCrown->DefineSection(2, kLCrown2, kRCrownInner, kRCrownOuter);
249 shCrown->DefineSection(3, kLCrown3, kRCrownInner, kRCrownOuter);
250 //
251 TGeoVolume* voCrown = new TGeoVolume("L3CR", shCrown, medFe);
252 //
253 // Define Door
73d5f5aa 254 //
255 // Original outer part
208c5bb6 256 TGeoPgon* shDoorO = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 2);
257 shDoorO->DefineSection(0, kLDoor1, kRDoorInner, kRDoorOuter);
258 shDoorO->DefineSection(1, kLDoor2, kRDoorInner, kRDoorOuter);
73d5f5aa 259 shDoorO->SetName("A");
260 //
2cadb10d 261 // Additional inner part ("Plug")
208c5bb6 262 TGeoPgon* shDoorI = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 3);
263 shDoorI->DefineSection(0, kLDoor1, 163.5, 280.);
264 shDoorI->DefineSection(1, 686., 163.5, 280.);
265 shDoorI->DefineSection(2, kLDoor2, 213.5, 280.);
73d5f5aa 266 shDoorI->SetName("B");
267 //
208c5bb6 268 // For transport: low thresholds close to chambers requires special medium
73d5f5aa 269 //
208c5bb6 270 TGeoPgon* shDoorIe = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 3);
271 shDoorIe->DefineSection(0, kLDoor1, 163.5, 168.5);
272 shDoorIe->DefineSection(1, 686., 163.5, 168.5);
273 shDoorIe->DefineSection(2, kLDoor2, 213.5, 218.5);
73d5f5aa 274 TGeoVolume* voDoorIe = new TGeoVolume("L3DE", shDoorIe, medFeI);
275 //
276 // Use composite shape here to account for the excentric door opening.
277 // This avoids the overlap with the beam shield and the muon tracking station 1
278 //
279 TGeoTranslation* offset = new TGeoTranslation("t1", 0., -os, 0.);
280 offset->RegisterYourself();
281
282 TGeoCompositeShape* shDoor = new TGeoCompositeShape("L3Door", "A+B:t1");
283 //
284 TGeoVolume* voDoor = new TGeoVolume("L3DO", shDoor, medFe);
285 voDoor->AddNode(voDoorIe, 1, new TGeoTranslation(0., -os, 0.));
208c5bb6 286 // Position crown and door
73d5f5aa 287 TGeoRotation* rotxz = new TGeoRotation("rotxz", 90., 0., 90., 90., 180., 0.);
208c5bb6 288
289 TGeoVolumeAssembly *l3 = new TGeoVolumeAssembly("L3MO");
290 voBMother->AddNode(voCrown, 1, new TGeoTranslation(0., 0., 0.));
291 voBMother->AddNode(voCrown, 2, new TGeoCombiTrans(0., 0., 0., rotxz));
292 l3->AddNode(voBMother, 1, new TGeoTranslation(0.,0.,0.));
293 l3->AddNode(voDoor, 1, new TGeoTranslation(0., 0., 0.));
294 l3->AddNode(voDoor, 2, new TGeoCombiTrans(0., 0., 0., rotxz));
73d5f5aa 295 top->AddNode(l3, 1, new TGeoTranslation(0., os, 0.));
fe4da5cc 296}
297
298//_____________________________________________________________________________
299void AliMAG::CreateMaterials()
300{
301 //
302 // Create materials for L3 magnet
303 //
304
b43eb0dc 305 Int_t isxfld = gAlice->Field()->Integ();
306 Float_t sxmgmx = gAlice->Field()->Max();
fe4da5cc 307 Float_t epsil, stmin, deemax, tmaxfd, stemax;
002b3738 308
309
fe4da5cc 310 // --- Define the various materials for GEANT ---
311
002b3738 312 Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
313 Float_t zAir[4]={6.,7.,8.,18.};
314 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
315 Float_t dAir = 1.20479E-3;
2cadb10d 316 Float_t aWater[2]={1.00794,15.9994};
317 Float_t zWater[2]={1.,8.};
318 Float_t wWater[2]={0.111894,0.888106};
319
002b3738 320
fe4da5cc 321 // Aluminum
4a9de4af 322 AliMaterial(9, "Al0$", 26.98, 13., 2.7, 8.9, 37.2);
323 AliMaterial(29, "Al1$", 26.98, 13., 2.7, 8.9, 37.2);
fe4da5cc 324
325 // Iron
4a9de4af 326 AliMaterial(10, "Fe0$", 55.85, 26., 7.87, 1.76, 17.1);
327 AliMaterial(30, "Fe1$", 55.85, 26., 7.87, 1.76, 17.1);
fe4da5cc 328
329 // Air
4a9de4af 330 AliMixture(15, "AIR0$ ", aAir, zAir, dAir, 4, wAir);
331 AliMixture(35, "AIR1$ ", aAir, zAir, dAir, 4, wAir);
2cadb10d 332 // Water
333 AliMixture(16, "WATER", aWater, zWater, 1., 2, wWater);
334
fe4da5cc 335
336 // ****************
337 // Defines tracking media parameters.
338 // Les valeurs sont commentees pour laisser le defaut
339 // a GEANT (version 3-21, page CONS200), f.m.
340 epsil = .001; // Tracking precision,
341 stemax = -1.; // Maximum displacement for multiple scat
342 tmaxfd = -20.; // Maximum angle due to field deflection
343 deemax = -.3; // Maximum fractional energy loss, DLS
344 stmin = -.8;
345 // ***************
346
347 // IRON
348
b43eb0dc 349 AliMedium(10, "FE_C0 ", 10, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
350 AliMedium(30, "FE_C1 ", 30, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
fe4da5cc 351
352 // ALUMINUM
353
b43eb0dc 354 AliMedium(9, "ALU_C0 ", 9, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
355 AliMedium(29, "ALU_C1 ", 29, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
fe4da5cc 356
357 // AIR
358
b43eb0dc 359 AliMedium(15, "AIR_C0 ", 15, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
360 AliMedium(35, "AIR_C1 ", 35, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
2cadb10d 361
362 // WATER
363 AliMedium(16, "WATER ", 16, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
fe4da5cc 364}
365
366//_____________________________________________________________________________
ba380e33 367void AliMAG::DrawModule() const
fe4da5cc 368{
369 //
370 // Draw a shaded view of the L3 magnet
371 //
372}
373
374//_____________________________________________________________________________
375void AliMAG::Init()
376{
377 //
378 // Initialise L3 magnet after it has been built
379 Int_t i;
380 //
4951e003 381 if(AliLog::GetGlobalDebugLevel()>0) {
9e1a0ddb 382 printf("\n%s: ",ClassName());
383 for(i=0;i<35;i++) printf("*");
384 printf(" MAG_INIT ");
385 for(i=0;i<35;i++) printf("*");
386 printf("\n%s: ",ClassName());
387 //
388 // Here the MAG initialisation code (if any!)
389 for(i=0;i<80;i++) printf("*");
390 printf("\n");
391 }
fe4da5cc 392}
393