ATLAS Offline Software
ForwardRegionGeoModelElements.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "GeoModelKernel/GeoBox.h"
7 #include "GeoModelKernel/GeoTube.h"
8 #include "GeoModelKernel/GeoPcon.h"
9 #include "GeoModelKernel/GeoEllipticalTube.h"
10 #include "GeoModelKernel/GeoShapeSubtraction.h"
11 #include "GeoModelKernel/GeoShapeIntersection.h"
12 #include "GeoModelKernel/GeoShapeUnion.h"
13 #include "GeoModelKernel/GeoShapeShift.h"
14 #include "GeoModelKernel/GeoLogVol.h"
15 #include "GeoModelKernel/GeoNameTag.h"
16 #include "GeoModelKernel/GeoPhysVol.h"
17 #include "GeoModelKernel/GeoFullPhysVol.h"
18 #include "GeoModelKernel/GeoTransform.h"
19 #include "GeoModelKernel/GeoAlignableTransform.h"
20 #include "GeoModelKernel/GeoDefinitions.h"
21 #include "GeoGenericFunctions/AbsFunction.h"
22 #include "GeoGenericFunctions/Sin.h"
23 #include "GeoGenericFunctions/Cos.h"
24 #include "GaudiKernel/SystemOfUnits.h"
25 
26 GeoPhysVol* ForwardRegionGeoModelFactory::insertMagnetEnvelope(const std::string& name, double x, double y, double z, double rotationAngle, double diameter, double halfL, double dL, GeoPhysVol* fwrPhys)
27 {
28  const GeoTube *tube = new GeoTube(0, diameter/2, halfL-dL);
29 
30  GeoTrf::Transform3D shift = GeoTrf::Translate3D(x,y,z);
31  GeoTrf::Transform3D rotate = GeoTrf::RotateY3D(rotationAngle);
32 // Transform3D rotateX180 = GeoTrf::RotateX3D(180*Gaudi::Units::deg);
33 
34  const GeoShapeShift& magTube0 = (*tube)<<rotate<<shift;
35 // const GeoShapeUnion& magTube = magTube0.add((*tube)<<rotate<<shift<<rotateX180);
36 
37  const GeoLogVol *tubeLog = new GeoLogVol(name, &magTube0, m_MapMaterials[std::string("std::Vacuum")]);
38 
39  GeoPhysVol *tubePhys = new GeoPhysVol(tubeLog);
40 
41  GeoNameTag *tag = new GeoNameTag(name);
42  fwrPhys->add(tag);
43 
44  fwrPhys->add(tubePhys);
45 
46  return tubePhys;
47 }
48 
49 void ForwardRegionGeoModelFactory::insertCircularElement(const std::string& name, double x, double y, double z, double rotationAngle, double xAperture, double yAperture, double halfL, double dL, double tubeThickness, GeoPhysVol* fwrPhys)
50 {
51  double r0 = std::max(xAperture,yAperture)*Gaudi::Units::mm/2;
52 
53  const GeoTube *ringTube = new GeoTube(r0, r0+tubeThickness, halfL-dL);
54 
55  const GeoLogVol *ringLog = new GeoLogVol(name+"Log", ringTube, m_MapMaterials[std::string("Steel")]);
56 
57  GeoPhysVol *ringPhys = new GeoPhysVol(ringLog);
58 
59  //create rotation and traslation and add them to the tree of volumes of the world (move and rotate the volume)
60  GeoTransform *move = new GeoTransform(GeoTrf::Translate3D(x,y,z));
61  fwrPhys->add(move);
62  GeoTransform *rotate = new GeoTransform(GeoTrf::RotateY3D(rotationAngle));
63  fwrPhys->add(rotate);
64 
65  GeoNameTag *tag = new GeoNameTag(name);
66  fwrPhys->add(tag);
67 
68  fwrPhys->add(ringPhys);
69 
70 // // The other side of the forward region may be obtained by rotation
71 // GeoTransform *rotateX180 = new GeoTransform(GeoTrf::RotateX3D(180*Gaudi::Units::deg));
72 
73 // // the other side
74 // fwrPhys->add(rotateX180);
75 // fwrPhys->add(move);
76 // fwrPhys->add(rotate);
77 // tag = new GeoNameTag(name+"_L");
78 // fwrPhys->add(tag);
79 // fwrPhys->add(ringPhys);
80 }
81 
82 void ForwardRegionGeoModelFactory::insertEllipticalElement(const std::string& name, double x, double y, double z, double rotationAngle, double xAperture, double yAperture, double halfL, double dL, double tubeThickness, GeoPhysVol* fwrPhys)
83 {
84  const GeoShape * ringTube0;
85  GeoShape * ringTube2;
86 
87  // GeoEllipticalTube causes VP1 to fall, so for visualization GeoBox is used
89  ringTube0 = new GeoEllipticalTube(xAperture*Gaudi::Units::mm/2+tubeThickness, yAperture*Gaudi::Units::mm/2+tubeThickness, halfL-dL);
90  ringTube2 = new GeoEllipticalTube(xAperture*Gaudi::Units::mm/2, yAperture*Gaudi::Units::mm/2, halfL-dL);
91  }
92  else {
93  ringTube0 = new GeoBox(xAperture*Gaudi::Units::mm/2+tubeThickness, yAperture*Gaudi::Units::mm/2+tubeThickness, halfL-dL);
94  ringTube2 = new GeoBox(xAperture*Gaudi::Units::mm/2, yAperture*Gaudi::Units::mm/2, halfL-dL);
95  }
96  GeoShapeSubtraction * ringTube = new GeoShapeSubtraction(ringTube0, ringTube2);
97 
98  const GeoLogVol *ringLog = new GeoLogVol(name+"Log", ringTube, m_MapMaterials[std::string("Steel")]);
99 
100  GeoPhysVol *ringPhys = new GeoPhysVol(ringLog);
101 
102  //create rotation and traslation and add them to the tree of volumes of the world (move and rotate the volume)
103  GeoTransform *move = new GeoTransform(GeoTrf::Translate3D(x,y,z));
104  fwrPhys->add(move);
105  GeoTransform *rotate = new GeoTransform(GeoTrf::RotateY3D(rotationAngle));
106  fwrPhys->add(rotate);
107 
108  GeoNameTag *tag = new GeoNameTag(name);
109  fwrPhys->add(tag);
110 
111  fwrPhys->add(ringPhys);
112 
113 // // The other side of the forward region may be obtained by rotation
114 // GeoTransform *rotateX180 = new GeoTransform(GeoTrf::RotateX3D(180*Gaudi::Units::deg));
115 
116 // // the other side
117 // fwrPhys->add(rotateX180);
118 // fwrPhys->add(move);
119 // fwrPhys->add(rotate);
120 // tag = new GeoNameTag(name+"_L");
121 // fwrPhys->add(tag);
122 // fwrPhys->add(ringPhys);
123 }
124 
125 void ForwardRegionGeoModelFactory::insertXRecticircularElement(const std::string& name, double x, double y, double z, double rotationAngle, double xAperture, double yAperture, double halfL, double dL, double tubeThickness, GeoPhysVol* fwrPhys)
126 {
127  double beamScreenSeparation = 1.5*Gaudi::Units::mm;
128  double beamScreenCuThick = 0.05*Gaudi::Units::mm;
129  double beamScreenSteelThick = 1*Gaudi::Units::mm;
130 
131  const GeoTube *ringTube = new GeoTube(yAperture*Gaudi::Units::mm/2+beamScreenCuThick+beamScreenSteelThick+beamScreenSeparation, yAperture*Gaudi::Units::mm/2+beamScreenCuThick+beamScreenSteelThick+beamScreenSeparation+tubeThickness, halfL-dL);
132  const GeoTube *circ = new GeoTube(0, yAperture*Gaudi::Units::mm/2, halfL-dL);
133  const GeoBox *rect = new GeoBox(xAperture*Gaudi::Units::mm/2, yAperture*Gaudi::Units::mm/2, halfL-dL);
134  GeoShapeIntersection *innerVac = new GeoShapeIntersection(rect,circ);
135 
136  const GeoTube *circ2 = new GeoTube(0, yAperture*Gaudi::Units::mm/2+beamScreenCuThick, halfL-dL);
137  const GeoBox *rect2 = new GeoBox(xAperture*Gaudi::Units::mm/2+beamScreenCuThick, yAperture*Gaudi::Units::mm/2+beamScreenCuThick, halfL-dL);
138  GeoShapeIntersection *beamScreenCu0 = new GeoShapeIntersection(rect2,circ2);
139  GeoShapeSubtraction *beamScreenCu = new GeoShapeSubtraction(beamScreenCu0, innerVac);
140 
141  const GeoTube *circ3 = new GeoTube(0, yAperture*Gaudi::Units::mm/2+beamScreenCuThick+beamScreenSteelThick, halfL-dL);
142  const GeoBox *rect3 = new GeoBox(xAperture*Gaudi::Units::mm/2+beamScreenCuThick+beamScreenSteelThick, yAperture*Gaudi::Units::mm/2+beamScreenCuThick+beamScreenSteelThick, halfL-dL);
143  GeoShapeIntersection *beamScreenSteel01 = new GeoShapeIntersection(rect3,circ3);
144  GeoShapeSubtraction *beamScreenSteel02 = new GeoShapeSubtraction(beamScreenSteel01, innerVac);
145  GeoShapeSubtraction *beamScreenSteel = new GeoShapeSubtraction(beamScreenSteel02, beamScreenCu);
146 
147  const GeoLogVol *ringLog = new GeoLogVol(name+"BeamPipe", ringTube, m_MapMaterials[std::string("Steel")]);
148  const GeoLogVol *ringLogCu = new GeoLogVol(name+"BeamScreenCu", beamScreenCu, m_MapMaterials[std::string("Copper")]);
149  const GeoLogVol *ringLogSteel = new GeoLogVol(name+"BeamScreenSteel", beamScreenSteel, m_MapMaterials[std::string("Steel")]);
150 
151  GeoPhysVol *ringPhys = new GeoPhysVol(ringLog);
152  GeoPhysVol *ringPhysCu = new GeoPhysVol(ringLogCu);
153  GeoPhysVol *ringPhysSteel = new GeoPhysVol(ringLogSteel);
154 
155  //create rotation and traslation and add them to the tree of volumes of the world (move and rotate the volume)
156  GeoTransform *move = new GeoTransform(GeoTrf::Translate3D(x,y,z));
157  fwrPhys->add(move);
158  GeoTransform *rotate = new GeoTransform(GeoTrf::RotateY3D(rotationAngle));
159  fwrPhys->add(rotate);
160 
161  GeoNameTag *tag = new GeoNameTag(name+"BeamPipe");
162  fwrPhys->add(tag);
163 
164  fwrPhys->add(ringPhys);
165  //detectorManager->addTreeTop(ringPhys);
166 
167  // add beam scren
168  fwrPhys->add(move);
169  fwrPhys->add(rotate);
170  tag = new GeoNameTag(name+"BeamScreenCu");
171  fwrPhys->add(tag);
172  fwrPhys->add(ringPhysCu);
173  fwrPhys->add(move);
174  fwrPhys->add(rotate);
175  tag = new GeoNameTag(name+"BeamScreenSteel");
176  fwrPhys->add(tag);
177  fwrPhys->add(ringPhysSteel);
178 
179 
180 // // The other side of the forward region may be obtain by rotation
181 // GeoTransform *rotateX180 = new GeoTransform(GeoTrf::RotateX3D(180*Gaudi::Units::deg));
182 
183 // // the other side
184 // fwrPhys->add(rotateX180);
185 // fwrPhys->add(move);
186 // fwrPhys->add(rotate);
187 // tag = new GeoNameTag(name+"BeamPipe_L");
188 // fwrPhys->add(tag);
189 // fwrPhys->add(ringPhys);
190 
191 // fwrPhys->add(rotateX180);
192 // fwrPhys->add(move);
193 // fwrPhys->add(rotate);
194 // tag = new GeoNameTag(name+"BeamScreenCu_L");
195 // fwrPhys->add(tag);
196 // fwrPhys->add(ringPhysCu);
197 
198 // fwrPhys->add(rotateX180);
199 // fwrPhys->add(move);
200 // fwrPhys->add(rotate);
201 // tag = new GeoNameTag(name+"BeamScreenSteel_L");
202 // fwrPhys->add(tag);
203 // fwrPhys->add(ringPhysSteel);
204 }
205 
206 void ForwardRegionGeoModelFactory::insertYRecticircularElement(const std::string& name, double x, double y, double z, double rotationAngle, double xAperture, double yAperture, double halfL, double dL, double tubeThickness, GeoPhysVol* fwrPhys)
207 {
208  double beamScreenSeparation = 1.5*Gaudi::Units::mm;
209  double beamScreenCuThick = 0.05*Gaudi::Units::mm;
210  double beamScreenSteelThick = 1*Gaudi::Units::mm;
211 
212  const GeoTube *ringTube = new GeoTube(xAperture*Gaudi::Units::mm/2+beamScreenCuThick+beamScreenSteelThick+beamScreenSeparation, xAperture*Gaudi::Units::mm/2+beamScreenCuThick+beamScreenSteelThick+beamScreenSeparation+tubeThickness, halfL-dL);
213  const GeoTube *circ = new GeoTube(0, xAperture*Gaudi::Units::mm/2, halfL-dL);
214  const GeoBox *rect = new GeoBox(xAperture*Gaudi::Units::mm/2, yAperture*Gaudi::Units::mm/2, halfL-dL);
215  GeoShapeIntersection *innerVac = new GeoShapeIntersection(rect,circ);
216 
217  const GeoTube *circ2 = new GeoTube(0, xAperture*Gaudi::Units::mm/2+beamScreenCuThick, halfL-dL);
218  const GeoBox *rect2 = new GeoBox(xAperture*Gaudi::Units::mm/2+beamScreenCuThick, yAperture*Gaudi::Units::mm/2+beamScreenCuThick, halfL-dL);
219  GeoShapeIntersection *beamScreenCu0 = new GeoShapeIntersection(rect2,circ2);
220  GeoShapeSubtraction *beamScreenCu = new GeoShapeSubtraction(beamScreenCu0, innerVac);
221 
222  const GeoTube *circ3 = new GeoTube(0, xAperture*Gaudi::Units::mm/2+beamScreenCuThick+beamScreenSteelThick, halfL-dL);
223  const GeoBox *rect3 = new GeoBox(xAperture*Gaudi::Units::mm/2+beamScreenCuThick+beamScreenSteelThick, yAperture*Gaudi::Units::mm/2+beamScreenCuThick+beamScreenSteelThick, halfL-dL);
224  GeoShapeIntersection *beamScreenSteel01 = new GeoShapeIntersection(rect3,circ3);
225  GeoShapeSubtraction *beamScreenSteel02 = new GeoShapeSubtraction(beamScreenSteel01, innerVac);
226  GeoShapeSubtraction *beamScreenSteel = new GeoShapeSubtraction(beamScreenSteel02, beamScreenCu);
227 
228  const GeoLogVol *ringLog = new GeoLogVol(name+"BeamPipe", ringTube, m_MapMaterials[std::string("Steel")]);
229  const GeoLogVol *ringLogCu = new GeoLogVol(name+"BeamScreenCu", beamScreenCu, m_MapMaterials[std::string("Copper")]);
230  const GeoLogVol *ringLogSteel = new GeoLogVol(name+"BeamScreenSteel", beamScreenSteel, m_MapMaterials[std::string("Steel")]);
231 
232  GeoPhysVol *ringPhys = new GeoPhysVol(ringLog);
233  GeoPhysVol *ringPhysCu = new GeoPhysVol(ringLogCu);
234  GeoPhysVol *ringPhysSteel = new GeoPhysVol(ringLogSteel);
235 
236  //create rotation and traslation and add them to the tree of volumes of the world (move and rotate the volume)
237  GeoTransform *move = new GeoTransform(GeoTrf::Translate3D(x,y,z));
238  fwrPhys->add(move);
239  GeoTransform *rotate = new GeoTransform(GeoTrf::RotateY3D(rotationAngle));
240  fwrPhys->add(rotate);
241 
242  GeoNameTag *tag = new GeoNameTag(name+"BeamPipe");
243  fwrPhys->add(tag);
244 
245  fwrPhys->add(ringPhys);
246 
247  // add beam scren
248  fwrPhys->add(move);
249  fwrPhys->add(rotate);
250  tag = new GeoNameTag(name+"BeamScreenCu");
251  fwrPhys->add(tag);
252  fwrPhys->add(ringPhysCu);
253  fwrPhys->add(move);
254  fwrPhys->add(rotate);
255  tag = new GeoNameTag(name+"BeamScreenSteel");
256  fwrPhys->add(tag);
257  fwrPhys->add(ringPhysSteel);
258 
259 // // The other side of the forward region may be obtain by rotation
260 // GeoTransform *rotateX180 = new GeoTransform(GeoTrf::RotateX3D(180*Gaudi::Units::deg));
261 
262 // // the other side
263 // fwrPhys->add(rotateX180);
264 // fwrPhys->add(move);
265 // fwrPhys->add(rotate);
266 // tag = new GeoNameTag(name+"BeamPipe_L");
267 // fwrPhys->add(tag);
268 // fwrPhys->add(ringPhys);
269 
270 // fwrPhys->add(rotateX180);
271 // fwrPhys->add(move);
272 // fwrPhys->add(rotate);
273 // tag = new GeoNameTag(name+"BeamScreenCu_L");
274 // fwrPhys->add(tag);
275 // fwrPhys->add(ringPhysCu);
276 
277 // fwrPhys->add(rotateX180);
278 // fwrPhys->add(move);
279 // fwrPhys->add(rotate);
280 // tag = new GeoNameTag(name+"BeamScreenSteel_L");
281 // fwrPhys->add(tag);
282 // fwrPhys->add(ringPhysSteel);
283 }
284 
285 void ForwardRegionGeoModelFactory::insertTrousersElement(const std::string& name, double x, double y, double z, double rotationAngle, GeoPhysVol* fwrPhys)
286 {
287  // "Trousers" -- transition from 1 to 2 beampipes
288  // rewritten from Knut Dundas Moraa's AGDD file and modified
289 
290  // CONSTANTS
291  double TAN_A, TAN_B, TAN_C, TAN_Dsmall, TAN_Dbig, TAN_thick1, TAN_xseparation;
292  TAN_A = 700*Gaudi::Units::mm;
293  TAN_B = 500*Gaudi::Units::mm;
294  TAN_C = 3700*Gaudi::Units::mm;
295  TAN_Dsmall = 52*Gaudi::Units::mm;
296  TAN_Dbig = 212*Gaudi::Units::mm;
297  TAN_thick1 = 4.5*Gaudi::Units::mm;
298  TAN_xseparation = 80*Gaudi::Units::mm;
299 
300  // Derived constants
301  double TAN_Rsmall, TAN_Rbig, TAN_coneZh, TAN_coneR, TAN_coneXh;//, TAN_halflength;
302  TAN_Rsmall = 0.5*TAN_Dsmall;
303  TAN_Rbig = 0.5*TAN_Dbig;
304  TAN_coneZh = TAN_B*cos(5*M_PI/180);
305  TAN_coneR = 2*TAN_B*sin(5*M_PI/180)+TAN_Rsmall;
306  TAN_coneXh = TAN_Rbig-TAN_B*sin(5*M_PI/180)-TAN_Rsmall;
307  //TAN_halflength = 0.5*(TAN_A+TAN_B+TAN_C);
308 
309  // volume construction
310 
311  // inner part
312  GeoPcon *TANi_cone0 = new GeoPcon(0,360*Gaudi::Units::deg);
313  TANi_cone0->addPlane(2*TAN_coneZh, TAN_Rsmall, 2*TAN_Rbig);
314  TANi_cone0->addPlane(TAN_coneZh, TAN_Rsmall, 2*TAN_Rbig);
315  TANi_cone0->addPlane(-TAN_coneZh, TAN_coneR, 2*TAN_Rbig);
316  GeoTrf::Transform3D TAN_moveCone = GeoTrf::Translate3D(TAN_coneXh,0,0.5*(TAN_A-TAN_B));
317  GeoTrf::Transform3D TAN_rotateCone = GeoTrf::RotateY3D(5*Gaudi::Units::deg);
318  const GeoShapeShift& TANi_cone = (*TANi_cone0)<<TAN_rotateCone<<TAN_moveCone;
319 
320  const GeoBox *TAN_box0 = new GeoBox(2*TAN_Rbig,2*TAN_Rbig,TAN_A+TAN_B);
321  GeoTrf::Transform3D TAN_moveBox = GeoTrf::Translate3D(-2*TAN_Rbig,0,0);
322  const GeoShapeShift& TAN_box = (*TAN_box0)<<TAN_moveBox;
323 
324  const GeoTube *TANi_bigtube = new GeoTube(0, TAN_Rbig, 0.5*(TAN_A+TAN_B));
325 
326  GeoShapeSubtraction *TANi_hcyl = new GeoShapeSubtraction(TANi_bigtube, &TAN_box);
327 
328  GeoShapeSubtraction *TANi_h = new GeoShapeSubtraction(TANi_hcyl, &TANi_cone);
329  GeoTrf::Transform3D TAN_moveH = GeoTrf::Translate3D(0,0,-0.5*TAN_C);
330  GeoTrf::Transform3D TAN_rotateH = GeoTrf::RotateZ3D(180*Gaudi::Units::deg);
331 
332  GeoTrf::Transform3D TAN_moveTube1 = GeoTrf::Translate3D(TAN_xseparation,0,0.5*(TAN_A+TAN_B));
333  GeoTrf::Transform3D TAN_moveTube2 = GeoTrf::Translate3D(-TAN_xseparation,0,0.5*(TAN_A+TAN_B));
334 
335  // outer part
336  GeoPcon *TANo_cone0 = new GeoPcon(0,360*Gaudi::Units::deg);
337  TANo_cone0->addPlane(2*TAN_coneZh, TAN_Rsmall+TAN_thick1, 2*TAN_Rbig);
338  TANo_cone0->addPlane(TAN_coneZh, TAN_Rsmall+TAN_thick1, 2*TAN_Rbig);
339  TANo_cone0->addPlane(-TAN_coneZh, TAN_coneR+TAN_thick1, 2*TAN_Rbig);
340  const GeoShapeShift& TANo_cone = (*TANo_cone0)<<TAN_rotateCone<<TAN_moveCone;
341 
342  const GeoTube *TANo_bigtube = new GeoTube(0, TAN_Rbig+TAN_thick1, 0.5*(TAN_A+TAN_B));
343 
344  GeoShapeSubtraction *TANo_hcyl = new GeoShapeSubtraction(TANo_bigtube, &TAN_box);
345 
346  GeoShapeSubtraction *TANo_h = new GeoShapeSubtraction(TANo_hcyl, &TANo_cone);
347 
348  const GeoTube *TAN_antiblock0 = new GeoTube(0, TAN_Rsmall, 0.5*(TAN_A+2*TAN_B)); // antiblock tube -- just in case..
349  GeoTrf::Transform3D TAN_moveAntiblock = GeoTrf::Translate3D(TAN_xseparation,0,0);
350  const GeoShapeShift& TAN_antiblock = (*TAN_antiblock0)<<TAN_moveAntiblock;
351 
352  GeoShapeSubtraction *TAN_shape0 = new GeoShapeSubtraction(TANo_h, TANi_h);
353  GeoShapeSubtraction *TAN_shape = new GeoShapeSubtraction(TAN_shape0, &TAN_antiblock);
354  const GeoShapeShift& TAN_shape1 = (*TAN_shape)<<TAN_moveH;
355  const GeoShapeShift& TAN_shape2 = (*TAN_shape)<<TAN_moveH<<TAN_rotateH;
356 
357  const GeoTube *TANo_ftube = new GeoTube(TAN_Rsmall,TAN_Rsmall+TAN_thick1,0.5*TAN_C-0.1*Gaudi::Units::mm);
358  const GeoShapeShift& TANo_ftube1 = (*TANo_ftube)<<TAN_moveTube1;
359  const GeoShapeShift& TANo_ftube2 = (*TANo_ftube)<<TAN_moveTube2;
360 
361  GeoShapeUnion *TANo0 = new GeoShapeUnion(&TAN_shape1, &TAN_shape2);
362  GeoShapeUnion *TANo1 = new GeoShapeUnion(TANo0, &TANo_ftube1);
363  GeoShapeUnion *TANo = new GeoShapeUnion(TANo1, &TANo_ftube2); // complete outer part
364 
365  // PLACEMENT
366  const GeoLogVol *ringLog = new GeoLogVol(name+"Log", TANo, m_MapMaterials[std::string("Steel")]);
367 
368  GeoPhysVol *ringPhys = new GeoPhysVol(ringLog);
369 
370  //create rotation and traslation and add them to the tree of volumes of the world (move and rotate the volume)
371  GeoTransform *move = new GeoTransform(GeoTrf::Translate3D(x,y,z));
372  fwrPhys->add(move);
373  GeoTransform *rotate = new GeoTransform(GeoTrf::RotateY3D(rotationAngle));
374  fwrPhys->add(rotate);
375 
376  GeoNameTag *tag = new GeoNameTag(name);
377  fwrPhys->add(tag);
378 
379  fwrPhys->add(ringPhys);
380 
381 // // The other side of the forward region may be obtained by rotation
382 // GeoTransform *rotateX180 = new GeoTransform(GeoTrf::RotateX3D(180*Gaudi::Units::deg));
383 
384 // // the other side
385 // fwrPhys->add(rotateX180);
386 // fwrPhys->add(move);
387 // fwrPhys->add(rotate);
388 // tag = new GeoNameTag(name+"_L");
389 // fwrPhys->add(tag);
390 // fwrPhys->add(ringPhys);
391 }
392 
393 void ForwardRegionGeoModelFactory::insertTCLElement(const std::string& name, double x, double y, double z, GeoPhysVol* fwrPhys, double TCLJawDistO, double TCLJawDistI, bool tungstenInsteadOfCopper)
394 {
395  // Constants
396  double TCL_BOX_halflength, TCL_BOX_halfwidth, TCL_BOX_halfheight, TCL_BOX_sideThickness, TCL_BOX_topBottomThickness, TCL_BOX_endThickness, TCL_TUBE_halflength, TCL_TUBE_halfapperture, TCL_TUBE_thickness;
397  TCL_BOX_sideThickness = 6*Gaudi::Units::mm;
398  TCL_BOX_topBottomThickness = 18*Gaudi::Units::mm;
399  TCL_BOX_endThickness = 18*Gaudi::Units::mm;
400 
401  TCL_BOX_halflength = 621*Gaudi::Units::mm;
402  TCL_BOX_halfwidth = 132*Gaudi::Units::mm;
403  TCL_BOX_halfheight = 60+TCL_BOX_topBottomThickness;
404 
405  TCL_TUBE_halflength = 59.5*Gaudi::Units::mm;
406  TCL_TUBE_halfapperture = 53*Gaudi::Units::mm;
407  TCL_TUBE_thickness = 2*Gaudi::Units::mm;
408 
409  double TCL_CuBlock_halflength, TCL_CuBlock_halfwidth, TCL_CuBlock_halfheight, TCL_CuBlockCylCut_zDepth, TCL_CuBlockCylCut_angle, TCL_CuBlockCylCut_cylR, TCL_CuBlockCylCut_cylHalflength, TCL_CuBlockCylCut_xDepth, TCL_CuBlockCylCut_xShift;
410  TCL_CuBlock_halflength = 597*Gaudi::Units::mm;
411  TCL_CuBlock_halfwidth = 14.5*Gaudi::Units::mm;
412  TCL_CuBlock_halfheight = 40*Gaudi::Units::mm;
413 
414  TCL_CuBlockCylCut_zDepth = 90*Gaudi::Units::mm;
415  TCL_CuBlockCylCut_angle = 12*Gaudi::Units::deg;
416  TCL_CuBlockCylCut_cylR = 40*Gaudi::Units::mm;
417 
418  TCL_CuBlockCylCut_cylHalflength = TCL_CuBlockCylCut_zDepth/cos(TCL_CuBlockCylCut_angle);
419  TCL_CuBlockCylCut_xDepth = TCL_CuBlockCylCut_zDepth*tan(TCL_CuBlockCylCut_angle);
420  TCL_CuBlockCylCut_xShift = -TCL_CuBlock_halfwidth-TCL_CuBlockCylCut_cylR/cos(TCL_CuBlockCylCut_angle)+TCL_CuBlockCylCut_xDepth;
421 
422  double TCL_CuBeam_halflength, TCL_CuBeam_halfwidth, TCL_CuBeam_halfheight, TCL_Cooling_width;
423  TCL_CuBeam_halflength = 530*Gaudi::Units::mm;
424  TCL_CuBeam_halfwidth = 15*Gaudi::Units::mm;
425  TCL_CuBeam_halfheight = 40*Gaudi::Units::mm;
426 
427  TCL_Cooling_width = 9*Gaudi::Units::mm;
428 
429 
430 
431  // rotate by 180 deg around X and Y
432  GeoTrf::Transform3D rotateX180 = GeoTrf::RotateX3D(180*Gaudi::Units::deg);
433  GeoTrf::Transform3D rotateY180 = GeoTrf::RotateY3D(180*Gaudi::Units::deg);
434 
435  // inner vacuum volume solid
436  const GeoBox * boxIn = new GeoBox(TCL_BOX_halfwidth-TCL_BOX_sideThickness, TCL_BOX_halfheight-TCL_BOX_topBottomThickness, TCL_BOX_halflength-TCL_BOX_endThickness);
437  const GeoTube * tubeIn = new GeoTube(0, TCL_TUBE_halfapperture, TCL_TUBE_halflength+0.5*TCL_BOX_endThickness);
438  GeoTrf::Transform3D moveTubeIn = GeoTrf::Translate3D(0, 0, TCL_BOX_halflength+TCL_TUBE_halflength-0.5*TCL_BOX_endThickness);
439  const GeoShapeShift& tubeIn1 = (*tubeIn)<<moveTubeIn;
440  const GeoShapeShift& tubeIn2 = (*tubeIn)<<moveTubeIn<<rotateY180;
441  const GeoShapeUnion * innerVac0 = new GeoShapeUnion(boxIn,&tubeIn1);
442  GeoShapeUnion * innerVac = new GeoShapeUnion(innerVac0,&tubeIn2);
443 
444  // outer steel case solid
445  const GeoBox * boxFull = new GeoBox(TCL_BOX_halfwidth, TCL_BOX_halfheight, TCL_BOX_halflength);
446  const GeoTube * tubeOut = new GeoTube(TCL_TUBE_halfapperture, TCL_TUBE_halfapperture+TCL_TUBE_thickness, TCL_TUBE_halflength);
447  GeoTrf::Transform3D moveTubeOut = GeoTrf::Translate3D(0, 0, TCL_BOX_halflength+TCL_TUBE_halflength);
448  const GeoShapeShift& tubeOut1 = (*tubeOut)<<moveTubeOut;
449  const GeoShapeShift& tubeOut2 = (*tubeOut)<<moveTubeOut<<rotateY180;
450  const GeoShapeUnion * outerSteelFull0 = new GeoShapeUnion(boxFull,&tubeOut1);
451  const GeoShapeUnion * outerSteelFull = new GeoShapeUnion(outerSteelFull0,&tubeOut2);
452  GeoShapeSubtraction * outerSteel = new GeoShapeSubtraction(outerSteelFull,innerVac);
453 
454  // Copper block solid
455  const GeoBox * cuBoxFull = new GeoBox(TCL_CuBlock_halfwidth, TCL_CuBlock_halfheight, TCL_CuBlock_halflength);
456  const GeoTube * cylCut0 = new GeoTube(0, TCL_CuBlockCylCut_cylR, TCL_CuBlockCylCut_cylHalflength);
457  GeoTrf::Transform3D rotateCylCut = GeoTrf::RotateY3D(TCL_CuBlockCylCut_angle);
458  GeoTrf::Transform3D moveCylCut = GeoTrf::Translate3D(TCL_CuBlockCylCut_xShift, 0, TCL_CuBlock_halflength);
459  const GeoShapeShift& cylCut1 = (*cylCut0)<<rotateCylCut<<moveCylCut;
460  const GeoShapeShift& cylCut2 = (*cylCut0)<<rotateCylCut<<moveCylCut<<rotateX180;
461  const GeoShapeSubtraction * cuBox0 = new GeoShapeSubtraction(cuBoxFull, &cylCut1);
462  const GeoShapeSubtraction * cuBox1 = new GeoShapeSubtraction(cuBox0, &cylCut2);
463  GeoTrf::Transform3D moveCuBoxI = GeoTrf::Translate3D(TCLJawDistI+TCL_CuBlock_halfwidth, 0, 0);
464  const GeoShapeShift& cuBoxI = (*cuBox1)<<moveCuBoxI;
465  GeoTrf::Transform3D moveCuBoxO = GeoTrf::Translate3D(+TCLJawDistO+TCL_CuBlock_halfwidth, 0, 0);
466  const GeoShapeShift& cuBoxO = (*cuBox1)<<moveCuBoxO<<rotateY180;
467 
468  // Copper beam solid
469  const GeoBox * cuBeamFull = new GeoBox(TCL_CuBeam_halfwidth, TCL_CuBeam_halfheight, TCL_CuBeam_halflength);
470  GeoTrf::Transform3D moveCuBeamI = GeoTrf::Translate3D(TCLJawDistI+2*TCL_CuBlock_halfwidth+TCL_Cooling_width+TCL_CuBeam_halfwidth, 0, 0);
471  const GeoShapeShift& cuBeamI = (*cuBeamFull)<<moveCuBeamI;
472  GeoTrf::Transform3D moveCuBeamO = GeoTrf::Translate3D(+TCLJawDistO+2*TCL_CuBlock_halfwidth+TCL_Cooling_width+TCL_CuBeam_halfwidth, 0, 0);
473  const GeoShapeShift& cuBeamO = (*cuBeamFull)<<moveCuBeamO<<rotateY180;
474 
475  // Watter cooling in first aproximation (water box)
476  const GeoBox * waterBox = new GeoBox(0.5*TCL_Cooling_width, TCL_CuBlock_halfheight, TCL_CuBlock_halflength);
477  GeoTrf::Transform3D moveWaterBoxI = GeoTrf::Translate3D(TCLJawDistI+2*TCL_CuBlock_halfwidth+0.5*TCL_Cooling_width, 0, 0);
478  const GeoShapeShift& waterBoxI = (*waterBox)<<moveWaterBoxI;
479  GeoTrf::Transform3D moveWaterBoxO = GeoTrf::Translate3D(+TCLJawDistO+2*TCL_CuBlock_halfwidth+0.5*TCL_Cooling_width, 0, 0);
480  const GeoShapeShift& waterBoxO = (*waterBox)<<moveWaterBoxO<<rotateY180;
481 
482 
483  // Logical and physical volumes
484  const GeoLogVol *ringLog = new GeoLogVol(name+"Log", outerSteel, m_MapMaterials[std::string("Steel")]);
485  const GeoLogVol *ringLog2 = new GeoLogVol(name+"Fill", innerVac, m_MapMaterials[std::string("std::Vacuum")]);
486 
487  GeoPhysVol *ringPhys = new GeoPhysVol(ringLog);
488  GeoPhysVol *ringPhys2 = new GeoPhysVol(ringLog2);
489 
490  const GeoLogVol *cuBoxLogI = new GeoLogVol(name+"CuBoxI", &cuBoxI, m_MapMaterials[std::string(tungstenInsteadOfCopper ? "Tungsten" : "Copper")]);
491  GeoPhysVol *cuBoxPhysI = new GeoPhysVol(cuBoxLogI);
492  const GeoLogVol *cuBoxLogO = new GeoLogVol(name+"CuBoxO", &cuBoxO, m_MapMaterials[std::string(tungstenInsteadOfCopper ? "Tungsten" : "Copper")]);
493  GeoPhysVol *cuBoxPhysO = new GeoPhysVol(cuBoxLogO);
494 
495  const GeoLogVol *cuBeamLogI = new GeoLogVol(name+"CuBeamI", &cuBeamI, m_MapMaterials[std::string("GlidCopAL15")]);
496  GeoPhysVol *cuBeamPhysI = new GeoPhysVol(cuBeamLogI);
497  const GeoLogVol *cuBeamLogO = new GeoLogVol(name+"CuBeamO", &cuBeamO, m_MapMaterials[std::string("GlidCopAL15")]);
498  GeoPhysVol *cuBeamPhysO = new GeoPhysVol(cuBeamLogO);
499 
500  const GeoLogVol *waterBoxLogI = new GeoLogVol(name+"waterBoxI", &waterBoxI, m_MapMaterials[std::string("water")]);
501  GeoPhysVol *waterBoxPhysI = new GeoPhysVol(waterBoxLogI);
502  const GeoLogVol *waterBoxLogO = new GeoLogVol(name+"waterBoxO", &waterBoxO, m_MapMaterials[std::string("water")]);
503  GeoPhysVol *waterBoxPhysO = new GeoPhysVol(waterBoxLogO);
504 
505  //create rotation and traslation and add them to the tree of volumes of the world (move and rotate the volume)
506  GeoTransform *move = new GeoTransform(GeoTrf::Translate3D(x,y,z));
507  fwrPhys->add(move);
508 
509  GeoNameTag *tag = new GeoNameTag(name);
510  fwrPhys->add(tag);
511 
512  fwrPhys->add(ringPhys);
513 
514  // add filling (inside of the tube)
515  fwrPhys->add(move);
516  tag = new GeoNameTag(name+"Fill");
517  fwrPhys->add(tag);
518  fwrPhys->add(ringPhys2);
519 
520  // add copper absorbers
521  ringPhys2->add(cuBoxPhysI);
522  ringPhys2->add(cuBoxPhysO);
523 
524  ringPhys2->add(cuBeamPhysI);
525  ringPhys2->add(cuBeamPhysO);
526 
527  ringPhys2->add(waterBoxPhysI);
528  ringPhys2->add(waterBoxPhysO);
529 }
rotate
void rotate(double angler, GeoTrf::Vector2D &vector)
Definition: TRTDetectorFactory_Full.cxx:63
ForwardRegionGeoModelFactory::insertYRecticircularElement
void insertYRecticircularElement(const std::string &name, double x, double y, double z, double rotationAngle, double xAperture, double yAperture, double halfL, double dL, double tubeThickness, GeoPhysVol *fwrPhys)
Definition: ForwardRegionGeoModelElements.cxx:206
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
M_PI
#define M_PI
Definition: ActiveFraction.h:11
deg
#define deg
Definition: SbPolyhedron.cxx:17
ForwardRegionGeoModelFactory::m_MapMaterials
std::map< std::string, const GeoMaterial * > m_MapMaterials
Definition: ForwardRegionGeoModelFactory.h:70
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
ForwardRegionGeoModelFactory::insertTCLElement
void insertTCLElement(const std::string &name, double x, double y, double z, GeoPhysVol *fwrPhys, double TCLJawDistO, double TCLJawDistI, bool tungstenInsteadOfCopper=false)
Definition: ForwardRegionGeoModelElements.cxx:393
x
#define x
ForwardRegionGeoModelFactory::insertTrousersElement
void insertTrousersElement(const std::string &name, double x, double y, double z, double rotationAngle, GeoPhysVol *fwrPhys)
Definition: ForwardRegionGeoModelElements.cxx:285
_FWD_CONFIGURATION::vp1Compatibility
bool vp1Compatibility
Definition: ForwardRegionGeoModelFactory.h:35
ForwardRegionGeoModelFactory::insertCircularElement
void insertCircularElement(const std::string &name, double x, double y, double z, double rotationAngle, double xAperture, double yAperture, double halfL, double dL, double tubeThickness, GeoPhysVol *fwrPhys)
Definition: ForwardRegionGeoModelElements.cxx:49
ForwardRegionGeoModelFactory::insertMagnetEnvelope
GeoPhysVol * insertMagnetEnvelope(const std::string &name, double x, double y, double z, double rotationAngle, double diameter, double halfL, double dL, GeoPhysVol *fwrPhys)
Definition: ForwardRegionGeoModelElements.cxx:26
z
#define z
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
TRT_PAI_physicsConstants::r0
const double r0
electron radius{cm}
Definition: TRT_PAI_physicsConstants.h:20
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
ForwardRegionGeoModelFactory::insertXRecticircularElement
void insertXRecticircularElement(const std::string &name, double x, double y, double z, double rotationAngle, double xAperture, double yAperture, double halfL, double dL, double tubeThickness, GeoPhysVol *fwrPhys)
Definition: ForwardRegionGeoModelElements.cxx:125
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ForwardRegionGeoModelFactory::m_Config
FWD_CONFIGURATION m_Config
Definition: ForwardRegionGeoModelFactory.h:73
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
y
#define y
ForwardRegionGeoModelFactory.h
ForwardRegionGeoModelFactory::insertEllipticalElement
void insertEllipticalElement(const std::string &name, double x, double y, double z, double rotationAngle, double xAperture, double yAperture, double halfL, double dL, double tubeThickness, GeoPhysVol *fwrPhys)
Definition: ForwardRegionGeoModelElements.cxx:82
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
calibdata.tube
tube
Definition: calibdata.py:31