Project
Loading...
Searching...
No Matches
Magnet.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12/********************************************************************************
13 * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
14 * *
15 * This software is distributed under the terms of the *
16 * GNU Lesser General Public Licence version 3 (LGPL) version 3, *
17 * copied verbatim in the file "LICENSE" *
18 ********************************************************************************/
19
20// -------------------------------------------------------------------------
21// ----- main responsible: Sandro Wenzel (sandro.wenzel@cern.ch) -----
22// -------------------------------------------------------------------------
23
26#include <DetectorsPassive/Magnet.h>
27#include <TGeoCompositeShape.h>
28#include <TGeoManager.h>
29#include <TGeoMatrix.h>
30#include <TGeoMedium.h>
31#include <TGeoPgon.h>
32#include <TGeoVolume.h>
33#include <TGeoXtru.h>
34#ifdef NDEBUG
35#undef NDEBUG
36#endif
37#include <cassert>
38
39using namespace o2::passive;
40
41Magnet::~Magnet() = default;
42
43Magnet::Magnet() : PassiveBase("MAG", "") {}
44Magnet::Magnet(const char* name, const char* Title) : PassiveBase(name, Title) {}
45Magnet::Magnet(const Magnet& rhs) = default;
46
47Magnet& Magnet::operator=(const Magnet& rhs)
48{
49 // self assignment
50 if (this == &rhs) {
51 return *this;
52 }
53
54 // base class assignment
55 PassiveBase::operator=(rhs);
56
57 return *this;
58}
59
61{
63 //
64 // Create materials for L3 magnet
65 //
66 Int_t isxfld = 2.;
67 Float_t sxmgmx = 10.;
69
70 // The coils, the yoke and the crown sit outside the region the field map
71 // covers, so they are tracked without a field. The doors and the plugs are
72 // the exception: they reach the beam axis inside the solenoid and keep it.
73 Int_t isxfldNoField = 0;
74 Float_t epsil, stmin, deemax, tmaxfd, stemax;
75
76 // --- Define the various materials for GEANT ---
77 // Steel
78 Float_t asteel[4] = {55.847, 51.9961, 58.6934, 28.0855};
79 Float_t zsteel[4] = {26., 24., 28., 14.};
80 Float_t wsteel[4] = {.715, .18, .1, .005};
81 Float_t aAir[4] = {12.0107, 14.0067, 15.9994, 39.948};
82 Float_t zAir[4] = {6., 7., 8., 18.};
83 Float_t wAir[4] = {0.000124, 0.755267, 0.231781, 0.012827};
84 Float_t dAir = 1.20479E-3;
85 Float_t aWater[2] = {1.00794, 15.9994};
86 Float_t zWater[2] = {1., 8.};
87 Float_t wWater[2] = {0.111894, 0.888106};
88
89 // Aluminum
90 matmgr.Material("MAG", 9, "Al0$", 26.98, 13., 2.7, 8.9, 37.2);
91 matmgr.Material("MAG", 29, "Al1$", 26.98, 13., 2.7, 8.9, 37.2);
92
93 // Stainless Steel
94 matmgr.Mixture("MAG", 19, "STAINLESS STEEL1", asteel, zsteel, 7.88, 4, wsteel);
95 matmgr.Mixture("MAG", 39, "STAINLESS STEEL2", asteel, zsteel, 7.88, 4, wsteel);
96 matmgr.Mixture("MAG", 59, "STAINLESS STEEL3", asteel, zsteel, 7.88, 4, wsteel);
97
98 // Iron
99 matmgr.Material("MAG", 10, "Fe0$", 55.85, 26., 7.87, 1.76, 17.1);
100 matmgr.Material("MAG", 30, "Fe1$", 55.85, 26., 7.87, 1.76, 17.1);
101
102 // Air
103 matmgr.Mixture("MAG", 15, "AIR0$", aAir, zAir, dAir, 4, wAir);
104 matmgr.Mixture("MAG", 35, "AIR1$", aAir, zAir, dAir, 4, wAir);
105
106 // Water
107 matmgr.Mixture("MAG", 16, "WATER", aWater, zWater, 1., 2, wWater);
108
109 // ****************
110 // Defines tracking media parameters.
111 // Les valeurs sont commentees pour laisser le defaut
112 // a GEANT (version 3-21, page CONS200), f.m.
113 epsil = .001; // Tracking precision,
114 stemax = -1.; // Maximum displacement for multiple scat
115 tmaxfd = -20.; // Maximum angle due to field deflection
116 deemax = -.3; // Maximum fractional energy loss, DLS
117 stmin = -.8;
118 // ***************
119
120 // IRON
121 matmgr.Medium("MAG", 10, "FE_C0", 10, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
122 matmgr.Medium("MAG", 30, "FE_C1", 30, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
123
124 // ALUMINUM
125 matmgr.Medium("MAG", 9, "ALU_C0", 9, 0, isxfldNoField, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
126 matmgr.Medium("MAG", 29, "ALU_C1", 29, 0, isxfldNoField, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
127
128 // AIR
129 matmgr.Medium("MAG", 15, "AIR_C0", 15, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
130 matmgr.Medium("MAG", 35, "AIR_C1", 35, 0, isxfldNoField, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
131
132 // Steel
133 matmgr.Medium("MAG", 19, "ST_C0", 19, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
134 matmgr.Medium("MAG", 39, "ST_C1", 39, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
135 matmgr.Medium("MAG", 49, "ST_C1_NF", 39, 0, isxfldNoField, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
136 matmgr.Medium("MAG", 59, "ST_C3", 59, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
137 // WATER
138 matmgr.Medium("MAG", 16, "WATER", 16, 0, isxfldNoField, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
139}
140
142{
144
145 // Octagon
146 const Int_t kNSides = 8;
147 const Float_t kStartAngle = 22.5; // deg
148 const Float_t kFullAngle = 360.0; // deg
149 // Mother volume
150 const Float_t kRBMotherInner = 600.00; // cm
151 const Float_t kRBMotherOuter = 790.50; // cm
152 const Float_t kLBMother = 706.00; // cm
153 // Yoke
154 const Float_t kRYokeInner = 703.50; // cm
155 const Float_t kRYokeOuter = 790.50; // cm
156 const Float_t kLYoke = 620.00; // cm
157 // Coil
158 const Float_t kRCoilInner = 593.00; // cm
159 const Float_t kRCoilOuter = 682.00; // cm
160 const Float_t kLCoil = 588.00; // cm
161 // Cooling
162 const Float_t kRCoolingOuter = 1.70; // cm
163 const Float_t kRCoolingInner = 1.00; // cm
164 // Thermal Shield
165 const Float_t kRThermalShieldInner = 566.00; // cm
166 const Float_t kRThermalShieldOuter = 571.00; // cm
167 // Crown
168 const Float_t kRCrownInner = 600.00; // cm
169 const Float_t kRCrownOuter = 785.50; // cm
170 const Float_t kLCrown1 = 605.00; // cm
171 const Float_t kLCrown2 = 620.00; // cm
172 const Float_t kLCrown3 = 706.00; // cm
173 // Door
174 const Float_t kRDoorOuter = 600.00; // cm
175 const Float_t kRPlugInner = 183.50; // cm
176 const Float_t kLDoor1 = 615.50; // cm
177 const Float_t kLDoor2 = 714.60; // cm
178 //
179 const Float_t kDegRad = TMath::Pi() / 180.;
180
181 //
182 // Top volume
183 TGeoVolume* top = gGeoManager->GetVolume("barrel");
184 assert(top);
185
186 // Media
188 auto medAir = matmgr.getTGeoMedium("MAG_AIR_C1");
189 auto medAlu = matmgr.getTGeoMedium("MAG_ALU_C1");
190 auto medAluI = matmgr.getTGeoMedium("MAG_ALU_C0");
191 auto medSteel = matmgr.getTGeoMedium("MAG_ST_C1");
192 auto medSteelNF = matmgr.getTGeoMedium("MAG_ST_C1_NF");
193 auto medWater = matmgr.getTGeoMedium("MAG_WATER");
194 //
195 // Offset between LHC and LEP axis
196 Float_t os = -30.;
197
198 //
199 // Define Barrel Mother
200 //
201 TGeoPgon* shBMother = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 2);
202 shBMother->DefineSection(0, -kLBMother, kRBMotherInner, kRBMotherOuter);
203 shBMother->DefineSection(1, kLBMother, kRBMotherInner, kRBMotherOuter);
204 //
205 TGeoVolumeAssembly* voBMother = new TGeoVolumeAssembly("L3BM");
206 //
207 // Define Thermal Shield
208 //
209 // Only one layer
210 // This can be improved: replace by (protection - shield - insulation) !
211 //
212 TGeoPgon* shThermSh = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 2);
213 shThermSh->DefineSection(0, -kLCoil, kRThermalShieldInner, kRThermalShieldOuter);
214 shThermSh->DefineSection(1, kLCoil, kRThermalShieldInner, kRThermalShieldOuter);
215 //
216 TGeoVolume* voThermSh = new TGeoVolume("L3TS", shThermSh, medAluI);
217 voBMother->AddNode(voThermSh, 1, new TGeoTranslation(0., 0., 0.));
218 //
219 // Define Coils and cooling circuits
220 //
221 TGeoPgon* shCoilMother = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 2);
222 shCoilMother->DefineSection(0, -kLCoil, kRCoilInner - 2. * kRCoolingOuter, kRCoilOuter + 2. * kRCoolingOuter);
223 shCoilMother->DefineSection(1, kLCoil, kRCoilInner - 2. * kRCoolingOuter, kRCoilOuter + 2. * kRCoolingOuter);
224 //
225 // Coils
226 TGeoVolume* voCoilMother = new TGeoVolume("L3CM", shCoilMother, medAir);
227 voBMother->AddNode(voCoilMother, 1, new TGeoTranslation(0., 0., 0.));
228 // Divide into the 168 turns
229 TGeoVolume* voCoilTurn = voCoilMother->Divide("L3CD", 3, 168, 0., 0.);
230 TGeoPgon* shCoils = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 2);
231 shCoils->DefineSection(0, -3., kRCoilInner, kRCoilOuter);
232 shCoils->DefineSection(1, 3., kRCoilInner, kRCoilOuter);
233 //
234 TGeoVolume* voCoils = new TGeoVolume("L3C0", shCoils, medAlu);
235 voCoilTurn->AddNode(voCoils, 1, new TGeoTranslation(0., 0., 0.));
236 //
237 // Hexagonal Cooling circuits
238 //
239 const Float_t kRCC = kRCoolingOuter;
240 const Float_t kRCW = kRCoolingInner;
241 const Float_t kRCL = kRCC * TMath::Tan(30. / 180. * TMath::Pi());
242 const Float_t kRWL = kRCW * TMath::Tan(30. / 180. * TMath::Pi());
243 // Outer Circuits
244 //
245 // Pipe
246 TGeoPgon* shCoolingPipeO = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 4);
247 shCoolingPipeO->DefineSection(0, -kRCC, kRCoilOuter + kRCC, kRCoilOuter + kRCC + 0.01);
248 shCoolingPipeO->DefineSection(1, -kRCL, kRCoilOuter, kRCoilOuter + 2. * kRCC);
249 shCoolingPipeO->DefineSection(2, kRCL, kRCoilOuter, kRCoilOuter + 2. * kRCC);
250 shCoolingPipeO->DefineSection(3, kRCC, kRCoilOuter + kRCC, kRCoilOuter + kRCC + 0.01);
251 //
252 TGeoVolume* voCoolingPipeO = new TGeoVolume("L3CCO", shCoolingPipeO, medAlu);
253 voCoilTurn->AddNode(voCoolingPipeO, 1, new TGeoTranslation(0., 0., 0.));
254 //
255 TGeoPgon* shCoolingWaterO = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 4);
256 shCoolingWaterO->DefineSection(0, -kRCW, kRCoilOuter + kRCC, kRCoilOuter + kRCC + 0.01);
257 shCoolingWaterO->DefineSection(1, -kRWL, kRCoilOuter + (kRCC - kRCW), kRCoilOuter + kRCC + kRCW);
258 shCoolingWaterO->DefineSection(2, kRWL, kRCoilOuter + (kRCC - kRCW), kRCoilOuter + kRCC + kRCW);
259 shCoolingWaterO->DefineSection(3, kRCW, kRCoilOuter + kRCC, kRCoilOuter + kRCC + 0.01);
260 //
261 TGeoVolume* voCoolingWaterO = new TGeoVolume("L3CWO", shCoolingWaterO, medWater);
262 voCoolingPipeO->AddNode(voCoolingWaterO, 1, new TGeoTranslation(0., 0., 0.));
263
264 // Inner Circuits
265 //
266 // Pipe
267 TGeoPgon* shCoolingPipeI = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 4);
268 shCoolingPipeI->DefineSection(0, -kRCC, kRCoilInner - kRCC, kRCoilInner - kRCC + 0.01);
269 shCoolingPipeI->DefineSection(1, -kRCL, kRCoilInner - 2. * kRCC, kRCoilInner);
270 shCoolingPipeI->DefineSection(2, kRCL, kRCoilInner - 2. * kRCC, kRCoilInner);
271 shCoolingPipeI->DefineSection(3, kRCC, kRCoilInner - kRCC, kRCoilInner - kRCC + 0.01);
272 //
273 TGeoVolume* voCoolingPipeI = new TGeoVolume("L3CCI", shCoolingPipeI, medAlu);
274 voCoilTurn->AddNode(voCoolingPipeI, 1, new TGeoTranslation(0., 0., 0.));
275 //
276 TGeoPgon* shCoolingWaterI = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 4);
277 shCoolingWaterI->DefineSection(0, -kRCW, kRCoilInner - kRCC, kRCoilInner - kRCC + 0.01);
278 shCoolingWaterI->DefineSection(1, -kRWL, kRCoilInner - kRCC - kRCW, kRCoilInner - (kRCC - kRCW));
279 shCoolingWaterI->DefineSection(2, kRWL, kRCoilInner - kRCC - kRCW, kRCoilInner - (kRCC - kRCW));
280 shCoolingWaterI->DefineSection(3, kRCW, kRCoilInner - kRCC, kRCoilInner - kRCC + 0.01);
281 //
282 TGeoVolume* voCoolingWaterI = new TGeoVolume("L3CWI", shCoolingWaterI, medWater);
283 voCoolingPipeI->AddNode(voCoolingWaterI, 1, new TGeoTranslation(0., 0., 0.));
284
285 //
286 // Define Yoke
287 //
288 TGeoPgon* shYoke = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 2);
289 shYoke->DefineSection(0, -kLYoke, kRYokeInner, kRYokeOuter);
290 shYoke->DefineSection(1, +kLYoke, kRYokeInner, kRYokeOuter);
291 //
292 TGeoVolume* voYoke = new TGeoVolume("L3YO", shYoke, medSteelNF);
293 voBMother->AddNode(voYoke, 1, new TGeoTranslation(0., 0., 0.));
294
295 //
296 // Define Crown
297 //
298 TGeoPgon* shCrown = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 4);
299 shCrown->DefineSection(0, kLCrown1, kRCrownInner, kRYokeInner);
300 shCrown->DefineSection(1, kLCrown2, kRCrownInner, kRYokeInner);
301 shCrown->DefineSection(2, kLCrown2, kRCrownInner, kRCrownOuter);
302 shCrown->DefineSection(3, kLCrown3, kRCrownInner, kRCrownOuter);
303 //
304 TGeoVolume* voCrown = new TGeoVolume("L3CR", shCrown, medSteelNF);
305
306 //
307 // Door including "Plug"
308 //
309 Float_t slo = 2. * kRDoorOuter * TMath::Tan(22.5 * kDegRad);
310 Float_t sli = 2. * kRPlugInner * TMath::Tan(22.5 * kDegRad);
311 Double_t xpol1[12], xpol2[12], ypol1[12], ypol2[12];
312
313 xpol1[0] = 2.;
314 ypol1[0] = kRDoorOuter;
315 xpol1[1] = slo / 2.;
316 ypol1[1] = kRDoorOuter;
317 xpol1[2] = kRDoorOuter;
318 ypol1[2] = slo / 2.;
319 xpol1[3] = kRDoorOuter;
320 ypol1[3] = -slo / 2.;
321 xpol1[4] = slo / 2.;
322 ypol1[4] = -kRDoorOuter;
323 xpol1[5] = 2.;
324 ypol1[5] = -kRDoorOuter;
325 xpol1[6] = 2.;
326 ypol1[6] = -kRPlugInner - os;
327 xpol1[7] = sli / 2.;
328 ypol1[7] = -kRPlugInner - os;
329 xpol1[8] = kRPlugInner;
330 ypol1[8] = -sli / 2. - os;
331 xpol1[9] = kRPlugInner;
332 ypol1[9] = sli / 2. - os;
333 xpol1[10] = sli / 2.;
334 ypol1[10] = kRPlugInner - os;
335 xpol1[11] = 2.;
336 ypol1[11] = kRPlugInner - os;
337
338 TGeoXtru* shL3DoorR = new TGeoXtru(2);
339 shL3DoorR->DefinePolygon(12, xpol1, ypol1);
340 shL3DoorR->DefineSection(0, kLDoor1);
341 shL3DoorR->DefineSection(1, kLDoor2);
342 TGeoVolume* voL3DoorR = new TGeoVolume("L3DoorR", shL3DoorR, medSteel);
343
344 for (Int_t i = 0; i < 12; i++) {
345 xpol2[i] = -xpol1[11 - i];
346 ypol2[i] = ypol1[11 - i];
347 }
348
349 TGeoXtru* shL3DoorL = new TGeoXtru(2);
350 shL3DoorL->DefinePolygon(12, xpol2, ypol2);
351 shL3DoorL->DefineSection(0, kLDoor1);
352 shL3DoorL->DefineSection(1, kLDoor2);
353 TGeoVolume* voL3DoorL = new TGeoVolume("L3DoorL", shL3DoorL, medSteel);
354 //
355 // Plug support plate
356 //
357 Float_t ro = kRPlugInner + 50.;
358 slo = 2. * ro * TMath::Tan(22.5 * kDegRad);
359
360 xpol1[0] = 2.;
361 ypol1[0] = ro - os;
362 xpol1[1] = slo / 2.;
363 ypol1[1] = ro - os;
364 xpol1[2] = ro;
365 ypol1[2] = slo / 2. - os;
366 xpol1[3] = ro;
367 ypol1[3] = -slo / 2. - os;
368 xpol1[4] = slo / 2.;
369 ypol1[4] = -ro - os;
370 xpol1[5] = 2.;
371 ypol1[5] = -ro - os;
372
373 for (Int_t i = 0; i < 12; i++) {
374 xpol2[i] = -xpol1[11 - i];
375 ypol2[i] = ypol1[11 - i];
376 }
377
378 TGeoXtru* shL3PlugSPR = new TGeoXtru(2);
379 shL3PlugSPR->DefinePolygon(12, xpol1, ypol1);
380 shL3PlugSPR->DefineSection(0, kLDoor1 - 10.);
381 shL3PlugSPR->DefineSection(1, kLDoor1);
382 TGeoVolume* voL3PlugSPR = new TGeoVolume("L3PlugSPR", shL3PlugSPR, medSteel);
383
384 TGeoXtru* shL3PlugSPL = new TGeoXtru(2);
385 shL3PlugSPL->DefinePolygon(12, xpol2, ypol2);
386 shL3PlugSPL->DefineSection(0, kLDoor1 - 10.);
387 shL3PlugSPL->DefineSection(1, kLDoor1);
388 TGeoVolume* voL3PlugSPL = new TGeoVolume("L3PlugSPL", shL3PlugSPL, medSteel);
389
390 // Position crown and door
391 TGeoRotation* rotxz = new TGeoRotation("rotxz", 90., 0., 90., 90., 180., 0.);
392
393 TGeoVolumeAssembly* l3 = new TGeoVolumeAssembly("L3MO");
394 voBMother->AddNode(voCrown, 1, new TGeoTranslation(0., 0., 0.));
395 voBMother->AddNode(voCrown, 2, new TGeoCombiTrans(0., 0., 0., rotxz));
396 l3->AddNode(voBMother, 1, new TGeoTranslation(0., 0., 0.));
397 l3->AddNode(voL3DoorR, 1, new TGeoTranslation(0., 0., 0.));
398 l3->AddNode(voL3DoorR, 2, new TGeoCombiTrans(0., 0., 0., rotxz));
399 l3->AddNode(voL3DoorL, 1, new TGeoTranslation(0., 0., 0.));
400 l3->AddNode(voL3DoorL, 2, new TGeoCombiTrans(0., 0., 0., rotxz));
401 l3->AddNode(voL3PlugSPR, 1, new TGeoTranslation(0., 0., 0.));
402 l3->AddNode(voL3PlugSPR, 2, new TGeoCombiTrans(0., 0., 0., rotxz));
403 l3->AddNode(voL3PlugSPL, 1, new TGeoTranslation(0., 0., 0.));
404 l3->AddNode(voL3PlugSPL, 2, new TGeoCombiTrans(0., 0., 0., rotxz));
405 top->AddNode(l3, 1, new TGeoTranslation(0., 0., 0.));
406}
407
408FairModule* Magnet::CloneModule() const { return new Magnet(*this); }
Definition of the Detector class.
int32_t i
ClassImp(IdPath)
static void initFieldTrackingParams(int &mode, float &maxfield)
Definition Detector.cxx:143
static MaterialManager & Instance()
void createMaterials()
Definition Magnet.cxx:60
void ConstructGeometry() override
Definition Magnet.cxx:141
FairModule * CloneModule() const override
Clone this object (used in MT mode only)
Definition Magnet.cxx:408
a common base class for passive modules - implementing generic functions
Definition PassiveBase.h:24
GLdouble GLdouble GLdouble GLdouble top
Definition glcorearb.h:4077
GLuint const GLchar * name
Definition glcorearb.h:781