ATLAS Offline Software
CavernInfraDetectorFactory.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 
9 #include "GeoModelKernel/GeoMaterial.h"
10 #include "GeoModelKernel/GeoTube.h"
11 #include "GeoModelKernel/GeoBox.h"
12 #include "GeoModelKernel/GeoTubs.h"
13 #include "GeoModelKernel/GeoLogVol.h"
14 #include "GeoModelKernel/GeoNameTag.h"
15 #include "GeoModelKernel/GeoPhysVol.h"
16 #include "GeoModelKernel/GeoShape.h"
17 #include "GeoModelKernel/GeoShapeShift.h"
18 #include "GeoModelKernel/GeoShapeUnion.h"
19 #include "GeoModelKernel/GeoShapeSubtraction.h"
20 #include "GeoModelKernel/GeoTransform.h"
21 #include "GaudiKernel/SystemOfUnits.h"
22 #include "StoreGate/StoreGateSvc.h"
23 
27 #include <map>
28 #include <string>
29 #include <utility>
30 
33  : m_detectorStore(std::move(detStore))
34  , m_access(std::move(pAccess))
35 {
36 }
37 
38 void CavernInfraDetectorFactory::create(GeoPhysVol *world)
39 {
41 
42  StoredMaterialManager* materialManager = nullptr;
43  if (StatusCode::SUCCESS != m_detectorStore->retrieve(materialManager, std::string("MATERIALS"))) {
44  return;
45  }
46 
47  // Get the materials
48  const GeoMaterial *air = materialManager->getMaterial("std::Air");
49  const GeoMaterial *rock = materialManager->getMaterial("std::Rock");
50  const GeoMaterial *conc = materialManager->getMaterial("std::Concrete");
51  const GeoMaterial *shieldSteel = materialManager->getMaterial("shield::ShieldSteel");
52 
53  // Get Recordset CavernElements.
54  IRDBRecordset_ptr cavernElements = m_access->getRecordsetPtr("CavernElements",m_versionTag,m_versionNode);
55 
56  std::map<std::string, unsigned int> elementMap;
57 
58  for (unsigned int i=0; i<cavernElements->size(); i++) {
59  std::string key = (*cavernElements)[i]->getString("ELEMENT");
60  elementMap[key] = i;
61  }
62 
63  unsigned int recordIndex;
65 
66  // Create variables for Point1
67  // -- first get index of the record in cavernElements recordset
68  // which corresponds to Point1 element
69  // -- get numbers from record
70 
71  recordIndex = elementMap["Point1"];
72 
73  GeoNameTag *tag = new GeoNameTag("CavernInfra");
74 
76 
77  recordIndex = elementMap["SX1"];
78  double SX1Xpos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::m;
79  double SX1Ypos = (*cavernElements)[recordIndex]->getDouble("YPOS")*Gaudi::Units::m;
80  double SX1Zpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
81  double SX1HalfLength = (*cavernElements)[recordIndex]->getDouble("HALFLENGTH")*Gaudi::Units::m;
82  double SX1HalfWidth = (*cavernElements)[recordIndex]->getDouble("HALFWIDTH")*Gaudi::Units::m;
83  double SX1HalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
84 
85  recordIndex = elementMap["SX1Air"];
86  double SX1AirYpos = (*cavernElements)[recordIndex]->getDouble("YPOS")*Gaudi::Units::m;
87  double SX1AirHalfLength = (*cavernElements)[recordIndex]->getDouble("HALFLENGTH")*Gaudi::Units::m;
88  double SX1AirHalfWidth = (*cavernElements)[recordIndex]->getDouble("HALFWIDTH")*Gaudi::Units::m;
89  double SX1AirHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
90 
91  GeoTransform *s1XYZt = new GeoTransform(GeoTrf::Translate3D(SX1Xpos,SX1Ypos,SX1Zpos)); //1.7 -8.7
92  world->add(s1XYZt);
93  GeoBox *SX1 = new GeoBox(SX1HalfWidth ,SX1HalfHeight, SX1HalfLength); // 11.7, 6.5, 42.3
94  GeoLogVol *lvsx1s = new GeoLogVol("SX1Steel",SX1,shieldSteel);
95  GeoPhysVol *sx1 = new GeoPhysVol(lvsx1s);
96  world->add(tag);
97  world->add(sx1);
98 
99 
100  GeoTransform *s1z = new GeoTransform(GeoTrf::TranslateY3D(SX1AirYpos));
101  sx1->add(s1z);
102  GeoBox *SX1Air = new GeoBox( SX1AirHalfWidth, SX1AirHalfHeight, SX1AirHalfLength);
103  GeoLogVol *lvsx1a = new GeoLogVol("SX1Air",SX1Air,air);
104  GeoPhysVol *sx1a = new GeoPhysVol(lvsx1a);
105  sx1->add(sx1a);
106 
107 
109 
110  recordIndex = elementMap["WallACConc"];
111  double WallACConcHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
112  double WallACConcMinR = (*cavernElements)[recordIndex]->getDouble("MINR")*Gaudi::Units::m;
113  double WallACConcMaxR = (*cavernElements)[recordIndex]->getDouble("MAXR")*Gaudi::Units::m;
114  double WallACConcSphi= (*cavernElements)[recordIndex]->getDouble("SPHI");
115  double WallACConcDphi= (*cavernElements)[recordIndex]->getDouble("DPHI");
116 
117  recordIndex = elementMap["BoxConc"];
118  double BoxConcHalfLength = (*cavernElements)[recordIndex]->getDouble("HALFLENGTH")*Gaudi::Units::m;
119  double BoxConcHalfWidth = (*cavernElements)[recordIndex]->getDouble("HALFWIDTH")*Gaudi::Units::m;
120  double BoxConcHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
121 
122  recordIndex = elementMap["VaultConc"];
123  double VaultConcZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
124  double VaultConcYrotate = (*cavernElements)[recordIndex]->getDouble("YROTATE");
125  double VaultConcHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
126  double VaultConcMinR = (*cavernElements)[recordIndex]->getDouble("MINR")*Gaudi::Units::m;
127  double VaultConcMaxR = (*cavernElements)[recordIndex]->getDouble("MAXR")*Gaudi::Units::m;
128  double VaultConcSphi= (*cavernElements)[recordIndex]->getDouble("SPHI");
129  double VaultConcDphi= (*cavernElements)[recordIndex]->getDouble("DPHI");
130 
131  recordIndex = elementMap["HallConc"];
132  double HallConcHalfLength = (*cavernElements)[recordIndex]->getDouble("HALFLENGTH")*Gaudi::Units::m;
133  double HallConcHalfWidth = (*cavernElements)[recordIndex]->getDouble("HALFWIDTH")*Gaudi::Units::m;
134  double HallConcHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
135 
136  recordIndex = elementMap["BoxConcW"];
137  double BoxConcWZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
138  double BoxConcWYrotate = (*cavernElements)[recordIndex]->getDouble("YROTATE");
139 
140  recordIndex = elementMap["BoxConcVleft"];
141  double BoxConcVleftZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
142  double BoxConcVleftYrotate = (*cavernElements)[recordIndex]->getDouble("YROTATE");
143 
144  recordIndex = elementMap["BoxConcVright"];
145  double BoxConcVrightZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
146  double BoxConcVrightYrotate = (*cavernElements)[recordIndex]->getDouble("YROTATE");
147 
148  recordIndex = elementMap["SurfaceFloor"];
149  double SurfaceFloorXpos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::m;
150  double SurfaceFloorZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
151  double SurfaceFloorHalfLength = (*cavernElements)[recordIndex]->getDouble("HALFLENGTH")*Gaudi::Units::m;
152  double SurfaceFloorHalfWidth = (*cavernElements)[recordIndex]->getDouble("HALFWIDTH")*Gaudi::Units::m;
153  double SurfaceFloorHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
154 
155 
156  GeoTubs *WallACConcrete = new GeoTubs(WallACConcMinR, WallACConcMaxR, WallACConcHalfHeight, WallACConcSphi, WallACConcDphi);
157  GeoBox *BoxConc = new GeoBox(BoxConcHalfLength, BoxConcHalfWidth, BoxConcHalfHeight);
158  GeoTubs *VaultConcrete = new GeoTubs(VaultConcMinR, VaultConcMaxR, VaultConcHalfHeight , VaultConcSphi, VaultConcDphi);
159  GeoBox *HallConcrete = new GeoBox(HallConcHalfLength, HallConcHalfWidth, HallConcHalfHeight);
160  GeoBox *SurfaceFloor = new GeoBox(SurfaceFloorHalfLength, SurfaceFloorHalfWidth, SurfaceFloorHalfHeight);
161 
162  GeoTrf::Transform3D BoxCutWallConc = GeoTrf::TranslateZ3D(BoxConcWZpos)*GeoTrf::RotateY3D(BoxConcWYrotate);
163  GeoTrf::Transform3D BoxCutVaultLeftConc = GeoTrf::TranslateZ3D(BoxConcVleftZpos)*GeoTrf::RotateY3D(BoxConcVleftYrotate);
164  GeoTrf::Transform3D BoxCutVaulRightConc = GeoTrf::TranslateZ3D(BoxConcVrightZpos)*GeoTrf::RotateY3D(BoxConcVrightYrotate);
165 
166  recordIndex = elementMap["HoleJN"];
167  double HoleJNrmin = (*cavernElements)[recordIndex]->getDouble("MINR")*Gaudi::Units::mm;
168  double HoleJNrmax = (*cavernElements)[recordIndex]->getDouble("MAXR")*Gaudi::Units::mm;
169  double HoleJNdz = (*cavernElements)[recordIndex]->getDouble("HALFLENGTH")*Gaudi::Units::mm;
170  GeoTubs *HoleJN = new GeoTubs(HoleJNrmin,HoleJNrmax,HoleJNdz, 0.,2.*M_PI); // should be 2300mm in radius
171 
172  recordIndex = elementMap["WallAAir"];
173  double WallAAirZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
174  double WallAAirXpos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::m;
175 
176  recordIndex = elementMap["WallCAir"];
177  double WallCAirZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
178  double WallCAirXpos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::m;
179  double WallCAirZrotate = (*cavernElements)[recordIndex]->getDouble("ZROTATE");
180 
181  //---------------- Cut the vault and side walls----------------------------
182  const GeoShape & CutWallConc = (*WallACConcrete).subtract((*BoxConc) << GeoTrf::Transform3D(BoxCutWallConc)).
183  subtract((*HoleJN) << GeoTrf::RotateY3D(M_PI*0.5) << GeoTrf::TranslateZ3D(-0.5*WallAAirZpos)*GeoTrf::TranslateY3D(-WallCAirXpos*1.0) );
184  const GeoShape & CutVaultConc = (*VaultConcrete).subtract((*BoxConc) << GeoTrf::Transform3D(BoxCutVaultLeftConc)).
185  subtract((*BoxConc) << GeoTrf::Transform3D(BoxCutVaulRightConc));
186 
187  recordIndex = elementMap["ShaftCut"];
188  double ShaftCutZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
189  double ShaftCutYrotate = (*cavernElements)[recordIndex]->getDouble("YROTATE");
190  double ShaftCutHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
191  double ShaftCutMinR = (*cavernElements)[recordIndex]->getDouble("MINR")*Gaudi::Units::m;
192  double ShaftCutMaxR = (*cavernElements)[recordIndex]->getDouble("MAXR")*Gaudi::Units::m;
193 
194  recordIndex = elementMap["PX14Conc"];
195  double PX14ConcXpos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::m;
196  double PX14ConcYpos = (*cavernElements)[recordIndex]->getDouble("YPOS")*Gaudi::Units::m;
197  double PX14ConcHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
198  double PX14ConcMinR = (*cavernElements)[recordIndex]->getDouble("MINR")*Gaudi::Units::m;
199  double PX14ConcMaxR = (*cavernElements)[recordIndex]->getDouble("MAXR")*Gaudi::Units::m;
200 
201  recordIndex = elementMap["PX16Conc"];
202  double PX16ConcXpos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::m;
203  double PX16ConcYpos = (*cavernElements)[recordIndex]->getDouble("YPOS")*Gaudi::Units::m;
204  double PX16ConcHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
205  double PX16ConcMinR = (*cavernElements)[recordIndex]->getDouble("MINR")*Gaudi::Units::m;
206  double PX16ConcMaxR = (*cavernElements)[recordIndex]->getDouble("MAXR")*Gaudi::Units::m;
207 
208  //--------------- Build concrete shafts------------------------------.
209  GeoTube *ShaftCut = new GeoTube(ShaftCutMinR, ShaftCutMaxR, ShaftCutHalfHeight);
210  GeoTube *PX14Conc = new GeoTube(PX14ConcMinR, PX14ConcMaxR, PX14ConcHalfHeight);
211  GeoTube *PX16Conc = new GeoTube(PX16ConcMinR, PX16ConcMaxR, PX16ConcHalfHeight);
212 
213  const GeoShape & ShaftsConc=
214  ((*PX14Conc) << GeoTrf::TranslateX3D(PX14ConcXpos)*GeoTrf::TranslateY3D(PX14ConcYpos)).
215  add((*PX16Conc) << GeoTrf::TranslateX3D(PX16ConcXpos)*GeoTrf::TranslateY3D(PX16ConcYpos)).
216  subtract((*ShaftCut) << GeoTrf::TranslateZ3D(ShaftCutZpos)*GeoTrf::RotateY3D(ShaftCutYrotate));
217 
218  recordIndex = elementMap["WallCConc"];
219  double WallCConcZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
220  double WallCConcXpos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::m;
221  double WallCConcZrotate = (*cavernElements)[recordIndex]->getDouble("ZROTATE");
222 
223  recordIndex = elementMap["WallAConc"];
224  double WallAConcZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
225  double WallAConcXpos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::m;
226 
227  recordIndex = elementMap["ShaftsConc"];
228  double ShaftsConcZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
229 
230  //--------------- Build concrete nose ------------------------------.
231  recordIndex =elementMap["BoxConcJN"];
232  double BoxConcJNDX = (*cavernElements)[recordIndex]->getDouble("HALFLENGTH")*Gaudi::Units::mm;
233  double BoxConcJNDY = (*cavernElements)[recordIndex]->getDouble("HALFWIDTH")*Gaudi::Units::mm;
234  double BoxConcJNDZ = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::mm;
235  double BoxConcJNXpos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::mm;
236  recordIndex =elementMap["BoxConcExtraJN"];
237  double BoxConcExtraJNDX = (*cavernElements)[recordIndex]->getDouble("HALFLENGTH")*Gaudi::Units::mm;
238  double BoxConcExtraJNDY = (*cavernElements)[recordIndex]->getDouble("HALFWIDTH")*Gaudi::Units::mm;
239  double BoxConcExtraJNDZ = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::mm;
240  double BoxConcExtraJNXpos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::mm;
241  double BoxConcExtraJNYpos = (*cavernElements)[recordIndex]->getDouble("YPOS");
242  recordIndex =elementMap["StrutConcJN"];
243  double StrutConcJNDX = (*cavernElements)[recordIndex]->getDouble("HALFLENGTH")*Gaudi::Units::mm;
244  double StrutConcJNDY = (*cavernElements)[recordIndex]->getDouble("HALFWIDTH")*Gaudi::Units::mm;
245  double StrutConcJNDZ = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::mm;
246  double StrutConcJNXpos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::mm;
247  double StrutConcJNYpos = (*cavernElements)[recordIndex]->getDouble("YPOS")*Gaudi::Units::mm;
248  double StrutConcJNZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::mm;
249 
250  GeoBox *BoxConcJNC = new GeoBox(BoxConcJNDX,BoxConcJNDY,BoxConcJNDZ);
251  GeoBox *BoxConcJNA = new GeoBox(BoxConcJNDX,BoxConcJNDY,BoxConcJNDZ);
252  GeoBox *BoxConcStupidExtraJNC = new GeoBox(BoxConcExtraJNDX,BoxConcExtraJNDY,BoxConcExtraJNDZ);
253  GeoBox *BoxConcStupidExtraJNA = new GeoBox(BoxConcExtraJNDX,BoxConcExtraJNDY,BoxConcExtraJNDZ);
254  const GeoBox *StrutConcJN = new GeoBox(StrutConcJNDX,StrutConcJNDY,StrutConcJNDZ);
255 
256  recordIndex = elementMap["CavernAir"];
257  double CavernAirZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
258 
259  //----------------Assemble everything--------------------------------.
260  const GeoShape & Concrete= (*HallConcrete).
261  add((CutWallConc << GeoTrf::TranslateZ3D(WallCConcZpos)*GeoTrf::TranslateX3D(WallCConcXpos)*GeoTrf::RotateZ3D(WallCConcZrotate))).
262  add((ShaftsConc << GeoTrf::TranslateZ3D(ShaftsConcZpos))).
263  add((CutVaultConc << GeoTrf::TranslateZ3D(VaultConcZpos)*GeoTrf::RotateY3D(VaultConcYrotate))).
264  add((*SurfaceFloor) << GeoTrf::TranslateZ3D(SurfaceFloorZpos)*GeoTrf::TranslateX3D(SurfaceFloorXpos)).
265  add((CutWallConc << GeoTrf::TranslateZ3D(WallAConcZpos)*GeoTrf::TranslateX3D(WallAConcXpos))).
266 
267  add((*BoxConcJNC) << GeoTrf::TranslateX3D(BoxConcJNXpos) * GeoTrf::TranslateZ3D(-WallAAirZpos*0.5+CavernAirZpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
268  add((*BoxConcStupidExtraJNC) << GeoTrf::TranslateX3D(BoxConcExtraJNXpos) * GeoTrf::TranslateZ3D(-WallAAirZpos*0.5+CavernAirZpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) * GeoTrf::TranslateY3D(-BoxConcExtraJNYpos) ).
269  add((*BoxConcJNA) << GeoTrf::TranslateX3D(-BoxConcJNXpos-15*Gaudi::Units::mm) * GeoTrf::TranslateZ3D(-WallAAirZpos*0.5+CavernAirZpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
270  add((*BoxConcStupidExtraJNA) << GeoTrf::TranslateX3D(-BoxConcExtraJNXpos-15*Gaudi::Units::mm) * GeoTrf::TranslateZ3D(-WallAAirZpos*0.5+CavernAirZpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) * GeoTrf::TranslateY3D(BoxConcExtraJNYpos) ).
271 
272  add((*StrutConcJN) << GeoTrf::TranslateX3D(StrutConcJNXpos) * GeoTrf::TranslateZ3D(-StrutConcJNZpos-WallAAirZpos*0.5+CavernAirZpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
273  add((*StrutConcJN) << GeoTrf::TranslateX3D(StrutConcJNXpos) * GeoTrf::TranslateZ3D(-StrutConcJNZpos-WallAAirZpos*0.5+CavernAirZpos) * GeoTrf::TranslateY3D(StrutConcJNYpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
274  add((*StrutConcJN) << GeoTrf::TranslateX3D(StrutConcJNXpos) * GeoTrf::TranslateZ3D(-StrutConcJNZpos-WallAAirZpos*0.5+CavernAirZpos) * GeoTrf::TranslateY3D(-StrutConcJNYpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
275  add((*StrutConcJN) << GeoTrf::TranslateX3D(-StrutConcJNXpos-15.*Gaudi::Units::mm) * GeoTrf::TranslateZ3D(-StrutConcJNZpos-WallAAirZpos*0.5+CavernAirZpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
276  add((*StrutConcJN) << GeoTrf::TranslateX3D(-StrutConcJNXpos-15.*Gaudi::Units::mm) * GeoTrf::TranslateZ3D(-StrutConcJNZpos-WallAAirZpos*0.5+CavernAirZpos) * GeoTrf::TranslateY3D(StrutConcJNYpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
277  add((*StrutConcJN) << GeoTrf::TranslateX3D(-StrutConcJNXpos-15.*Gaudi::Units::mm) * GeoTrf::TranslateZ3D(-StrutConcJNZpos-WallAAirZpos*0.5+CavernAirZpos) * GeoTrf::TranslateY3D(-StrutConcJNYpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) );
278 
279 // subtract((*HoleJN) << GeoTrf::RotateY3D(M_PI*0.5) << GeoTrf::TranslateZ3D(-0.5*WallAAirZpos+CavernAirZpos)*GeoTrf::TranslateY3D(-WallCAirXpos*1.0) );
280 // subtract((*HoleJN) << GeoTrf::RotateY3D(M_PI*0.5) << GeoTrf::TranslateZ3D(-0.5*WallAAirZpos)*GeoTrf::TranslateY3D(-WallCAirXpos*1.0) );
281 
282 
284 
285  // Create variables for Concrete Cavern and get index of the record in cavernElements
286  recordIndex = elementMap["WallACAir"];
287  double WallACAirHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
288  double WallACAirMinR = (*cavernElements)[recordIndex]->getDouble("MINR")*Gaudi::Units::m;
289  double WallACAirMaxR = (*cavernElements)[recordIndex]->getDouble("MAXR")*Gaudi::Units::m;
290  double WallACAirSphi= (*cavernElements)[recordIndex]->getDouble("SPHI");
291  double WallACAirDphi= (*cavernElements)[recordIndex]->getDouble("DPHI");
292 
293  recordIndex = elementMap["BoxAir"];
294  double BoxAirHalfLength = (*cavernElements)[recordIndex]->getDouble("HALFLENGTH")*Gaudi::Units::m;
295  double BoxAirHalfWidth = (*cavernElements)[recordIndex]->getDouble("HALFWIDTH")*Gaudi::Units::m;
296  double BoxAirHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
297 
298  recordIndex = elementMap["VaultAir"];
299  double VaultAirZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
300  double VaultAirYrotate = (*cavernElements)[recordIndex]->getDouble("YROTATE");
301  double VaultAirHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
302  double VaultAirMinR = (*cavernElements)[recordIndex]->getDouble("MINR")*Gaudi::Units::m;
303  double VaultAirMaxR = (*cavernElements)[recordIndex]->getDouble("MAXR")*Gaudi::Units::m;
304  double VaultAirSphi= (*cavernElements)[recordIndex]->getDouble("SPHI");
305  double VaultAirDphi= (*cavernElements)[recordIndex]->getDouble("DPHI");
306 
307  recordIndex = elementMap["HallAir"];
308  double HallAirHalfLength = (*cavernElements)[recordIndex]->getDouble("HALFLENGTH")*Gaudi::Units::m;
309  double HallAirHalfWidth = (*cavernElements)[recordIndex]->getDouble("HALFWIDTH")*Gaudi::Units::m;
310  double HallAirHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
311 
312  recordIndex = elementMap["BaseAir"];
313  double BaseAirZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
314  double BaseAirHalfLength = (*cavernElements)[recordIndex]->getDouble("HALFLENGTH")*Gaudi::Units::m;
315  double BaseAirHalfWidth = (*cavernElements)[recordIndex]->getDouble("HALFWIDTH")*Gaudi::Units::m;
316  double BaseAirHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
317 
318  recordIndex = elementMap["BoxAirW"];
319  double BoxAirWZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
320  double BoxAirWYrotate = (*cavernElements)[recordIndex]->getDouble("YROTATE");
321 
322  recordIndex = elementMap["BoxAirVleft"];
323  double BoxAirVleftZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
324  double BoxAirVleftYrotate = (*cavernElements)[recordIndex]->getDouble("YROTATE");
325 
326  recordIndex = elementMap["BoxAirVright"];
327  double BoxAirVrightZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
328  double BoxAirVrightYrotate = (*cavernElements)[recordIndex]->getDouble("YROTATE");
329 
330  GeoTubs *WallACAir = new GeoTubs(WallACAirMinR, WallACAirMaxR, WallACAirHalfHeight, WallACAirSphi, WallACAirDphi);
331  GeoBox *BoxAir = new GeoBox(BoxAirHalfLength, BoxAirHalfWidth, BoxAirHalfHeight);
332  GeoTubs *VaultAir = new GeoTubs(VaultAirMinR, VaultAirMaxR, VaultAirHalfHeight, VaultAirSphi, VaultAirDphi);
333  GeoBox *HallAir = new GeoBox(HallAirHalfLength, HallAirHalfWidth, HallAirHalfHeight);
334  GeoBox *BaseAir = new GeoBox(BaseAirHalfLength, BaseAirHalfWidth, BaseAirHalfHeight);
335  GeoTrf::Transform3D BoxCutWallAir = GeoTrf::TranslateZ3D(BoxAirWZpos)*GeoTrf::RotateY3D(BoxAirWYrotate);
336  GeoTrf::Transform3D BoxCutVaultLeftAir = GeoTrf::TranslateZ3D(BoxAirVleftZpos)*GeoTrf::RotateY3D(BoxAirVleftYrotate);
337  GeoTrf::Transform3D BoxCutVaulRightAir = GeoTrf::TranslateZ3D(BoxAirVrightZpos)*GeoTrf::RotateY3D(BoxAirVrightYrotate);
338 
339  //------------------Cut the vault and side walls----------------------------
340  const GeoShape & CutWallAir = (*WallACAir).subtract((*BoxAir) << GeoTrf::Transform3D(BoxCutWallAir));
341  const GeoShape & CutVaultAir = (*VaultAir).subtract((*BoxAir) << GeoTrf::Transform3D(BoxCutVaultLeftAir)).
342  subtract((*BoxAir) << GeoTrf::Transform3D(BoxCutVaulRightAir));
343 
344  //--------------- Build air shafts------------------------------.
345  recordIndex = elementMap["PX14Air"];
346  double PX14AirXpos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::m;
347  double PX14AirYpos = (*cavernElements)[recordIndex]->getDouble("YPOS")*Gaudi::Units::m;
348  double PX14AirHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
349  double PX14AirMinR = (*cavernElements)[recordIndex]->getDouble("MINR")*Gaudi::Units::m;
350  double PX14AirMaxR = (*cavernElements)[recordIndex]->getDouble("MAXR")*Gaudi::Units::m;
351 
352  recordIndex = elementMap["PX16Air"];
353  double PX16AirXpos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::m;
354  double PX16AirYpos = (*cavernElements)[recordIndex]->getDouble("YPOS")*Gaudi::Units::m;
355  double PX16AirHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
356  double PX16AirMinR = (*cavernElements)[recordIndex]->getDouble("MINR")*Gaudi::Units::m;
357  double PX16AirMaxR = (*cavernElements)[recordIndex]->getDouble("MAXR")*Gaudi::Units::m;
358 
359  GeoTube *PX14Air = new GeoTube(PX14AirMinR, PX14AirMaxR, PX14AirHalfHeight);
360  GeoTube *PX16Air = new GeoTube(PX16AirMinR, PX16AirMaxR, PX16AirHalfHeight);
361 
362  recordIndex = elementMap["CavShaftsConc"];
363  double CavShaftsYPos = (*cavernElements)[recordIndex]->getDouble("YPOS")*Gaudi::Units::m;
364  double CavShaftsXrotate = (*cavernElements)[recordIndex]->getDouble("XROTATE");
365  double CavShaftsYrotate = (*cavernElements)[recordIndex]->getDouble("YROTATE");
366 
367  const GeoShape & ShaftsAir=
368  ((*PX14Air) << GeoTrf::TranslateX3D(PX14AirXpos)*GeoTrf::TranslateY3D(PX14AirYpos)).
369  add((*PX16Air) << GeoTrf::TranslateX3D(PX16AirXpos)*GeoTrf::TranslateY3D(PX16AirYpos));
370 
371  //----------------Assemble everything--------------------------------.
372  const GeoShape & CavernAir = (*HallAir).
373 // add((*AirJN) << GeoTrf::RotateY3D(M_PI*0.5) << GeoTrf::TranslateZ3D(-0.5*WallAAirZpos)*GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
374  add(CutWallAir << GeoTrf::TranslateZ3D(WallAAirZpos)*GeoTrf::TranslateX3D(WallAAirXpos)).
375  add(CutWallAir << GeoTrf::TranslateZ3D(WallCAirZpos)*GeoTrf::TranslateX3D(WallCAirXpos)*GeoTrf::RotateZ3D(WallCAirZrotate)).
376  add(CutVaultAir << GeoTrf::TranslateZ3D(VaultAirZpos)*GeoTrf::RotateY3D(VaultAirYrotate)).
377  add((*BaseAir) << GeoTrf::TranslateZ3D(BaseAirZpos)).
378 
379  subtract((*BoxConcJNC) << GeoTrf::TranslateX3D(BoxConcJNXpos) * GeoTrf::TranslateZ3D(-WallAAirZpos*0.5) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
380  subtract((*BoxConcStupidExtraJNC) << GeoTrf::TranslateX3D(BoxConcExtraJNXpos) * GeoTrf::TranslateZ3D(-WallAAirZpos*0.5) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) * GeoTrf::TranslateY3D(-BoxConcExtraJNYpos) ).
381  subtract((*BoxConcJNA) << GeoTrf::TranslateX3D(-BoxConcJNXpos-15*Gaudi::Units::mm) * GeoTrf::TranslateZ3D(-WallAAirZpos*0.5) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
382  subtract((*BoxConcStupidExtraJNA) << GeoTrf::TranslateX3D(-BoxConcExtraJNXpos-15*Gaudi::Units::mm) * GeoTrf::TranslateZ3D(-WallAAirZpos*0.5) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) * GeoTrf::TranslateY3D(BoxConcExtraJNYpos) ).
383 
384  subtract((*StrutConcJN) << GeoTrf::TranslateX3D(StrutConcJNXpos) * GeoTrf::TranslateZ3D(-StrutConcJNZpos-WallAAirZpos*0.5) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
385  subtract((*StrutConcJN) << GeoTrf::TranslateX3D(StrutConcJNXpos) * GeoTrf::TranslateZ3D(-StrutConcJNZpos-WallAAirZpos*0.5) * GeoTrf::TranslateY3D(StrutConcJNYpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
386  subtract((*StrutConcJN) << GeoTrf::TranslateX3D(StrutConcJNXpos) * GeoTrf::TranslateZ3D(-StrutConcJNZpos-WallAAirZpos*0.5) * GeoTrf::TranslateY3D(-StrutConcJNYpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
387  subtract((*StrutConcJN) << GeoTrf::TranslateX3D(-StrutConcJNXpos-15.*Gaudi::Units::mm) * GeoTrf::TranslateZ3D(-StrutConcJNZpos-WallAAirZpos*0.5) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
388  subtract((*StrutConcJN) << GeoTrf::TranslateX3D(-StrutConcJNXpos-15.*Gaudi::Units::mm) * GeoTrf::TranslateZ3D(-StrutConcJNZpos-WallAAirZpos*0.5) * GeoTrf::TranslateY3D(StrutConcJNYpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
389  subtract((*StrutConcJN) << GeoTrf::TranslateX3D(-StrutConcJNXpos-15.*Gaudi::Units::mm) * GeoTrf::TranslateZ3D(-StrutConcJNZpos-WallAAirZpos*0.5) * GeoTrf::TranslateY3D(-StrutConcJNYpos) * GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
390  add((*HoleJN) << GeoTrf::RotateY3D(M_PI*0.5) << GeoTrf::TranslateZ3D(-0.5*WallAAirZpos+CavernAirZpos)*GeoTrf::TranslateY3D(-WallCAirXpos*1.0) << GeoTrf::TranslateY3D(CavShaftsYPos)*GeoTrf::RotateY3D(CavShaftsYrotate)*GeoTrf::RotateX3D(CavShaftsXrotate) );
391 
392 
393  recordIndex = elementMap["ShaftsAir"];
394  double ShaftsAirZpos = (*cavernElements)[recordIndex]->getDouble("ZPOS")*Gaudi::Units::m;
395 
396  const GeoShape & AirHall=
397  ((CavernAir << GeoTrf::TranslateZ3D(CavernAirZpos))).
398  add((ShaftsAir << GeoTrf::TranslateZ3D(ShaftsAirZpos))); //allows for a built-in 2m thick plugs for both PX14 & PX16
399 
401 
402  recordIndex = elementMap["Rock"];
403  double RockHalfLength = (*cavernElements)[recordIndex]->getDouble("HALFLENGTH")*Gaudi::Units::m;
404  double RockHalfWidth = (*cavernElements)[recordIndex]->getDouble("HALFWIDTH")*Gaudi::Units::m;
405  double RockHalfHeight = (*cavernElements)[recordIndex]->getDouble("HALFHEIGHT")*Gaudi::Units::m;
406  double RockXPos = (*cavernElements)[recordIndex]->getDouble("XPOS")*Gaudi::Units::m;
407  double RockYPos = (*cavernElements)[recordIndex]->getDouble("YPOS")*Gaudi::Units::m;
408 
409  GeoBox *Rockbox = new GeoBox( RockHalfWidth, RockHalfHeight, RockHalfLength); // 300, 50.75, 300
410  const GeoShape & BedRock = ((*Rockbox) .
411  subtract((AirHall) <<GeoTrf::TranslateY3D(CavShaftsYPos)*GeoTrf::RotateY3D(CavShaftsYrotate)*GeoTrf::RotateX3D(CavShaftsXrotate))).
412  subtract((*HoleJN) << GeoTrf::RotateY3D(M_PI*0.5) << GeoTrf::TranslateZ3D(-0.5*WallAAirZpos+CavernAirZpos)*GeoTrf::TranslateY3D(-WallCAirXpos*1.0) << GeoTrf::TranslateY3D(CavShaftsYPos)*GeoTrf::RotateY3D(CavShaftsYrotate)*GeoTrf::RotateX3D(CavShaftsXrotate) );
413 
414  GeoTransform *rZt = new GeoTransform(GeoTrf::TranslateY3D(RockYPos)*GeoTrf::TranslateX3D(RockXPos));
415  world->add(rZt);
416  GeoLogVol *lvr = new GeoLogVol("BEDROCK",&BedRock,rock);
417  GeoPhysVol *bedrock = new GeoPhysVol(lvr);
418  world->add(tag);
419  world->add(bedrock);
420 
421 
422  const GeoShape & CavConcrete = ((Concrete).
423 // add((*HoleJN) << GeoTrf::RotateY3D(M_PI*0.5) << GeoTrf::TranslateZ3D(-0.5*WallAAirZpos+CavernAirZpos)*GeoTrf::TranslateY3D(-WallCAirXpos*1.0) ).
424  subtract(AirHall));
425 
426  GeoTransform* xfTop = new GeoTransform(GeoTrf::TranslateY3D(CavShaftsYPos)*GeoTrf::RotateY3D(CavShaftsYrotate)*GeoTrf::RotateX3D(CavShaftsXrotate));
427  bedrock->add(xfTop);
428  GeoLogVol *lvcsc = new GeoLogVol("CAV_SHAFTS_CONC",&CavConcrete,conc);
429  GeoPhysVol *CavShaftsConc = new GeoPhysVol(lvcsc);
430  bedrock->add(CavShaftsConc);
431 
432 
435  m_detectorManager->addTreeTop(bedrock);
436 
437 }
438 
440 {
441  return m_detectorManager;
442 }
443 
445  const std::string& node)
446 {
447  m_versionTag = tag;
449 }
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
CavernInfraDetectorFactory::CavernInfraDetectorFactory
CavernInfraDetectorFactory(ServiceHandle< StoreGateSvc > pDetStore, ServiceHandle< IRDBAccessSvc > pAccess)
Definition: CavernInfraDetectorFactory.cxx:31
M_PI
#define M_PI
Definition: ActiveFraction.h:11
CavernInfraDetectorFactory.h
CavernInfraDetectorFactory::getDetectorManager
virtual const CavernInfraDetectorManager * getDetectorManager() const override
Definition: CavernInfraDetectorFactory.cxx:439
CavernInfraDetectorManager::addTreeTop
void addTreeTop(const PVLink &)
Definition: CavernInfraDetectorManager.cxx:29
CavernInfraDetectorFactory::m_detectorManager
CavernInfraDetectorManager * m_detectorManager
Definition: CavernInfraDetectorFactory.h:40
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
lumiFormat.i
int i
Definition: lumiFormat.py:85
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
CavernInfraDetectorFactory::m_versionTag
std::string m_versionTag
Definition: CavernInfraDetectorFactory.h:44
add
bool add(const std::string &hname, TKey *tobj)
Definition: fastadd.cxx:55
PyPoolBrowser.node
node
Definition: PyPoolBrowser.py:131
CavernInfraDetectorFactory::m_versionNode
std::string m_versionNode
Definition: CavernInfraDetectorFactory.h:45
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
CavernInfraDetectorFactory::m_access
ServiceHandle< IRDBAccessSvc > m_access
Definition: CavernInfraDetectorFactory.h:43
CavernInfraDetectorFactory::create
virtual void create(GeoPhysVol *world) override
Definition: CavernInfraDetectorFactory.cxx:38
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
CavernInfraDetectorManager
Definition: CavernInfraDetectorManager.h:13
StoredMaterialManager.h
CavernInfraDetectorFactory::m_detectorStore
ServiceHandle< StoreGateSvc > m_detectorStore
Definition: CavernInfraDetectorFactory.h:42
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
StoredMaterialManager::getMaterial
virtual const GeoMaterial * getMaterial(const std::string &name)=0
StoredMaterialManager
This class holds one or more material managers and makes them storeable, under StoreGate.
Definition: StoredMaterialManager.h:28
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
StoreGateSvc.h
CavernInfraDetectorFactory::setTagNode
void setTagNode(const std::string &tag, const std::string &node)
Definition: CavernInfraDetectorFactory.cxx:444
node
Definition: memory_hooks-stdcmalloc.h:74
ServiceHandle< StoreGateSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37