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