Belle II Software development
GeoCryostatCreator Class Reference

The creator for the Cryostat geometry of the Belle II detector. More...

#include <GeoCryostatCreator.h>

Inheritance diagram for GeoCryostatCreator:
CreatorBase

Public Member Functions

 GeoCryostatCreator ()
 Constructor of the GeoCryostatCreator class.
 
virtual ~GeoCryostatCreator ()
 The destructor of the GeoCryostatCreator class.
 
 GeoCryostatCreator (const GeoCryostatCreator &)=delete
 Do not want a copy constructor.
 
GeoCryostatCreatoroperator= (const GeoCryostatCreator &)=delete
 Do not want an assignment operator.
 
virtual void create (const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
 Creates the ROOT Objects for the Cryostat geometry.
 
virtual void createPayloads (const GearDir &content, const IntervalOfValidity &iov) override
 creates DB payload for CryostatGeo class
 
virtual void createFromDB (const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
 Create the geometry from the Database.
 
 BELLE2_DEFINE_EXCEPTION (DBNotImplemented, "Cannot create geometry from Database.")
 Exception that will be thrown in createFromDB if member is not yet implemented by creator.
 

Protected Attributes

SensitiveDetectorm_sensitive
 Sensitive detector.
 
CryostatGeo m_config
 geometry parameters object
 

Private Member Functions

CryostatGeo createConfiguration (const GearDir &param)
 Reads IR geometry parameters from the xml files and createst DB class CryostatGeo.
 
void createGeometry (G4LogicalVolume &topVolume, geometry::GeometryTypes type)
 Create detector geometry.
 

Detailed Description

The creator for the Cryostat geometry of the Belle II detector.

Definition at line 43 of file GeoCryostatCreator.h.

Constructor & Destructor Documentation

◆ GeoCryostatCreator()

Constructor of the GeoCryostatCreator class.

Definition at line 61 of file GeoCryostatCreator.cc.

62 {
63 m_sensitive = new SensitiveDetector();
64 }
VXD::SensitiveDetector< PXDSimHit, PXDTrueHit > SensitiveDetector
The PXD Sensitive Detector class.

◆ ~GeoCryostatCreator()

~GeoCryostatCreator ( )
virtual

The destructor of the GeoCryostatCreator class.

Definition at line 66 of file GeoCryostatCreator.cc.

67 {
68 delete m_sensitive;
69 }

Member Function Documentation

◆ create()

virtual void create ( const GearDir & content,
G4LogicalVolume & topVolume,
geometry::GeometryTypes type )
inlineoverridevirtual

Creates the ROOT Objects for the Cryostat geometry.

Parameters
contentA reference to the content part of the parameter description, which should to be used to create the ROOT objects.
topVolumeGeant4 logical top volume.
typeGeometry type.

Implements CreatorBase.

Definition at line 84 of file GeoCryostatCreator.h.

85 {
86 m_config = createConfiguration(content);
87
88 // override geometry configuration from the DB
89 DBStore::Instance().addConstantOverride("CryostatGeo", new CryostatGeo(m_config));
90
91 createGeometry(topVolume, type);
92 }

◆ createConfiguration()

CryostatGeo createConfiguration ( const GearDir & param)
inlineprivate

Reads IR geometry parameters from the xml files and createst DB class CryostatGeo.

Definition at line 47 of file GeoCryostatCreator.h.

48 {
49 CryostatGeo CryostatGeoConfig;
50 CryostatGeoConfig.initialize(param);
51 return CryostatGeoConfig;
52 }

◆ createFromDB()

virtual void createFromDB ( const std::string & name,
G4LogicalVolume & topVolume,
geometry::GeometryTypes type )
inlineoverridevirtual

Create the geometry from the Database.

Reimplemented from CreatorBase.

Definition at line 103 of file GeoCryostatCreator.h.

104 {
105 DBObjPtr<CryostatGeo> dbObj;
106 if (!dbObj) {
107 // Check that we found the object and if not report the problem
108 B2FATAL("No configuration for " << name << " found.");
109 }
110 m_config = *dbObj;
111 createGeometry(topVolume, type);
112 }

◆ createGeometry()

void createGeometry ( G4LogicalVolume & topVolume,
geometry::GeometryTypes type )
private

Create detector geometry.

Parameters
topVolumeGeant4 logical top volume.
typeGeometry type.

Definition at line 71 of file GeoCryostatCreator.cc.

72 {
73
74 //###### R side index ######
75 //
76 // +- A1spc1+A1spc2
77 // +- A2wal1
78 // +- A3wal1
79 // +- A3wal2
80 // +- A4mag1
81 // +- A4mag2
82 // +- A4mag3
83 // +- A4mag4
84 //
85 // +- B1spc1+B1spc2
86 // +- B2wal1
87 // +- B3wal1
88 // +- B3wal2
89 // +- B4mag1
90 // +- B4mag2
91 // +- B4mag3
92 // +- B4mag4
93 //
94 // +- C1wal1
95 // +- C2spc1
96 // +- C3wal1
97 // +- C4spc1
98 // +- C5wal1
99 // +- C6spc1
100 // +- C7lyr1
101 // +- C7lyr2
102 // +- C7lyr3
103 // +- C7lyr4
104 // +- C7lyr5
105 // +- C2spc2
106 // +- C3wal2
107 // +- C4spc2
108 // +- C5wal2
109 // +- C6spc2
110 // +- C7wal1
111 // +- C5wal3
112 // +- C5wal4
113 // +- C3wal3
114 // +- C2spc3
115 // +- C1wal2
116 //
117 //###### L side index ######
118 //
119 // +- D1spc1
120 // +- D2wal1
121 // +- D3wal1
122 // +- D3wal2
123 // +- D4mag1
124 // +- D4mag2
125 // +- D4mag3
126 //
127 // +- E1spc1
128 // +- E2wal1
129 // +- E3wal1
130 // +- E4mag1
131 // +- E4mag2
132 // +- E4mag3
133 //
134 // +- F1wal1
135 // +- F2spc1
136 // +- F3wal1
137 // +- F4spc1
138 // +- F5wal1
139 // +- F6spc1
140 // +- F7lyr1
141 // +- F7lyr2
142 // +- F7lyr3
143 // +- F7lyr4
144 // +- F7lyr5
145 // +- F3wal2
146 // +- F3wal3
147 // +- F3wal4
148 // +- F1wal2
149
150 double stepMax = 5.0 * Unit::mm;
151 int flag_limitStep = int(m_config.getParameter("LimitStepLength"));
152
153 const double unitFactor = Unit::cm / Unit::mm;
154
155 double crossingAngleHER = m_config.getParameter("CrossingAngle.HER", 0.0415);
156 double crossingAngleLER = m_config.getParameter("CrossingAngle.LER", -0.0415);
157
158 G4Transform3D transform_HER = G4Translate3D(0., 0., 0.);
159 transform_HER = transform_HER * G4RotateY3D(crossingAngleHER);
160
161 G4Transform3D transform_LER = G4Translate3D(0., 0., 0.);
162 transform_LER = transform_LER * G4RotateY3D(crossingAngleLER);
163
164 map<string, CryostatElement> elements;
165
166 // debug
167 //cout << endl << "!!! Creating a Cryostat copy..." << endl << endl;
168
169 //--------------
170 //- Bounding shapes
171
172 // right bounding shape 1
173 CryostatElement tubeR;
174 std::string prep = "TubeR.";
175
176 const int TubeR_N = int(m_config.getParameter(prep + "N"));
177
178 std::vector<double> TubeR_Z(TubeR_N);
179 std::vector<double> TubeR_R(TubeR_N);
180 std::vector<double> TubeR_r(TubeR_N);
181
182 for (int i = 0; i < TubeR_N; ++i) {
183 ostringstream ossZID;
184 ossZID << "Z" << i;
185
186 ostringstream ossRID;
187 ossRID << "R" << i;
188
189 ostringstream ossrID;
190 ossrID << "r" << i;
191
192 TubeR_Z[i] = m_config.getParameter(prep + ossZID.str()) * unitFactor;
193 TubeR_R[i] = m_config.getParameter(prep + ossRID.str()) * unitFactor;
194 TubeR_r[i] = m_config.getParameter(prep + ossrID.str(), 0.0) * unitFactor;
195 }
196
197 tubeR.transform = G4Translate3D(0., 0., 0.);
198 tubeR.geo = new G4Polycone("geo_TubeR_name", 0, 2 * M_PI, TubeR_N, &(TubeR_Z[0]), &(TubeR_r[0]), &(TubeR_R[0]));
199 tubeR.logi = NULL;
200 elements["TubeR"] = tubeR;
201
202 // right bounding shape 2
203 CryostatElement tubeR2;
204 prep = "TubeR2.";
205 const int TubeR2_N = int(m_config.getParameter(prep + "N"));
206
207 std::vector<double> TubeR2_Z(TubeR2_N);
208 std::vector<double> TubeR2_R(TubeR2_N);
209 std::vector<double> TubeR2_r(TubeR2_N);
210
211 for (int i = 0; i < TubeR2_N; ++i) {
212 ostringstream ossZID;
213 ossZID << "Z" << i;
214
215 ostringstream ossRID;
216 ossRID << "R" << i;
217
218 ostringstream ossrID;
219 ossrID << "r" << i;
220
221 TubeR2_Z[i] = m_config.getParameter(prep + ossZID.str()) * unitFactor;
222 TubeR2_R[i] = m_config.getParameter(prep + ossRID.str()) * unitFactor;
223 TubeR2_r[i] = m_config.getParameter(prep + ossrID.str(), 0.0) * unitFactor;
224 }
225
226 tubeR2.transform = G4Translate3D(0., 0., 0.);
227 tubeR2.geo = new G4Polycone("geo_TubeR2_name", 0, 2 * M_PI, TubeR2_N, &(TubeR2_Z[0]), &(TubeR2_r[0]), &(TubeR2_R[0]));
228 tubeR2.logi = NULL;
229 elements["TubeR2"] = tubeR2;
230
231 // left bounding shape
232 CryostatElement tubeL;
233 prep = "TubeL.";
234 const int TubeL_N = int(m_config.getParameter(prep + "N"));
235
236 std::vector<double> TubeL_Z(TubeL_N);
237 std::vector<double> TubeL_R(TubeL_N);
238 std::vector<double> TubeL_r(TubeL_N);
239
240 for (int i = 0; i < TubeL_N; ++i) {
241 ostringstream ossZID;
242 ossZID << "Z" << i;
243
244 ostringstream ossRID;
245 ossRID << "R" << i;
246
247 ostringstream ossrID;
248 ossrID << "r" << i;
249
250 TubeL_Z[i] = m_config.getParameter(prep + ossZID.str()) * unitFactor;
251 TubeL_R[i] = m_config.getParameter(prep + ossRID.str()) * unitFactor;
252 TubeL_r[i] = m_config.getParameter(prep + ossrID.str()) * unitFactor;
253 }
254
255 tubeL.transform = G4Translate3D(0., 0., 0.);
256 tubeL.geo = new G4Polycone("geo_TubeL_name", 0, 2 * M_PI, TubeL_N, &(TubeL_Z[0]), &(TubeL_r[0]), &(TubeL_R[0]));
257 tubeL.logi = NULL;
258 elements["TubeL"] = tubeL;
259
260 //--------------
261 // Special cases with complex geometry
262
263 //--------------
264 //- A1spc1 and B1spc1
265
266 // space containing all structures around right HER beam pipe, part 1
267 CryostatElement A1spc1;
268 prep = "A1spc1.";
269 const int A1spc1_N = int(m_config.getParameter(prep + "N"));
270
271 std::vector<double> A1spc1_Z(A1spc1_N);
272 std::vector<double> A1spc1_r(A1spc1_N);
273 std::vector<double> A1spc1_R(A1spc1_N);
274
275 for (int i = 0; i < A1spc1_N; ++i) {
276 ostringstream ossZID;
277 ossZID << "Z" << i;
278
279 ostringstream ossRID;
280 ossRID << "R" << i;
281
282 ostringstream ossrID;
283 ossrID << "r" << i;
284
285 A1spc1_Z[i] = m_config.getParameter(prep + ossZID.str()) * unitFactor;
286 A1spc1_R[i] = m_config.getParameter(prep + ossRID.str()) * unitFactor;
287 A1spc1_r[i] = m_config.getParameter(prep + ossrID.str(), 0.0) * unitFactor;
288 }
289
290 A1spc1.transform = transform_HER;
291 G4Polycone* geo_A1spc1xx = new G4Polycone("geo_A1spc1xx_name", 0, 2 * M_PI, A1spc1_N, &(A1spc1_Z[0]), &(A1spc1_r[0]),
292 &(A1spc1_R[0]));
293
294 // space containing all structures around right HER beam pipe, part 2
295 CryostatElement A1spc2;
296 prep = "A1spc2.";
297 const int A1spc2_N = int(m_config.getParameter(prep + "N"));
298
299 std::vector<double> A1spc2_Z(A1spc2_N);
300 std::vector<double> A1spc2_R(A1spc2_N);
301 std::vector<double> A1spc2_r(A1spc2_N);
302
303 for (int i = 0; i < A1spc2_N; ++i) {
304 ostringstream ossZID;
305 ossZID << "Z" << i;
306
307 ostringstream ossRID;
308 ossRID << "R" << i;
309
310 ostringstream ossrID;
311 ossrID << "r" << i;
312
313 A1spc2_Z[i] = m_config.getParameter(prep + ossZID.str()) * unitFactor;
314 A1spc2_R[i] = m_config.getParameter(prep + ossRID.str()) * unitFactor;
315 A1spc2_r[i] = m_config.getParameter(prep + ossrID.str(), 0.0) * unitFactor;
316 }
317
318 A1spc2.transform = transform_HER;
319 G4Polycone* geo_A1spc2xx = new G4Polycone("geo_A1spc2xx_name", 0, 2 * M_PI, A1spc2_N, &(A1spc2_Z[0]), &(A1spc2_r[0]),
320 &(A1spc2_R[0]));
321
322 // space containing all structures around right LER beam pipe, part 1
323 CryostatElement B1spc1;
324 prep = "B1spc1.";
325 const int B1spc1_N = int(m_config.getParameter(prep + "N"));
326
327 std::vector<double> B1spc1_Z(B1spc1_N);
328 std::vector<double> B1spc1_R(B1spc1_N);
329 std::vector<double> B1spc1_r(B1spc1_N);
330
331 for (int i = 0; i < B1spc1_N; ++i) {
332 ostringstream ossZID;
333 ossZID << "Z" << i;
334
335 ostringstream ossRID;
336 ossRID << "R" << i;
337
338 ostringstream ossrID;
339 ossrID << "r" << i;
340
341 B1spc1_Z[i] = m_config.getParameter(prep + ossZID.str()) * unitFactor;
342 B1spc1_R[i] = m_config.getParameter(prep + ossRID.str()) * unitFactor;
343 B1spc1_r[i] = m_config.getParameter(prep + ossrID.str(), 0.0) * unitFactor;
344 }
345
346 B1spc1.transform = transform_LER;
347 G4Polycone* geo_B1spc1xx = new G4Polycone("geo_B1spc1xx_name", 0, 2 * M_PI, B1spc1_N, &(B1spc1_Z[0]), &(B1spc1_r[0]),
348 &(B1spc1_R[0]));
349
350 // space containing all structures around right LER beam pipe, part 2
351 CryostatElement B1spc2;
352 prep = "B1spc2.";
353 const int B1spc2_N = int(m_config.getParameter(prep + "N"));
354
355 std::vector<double> B1spc2_Z(B1spc2_N);
356 std::vector<double> B1spc2_R(B1spc2_N);
357 std::vector<double> B1spc2_r(B1spc2_N);
358
359 for (int i = 0; i < B1spc2_N; ++i) {
360 ostringstream ossZID;
361 ossZID << "Z" << i;
362
363 ostringstream ossRID;
364 ossRID << "R" << i;
365
366 ostringstream ossrID;
367 ossrID << "r" << i;
368
369 B1spc2_Z[i] = m_config.getParameter(prep + ossZID.str()) * unitFactor;
370 B1spc2_R[i] = m_config.getParameter(prep + ossRID.str()) * unitFactor;
371 B1spc2_r[i] = m_config.getParameter(prep + ossrID.str(), 0.0) * unitFactor;
372 }
373
374 B1spc2.transform = transform_LER;
375 G4Polycone* geo_B1spc2xx = new G4Polycone("geo_B1spc2xx_name", 0, 2 * M_PI, B1spc2_N, &(B1spc2_Z[0]), &(B1spc2_r[0]),
376 &(B1spc2_R[0]));
377
378 // final cut
379 B1spc2.geo = new G4IntersectionSolid("geo_B1spc2_name", geo_B1spc2xx, elements["TubeR2"].geo, B1spc2.transform.inverse());
380 B1spc2.logi = NULL;
381
382 G4IntersectionSolid* geo_B1spc1x = new G4IntersectionSolid("geo_B1spc1x_name", geo_B1spc1xx, elements["TubeR"].geo,
383 B1spc1.transform.inverse());
384 B1spc1.geo = new G4UnionSolid("geo_B1spc1_name", geo_B1spc1x, B1spc2.geo);
385
386 A1spc2.geo = new G4IntersectionSolid("geo_A1spc2_name", geo_A1spc2xx, elements["TubeR2"].geo, A1spc2.transform.inverse());
387 A1spc2.logi = NULL;
388
389 G4IntersectionSolid* geo_A1spc1xy = new G4IntersectionSolid("geo_A1spc1xy_name", geo_A1spc1xx, elements["TubeR"].geo,
390 A1spc1.transform.inverse());
391 G4UnionSolid* geo_A1spc1x = new G4UnionSolid("geo_A1spc1x_name", geo_A1spc1xy, A1spc2.geo);
392 A1spc1.geo = new G4SubtractionSolid("geo_A1spc1_name", geo_A1spc1x, B1spc1.geo, A1spc1.transform.inverse()*B1spc1.transform);
393
394 string strMat_A1spc1 = m_config.getParameterStr("A1spc1.Material");
395 G4Material* mat_A1spc1 = Materials::get(strMat_A1spc1);
396 A1spc1.logi = new G4LogicalVolume(A1spc1.geo, mat_A1spc1, "logi_A1spc1_name");
397 if (flag_limitStep)
398 A1spc1.logi->SetUserLimits(new G4UserLimits(stepMax));
399
400 //put volume
401 setColor(*A1spc1.logi, "#CC0000");
402 //setVisibility(*A1spc1.logi, false);
403 new G4PVPlacement(A1spc1.transform, A1spc1.logi, "phys_A1spc1_name", &topVolume, false, 0);
404
405 string strMat_B1spc1 = m_config.getParameterStr("B1spc1.Material");
406 G4Material* mat_B1spc1 = Materials::get(strMat_B1spc1);
407 B1spc1.logi = new G4LogicalVolume(B1spc1.geo, mat_B1spc1, "logi_B1spc1_name");
408 if (flag_limitStep)
409 B1spc1.logi->SetUserLimits(new G4UserLimits(stepMax));
410
411 //put volume
412 setColor(*B1spc1.logi, "#CC0000");
413 //setVisibility(*B1spc1.logi, false);
414 new G4PVPlacement(B1spc1.transform, B1spc1.logi, "phys_B1spc1_name", &topVolume, false, 0);
415
416 elements["A1spc1"] = A1spc1;
417 elements["A1spc2"] = A1spc2;
418 elements["B1spc1"] = B1spc1;
419 elements["B1spc2"] = B1spc2;
420
421 //--------------
422 //- C1wal1
423
424 //get parameters from .xml file
425 CryostatElement C1wal1;
426 prep = "C1wal1.";
427 const int C1wal1_N = m_config.getParameter(prep + "N");
428
429 std::vector<double> C1wal1_Z(C1wal1_N);
430 std::vector<double> C1wal1_R(C1wal1_N);
431 std::vector<double> C1wal1_r(C1wal1_N);
432
433 for (int i = 0; i < C1wal1_N; ++i) {
434 ostringstream ossZID;
435 ossZID << "Z" << i;
436
437 ostringstream ossRID;
438 ossRID << "R" << i;
439
440 ostringstream ossrID;
441 ossrID << "r" << i;
442
443 C1wal1_Z[i] = m_config.getParameter(prep + ossZID.str()) * unitFactor;
444 C1wal1_R[i] = m_config.getParameter(prep + ossRID.str()) * unitFactor;
445 C1wal1_r[i] = m_config.getParameter(prep + ossrID.str(), 0.0) * unitFactor;
446 }
447
448 C1wal1.transform = G4Translate3D(0., 0., 0.);
449
450 //define geometry
451 G4Polycone* geo_C1wal1xxx = new G4Polycone("geo_C1wal1xxx_name", 0, 2 * M_PI, C1wal1_N, &(C1wal1_Z[0]), &(C1wal1_r[0]),
452 &(C1wal1_R[0]));
453 G4IntersectionSolid* geo_C1wal1xx = new G4IntersectionSolid("geo_C1wal1xx_name", geo_C1wal1xxx, elements["TubeR"].geo,
454 elements["TubeR"].transform);
455 G4SubtractionSolid* geo_C1wal1x = new G4SubtractionSolid("geo_C1wal1x_name", geo_C1wal1xx, elements["A1spc1"].geo,
456 elements["A1spc1"].transform);
457 C1wal1.geo = new G4SubtractionSolid("geo_C1wal1_name", geo_C1wal1x, elements["B1spc1"].geo, elements["B1spc1"].transform);
458
459 string strMat_C1wal1 = m_config.getParameterStr(prep + "Material");
460 G4Material* mat_C1wal1 = Materials::get(strMat_C1wal1);
461 C1wal1.logi = new G4LogicalVolume(C1wal1.geo, mat_C1wal1, "logi_C1wal1_name");
462
463 //put volume
464 setColor(*C1wal1.logi, "#CC0000");
465//--andrii setVisibility(*C1wal1.logi, false);
466 new G4PVPlacement(0, G4ThreeVector(0, 0, 0), C1wal1.logi, "phys_C1wal1_name", &topVolume, false, 0);
467
468 elements["C1wal1"] = C1wal1;
469
470 //--------------
471 //- D1spc1 and E1spc1
472
473 // space containing all structures around left HER beam pipe
474 CryostatElement D1spc1;
475 prep = "D1spc1.";
476 const int D1spc1_N = m_config.getParameter(prep + "N");
477
478 std::vector<double> D1spc1_Z(D1spc1_N);
479 std::vector<double> D1spc1_r(D1spc1_N);
480 std::vector<double> D1spc1_R(D1spc1_N);
481
482 for (int i = 0; i < D1spc1_N; ++i) {
483 ostringstream ossZID;
484 ossZID << "Z" << i;
485
486 ostringstream ossRID;
487 ossRID << "R" << i;
488
489 ostringstream ossrID;
490 ossrID << "r" << i;
491
492 D1spc1_Z[i] = m_config.getParameter(prep + ossZID.str()) * unitFactor;
493 D1spc1_R[i] = m_config.getParameter(prep + ossRID.str()) * unitFactor;
494 D1spc1_r[i] = m_config.getParameter(prep + ossrID.str(), 0.0) * unitFactor;
495 }
496
497 D1spc1.transform = transform_HER;
498 G4Polycone* geo_D1spc1xx = new G4Polycone("geo_D1spc1xx_name", 0, 2 * M_PI, D1spc1_N, &(D1spc1_Z[0]), &(D1spc1_r[0]),
499 &(D1spc1_R[0]));
500
501 // space containing all structures around left LER beam pipe
502 CryostatElement E1spc1;
503 prep = "E1spc1.";
504 const int E1spc1_N = int(m_config.getParameter(prep + "N"));
505
506 std::vector<double> E1spc1_Z(E1spc1_N);
507 std::vector<double> E1spc1_R(E1spc1_N);
508 std::vector<double> E1spc1_r(E1spc1_N);
509
510 for (int i = 0; i < E1spc1_N; ++i) {
511 ostringstream ossZID;
512 ossZID << "Z" << i;
513
514 ostringstream ossRID;
515 ossRID << "R" << i;
516
517 ostringstream ossrID;
518 ossrID << "r" << i;
519
520 E1spc1_Z[i] = m_config.getParameter(prep + ossZID.str()) * unitFactor;
521 E1spc1_R[i] = m_config.getParameter(prep + ossRID.str()) * unitFactor;
522 E1spc1_r[i] = m_config.getParameter(prep + ossrID.str(), 0.0) * unitFactor;
523 }
524
525 E1spc1.transform = transform_LER;
526 G4Polycone* geo_E1spc1xx = new G4Polycone("geo_E1spc1xx_name", 0, 2 * M_PI, E1spc1_N, &(E1spc1_Z[0]), &(E1spc1_r[0]),
527 &(E1spc1_R[0]));
528
529 // final cut
530 G4IntersectionSolid* geo_D1spc1x = new G4IntersectionSolid("geo_D1spc1x_name", geo_D1spc1xx, elements["TubeL"].geo,
531 D1spc1.transform.inverse());
532 E1spc1.geo = new G4IntersectionSolid("geo_E1spc1_name", geo_E1spc1xx, elements["TubeL"].geo, E1spc1.transform.inverse());
533 D1spc1.geo = new G4SubtractionSolid("geo_D1spc1_name", geo_D1spc1x, E1spc1.geo, D1spc1.transform.inverse()*E1spc1.transform);
534
535 string strMat_D1spc1 = m_config.getParameterStr("D1spc1.Material");
536 G4Material* mat_D1spc1 = Materials::get(strMat_D1spc1);
537 D1spc1.logi = new G4LogicalVolume(D1spc1.geo, mat_D1spc1, "logi_D1spc1_name");
538 if (flag_limitStep)
539 D1spc1.logi->SetUserLimits(new G4UserLimits(stepMax));
540
541 //put volume
542 setColor(*D1spc1.logi, "#CC0000");
543 //setVisibility(*D1spc1.logi, false);
544 new G4PVPlacement(D1spc1.transform, D1spc1.logi, "phys_D1spc1_name", &topVolume, false, 0);
545
546 string strMat_E1spc1 = m_config.getParameterStr(prep + "Material");
547 G4Material* mat_E1spc1 = Materials::get(strMat_E1spc1);
548 E1spc1.logi = new G4LogicalVolume(E1spc1.geo, mat_E1spc1, "logi_E1spc1_name");
549 if (flag_limitStep)
550 E1spc1.logi->SetUserLimits(new G4UserLimits(stepMax));
551
552 //put volume
553 setColor(*E1spc1.logi, "#CC0000");
554 //setVisibility(*E1spc1.logi, false);
555 new G4PVPlacement(E1spc1.transform, E1spc1.logi, "phys_E1spc1_name", &topVolume, false, 0);
556
557 elements["E1spc1"] = E1spc1;
558 elements["D1spc1"] = D1spc1;
559
560
561 //--------------
562 //- F1wal1
563
564 //get parameters from .xml file
565 CryostatElement F1wal1;
566 prep = "F1wal1.";
567 const int F1wal1_N = int(m_config.getParameter(prep + "N"));
568
569 std::vector<double> F1wal1_Z(F1wal1_N);
570 std::vector<double> F1wal1_R(F1wal1_N);
571 std::vector<double> F1wal1_r(F1wal1_N);
572
573 for (int i = 0; i < F1wal1_N; ++i) {
574 ostringstream ossZID;
575 ossZID << "Z" << i;
576
577 ostringstream ossRID;
578 ossRID << "R" << i;
579
580 ostringstream ossrID;
581 ossrID << "r" << i;
582
583 F1wal1_Z[i] = m_config.getParameter(prep + ossZID.str()) * unitFactor;
584 F1wal1_R[i] = m_config.getParameter(prep + ossRID.str()) * unitFactor;
585 F1wal1_r[i] = m_config.getParameter(prep + ossrID.str(), 0.0) * unitFactor;
586 }
587
588 F1wal1.transform = G4Translate3D(0., 0., 0.);
589
590 //define geometry
591 G4Polycone* geo_F1wal1xxx = new G4Polycone("geo_F1wal1xxx_name", 0, 2 * M_PI, F1wal1_N, &(F1wal1_Z[0]), &(F1wal1_r[0]),
592 &(F1wal1_R[0]));
593 G4IntersectionSolid* geo_F1wal1xx = new G4IntersectionSolid("geo_F1wal1xx_name", geo_F1wal1xxx, elements["TubeL"].geo,
594 elements["TubeL"].transform);
595 G4SubtractionSolid* geo_F1wal1x = new G4SubtractionSolid("geo_F1wal1x_name", geo_F1wal1xx, elements["D1spc1"].geo,
596 elements["D1spc1"].transform);
597 F1wal1.geo = new G4SubtractionSolid("geo_F1wal1_name", geo_F1wal1x, elements["E1spc1"].geo, elements["E1spc1"].transform);
598
599 string strMat_F1wal1 = m_config.getParameterStr(prep + "Material");
600 G4Material* mat_F1wal1 = Materials::get(strMat_F1wal1);
601 F1wal1.logi = new G4LogicalVolume(F1wal1.geo, mat_F1wal1, "logi_F1wal1_name");
602
603 //put volume
604 setColor(*F1wal1.logi, "#CC0000");
605//--andrii setVisibility(*F1wal1.logi, false);
606 new G4PVPlacement(F1wal1.transform, F1wal1.logi, "phys_F1wal1_name", &topVolume, false, 0);
607
608 elements["F1wal1"] = F1wal1;
609
610
611 //--------------
612 //- Cryostats' supports
613
614 std::vector<std::string> supports;
615 boost::split(supports, m_config.getParameterStr("Support"), boost::is_any_of(" "));
616 for (const auto& name : supports) {
617 // storable element
618 CryostatElement sup;
619 prep = name + ".";
620
621 double box_W = m_config.getParameter(prep + "W") * unitFactor;
622 double box_H = m_config.getParameter(prep + "H") * unitFactor;
623 double box_L = m_config.getParameter(prep + "L") * unitFactor;
624 double box_X0 = m_config.getParameter(prep + "X0") * unitFactor;
625 double box_Y0 = m_config.getParameter(prep + "Y0") * unitFactor;
626 double box_Z0 = m_config.getParameter(prep + "Z0") * unitFactor;
627
628 double trd_W1 = m_config.getParameter(prep + "trdW1") * unitFactor;
629 double trd_W2 = m_config.getParameter(prep + "trdW2") * unitFactor;
630 double trd_L = m_config.getParameter(prep + "trdL") * unitFactor;
631 double trd_H = m_config.getParameter(prep + "trdH") * unitFactor;
632 double trd_X0 = m_config.getParameter(prep + "trdX0") * unitFactor;
633 double trd_Y0 = m_config.getParameter(prep + "trdY0") * unitFactor;
634 double trd_Z0 = m_config.getParameter(prep + "trdZ0") * unitFactor;
635
636 double sup_PHI = m_config.getParameter(prep + "PHI");
637
638 int sup_cut_N = int(m_config.getParameter(prep + "N", 0));
639
640 // transformations
641 G4Transform3D transform_box = G4Translate3D(box_X0, box_Y0, box_Z0);
642 transform_box = transform_box * G4RotateY3D(sup_PHI / Unit::rad);
643
644 G4Transform3D transform_trd = G4Translate3D(trd_X0, trd_Y0, trd_Z0);
645 transform_trd = transform_trd * G4RotateY3D(sup_PHI / Unit::rad) * G4RotateX3D(M_PI / 2.0 / Unit::rad);
646
647 //define geometry
648 string geo_box_name = "geo_" + name + "_box_name";
649 string geo_trd_name = "geo_" + name + "_trd_name";
650
651 string geo_sup_name;
652 if (sup_cut_N == 0) {
653 geo_sup_name = "geo_" + name + "_name";
654 } else {
655 geo_sup_name = "geo_" + name + "_x_name";
656 }
657
658 G4Box* geo_box = new G4Box(geo_box_name, box_W / 2.0, box_H / 2.0, box_L / 2.0);
659 G4Trd* geo_trd = new G4Trd(geo_trd_name, trd_W1 / 2.0, trd_W2 / 2.0, trd_L / 2.0, trd_L / 2.0, trd_H / 2.0);
660
661 G4VSolid* geo_sup = new G4UnionSolid(geo_sup_name, geo_box, geo_trd, transform_box.inverse() * transform_trd);
662
663 // cuts
664 for (int i = 0; i < sup_cut_N; ++i) {
665 ostringstream oss_block_num;
666 oss_block_num << i;
667
668 double cut_type = m_config.getParameter(prep + "cutType" + oss_block_num.str());
669 string geo_supx_name;
670 if (i == sup_cut_N - 1) {
671 geo_supx_name = "geo_" + name + "_name";
672 } else {
673 geo_sup_name = "geo_" + name + "_x" + oss_block_num.str() + "_name";
674 }
675 string geo_cut_name = "geo_" + name + "_cut" + oss_block_num.str() + "_name";
676
677 G4VSolid* geo_cut;
678
679 if (cut_type == 0.0) {
680 double cut_L = m_config.getParameter(prep + "cutL" + oss_block_num.str()) * unitFactor;
681 double cut_W = m_config.getParameter(prep + "cutW" + oss_block_num.str()) * unitFactor;
682 double cut_H = m_config.getParameter(prep + "cutH" + oss_block_num.str()) * unitFactor;
683
684 geo_cut = new G4Box(geo_cut_name, cut_W / 2.0, cut_H / 2.0, cut_L / 2.0);
685 } else {
686 double cut_L = m_config.getParameter(prep + "cutL" + oss_block_num.str()) * unitFactor;
687 double cut_R = m_config.getParameter(prep + "cutR" + oss_block_num.str()) * unitFactor;
688
689 geo_cut = new G4Tubs(geo_cut_name, 0.0, cut_R, cut_L / 2.0, 0.0, 2.0 * M_PI);
690 }
691
692 double cut_X0 = m_config.getParameter(prep + "cutDX" + oss_block_num.str()) * unitFactor;
693 double cut_Y0 = m_config.getParameter(prep + "cutDY" + oss_block_num.str()) * unitFactor;
694 double cut_Z0 = m_config.getParameter(prep + "cutDZ" + oss_block_num.str()) * unitFactor;
695 double cut_PHI = m_config.getParameter(prep + "cutPHI" + oss_block_num.str(), 0.0);
696 double cut_TH = m_config.getParameter(prep + "cutTH" + oss_block_num.str(), 0.0);
697
698 G4Transform3D cut_transform = G4Translate3D(cut_X0, cut_Y0, cut_Z0);
699 cut_transform = cut_transform * G4RotateX3D(cut_PHI / Unit::rad);
700 cut_transform = cut_transform * G4RotateZ3D(cut_TH / Unit::rad);
701
702 geo_sup = new G4SubtractionSolid(geo_sup_name, geo_sup, geo_cut, cut_transform);
703 }
704
705 sup.geo = geo_sup;
706 sup.transform = transform_box;
707
708 string strMat_sup = m_config.getParameterStr(prep + "Material");
709 G4Material* mat_sup = Materials::get(strMat_sup);
710
711 string logi_sup_name = "logi_" + name + "_name";
712 G4LogicalVolume* logi_sup = new G4LogicalVolume(sup.geo, mat_sup, logi_sup_name);
713
714 sup.logi = logi_sup;
715
716 //put volume
717 setColor(*logi_sup, "#0000CC");
718 //setVisibility(*logi_sup, false);
719 string phys_sup_name = "phys_" + name + "_name";
720 new G4PVPlacement(sup.transform, sup.logi, phys_sup_name, &topVolume, false, 0);
721
722 elements[name] = sup;
723 }
724
725 //----------------------------------
726 //- Bellows shield geometry
727 prep = "BellowsShield.";
728 double BS_fwdZ0 = m_config.getParameter(prep + "fwdZ0") * unitFactor;
729 double BS_fwdZ1 = m_config.getParameter(prep + "fwdZ1") * unitFactor;
730 double BS_fwdZ2 = m_config.getParameter(prep + "fwdZ2") * unitFactor;
731 double BS_fwdZ3 = m_config.getParameter(prep + "fwdZ3") * unitFactor;
732 double BS_fwdZ4 = m_config.getParameter(prep + "fwdZ4") * unitFactor;
733 double BS_bwdZ0 = m_config.getParameter(prep + "bwdZ0") * unitFactor;
734 double BS_bwdZ1 = m_config.getParameter(prep + "bwdZ1") * unitFactor;
735 double BS_bwdZ2 = m_config.getParameter(prep + "bwdZ2") * unitFactor;
736 double BS_bwdZ3 = m_config.getParameter(prep + "bwdZ3") * unitFactor;
737 //double BS_bwdZ4 = m_config.getParameter(prep + "bwdZ4")*unitFactor;
738
739 string strMat_BS = m_config.getParameterStr(prep + "Material");
740 G4Material* mat_BS = Materials::get(strMat_BS);
741
742 // Parameters for Base10/11 (FWD)
743 double BS_fwdP0_R = m_config.getParameter(prep + "fwdP0_R") * unitFactor;
744 double BS_fwdP0_Yout = m_config.getParameter(prep + "fwdP0_Yout") * unitFactor;
745 double BS_fwdP0_Yin = m_config.getParameter(prep + "fwdP0_Yin") * unitFactor;
746 double BS_fwdP0_Xin = m_config.getParameter(prep + "fwdP0_Xin") * unitFactor;
747 double BS_fwdP0_Yedge = m_config.getParameter(prep + "fwdP0_Yedge") * unitFactor;
748 double BS_fwdP0_Xedge = m_config.getParameter(prep + "fwdP0_Xedge") * unitFactor;
749 double BS_fwdP0_Yside = m_config.getParameter(prep + "fwdP0_Yside") * unitFactor;
750 double BS_fwdP0_Xside = m_config.getParameter(prep + "fwdP0_Xside") * unitFactor;
751
752 double BS_fwdP0_DHalf = (BS_fwdZ2 - BS_fwdZ0) / 2;
753 G4VSolid* geo_BS_fwdP0_B0 = new G4Tubs("geo_BS_fwdP0_B0", 0, BS_fwdP0_R, BS_fwdP0_DHalf, 0, 2 * M_PI);
754 G4Transform3D tfm_BS_fwdP0_B0 = G4Translate3D(0, 0, BS_fwdP0_DHalf);
755
756 G4VSolid* geo_BS_fwdP0_V0T = new G4Tubs("geo_BS_fwdP0_V0T", 0, BS_fwdP0_Yin, BS_fwdP0_DHalf, 0.25 * M_PI, 0.5 * M_PI);
757 G4VSolid* geo_BS_fwdP0_V0B = new G4Tubs("geo_BS_fwdP0_V0B", 0, BS_fwdP0_Yin, BS_fwdP0_DHalf, 1.25 * M_PI, 0.5 * M_PI);
758 G4Transform3D tfm_BS_fwdP0_V0L = G4Translate3D(-BS_fwdP0_Xin, 0, BS_fwdP0_DHalf);
759 G4Transform3D tfm_BS_fwdP0_V0R = G4Translate3D(+BS_fwdP0_Xin, 0, BS_fwdP0_DHalf);
760
761 G4VSolid* geo_BS_fwdP0_V1 = new G4Box("geo_BS_fwdP0_V1", BS_fwdP0_Xside, BS_fwdP0_Yedge, BS_fwdP0_DHalf);
762 G4Transform3D tfm_BS_fwdP0_V1 = G4Translate3D(0, 0, BS_fwdP0_DHalf);
763
764 G4VSolid* geo_BS_fwdP0_V2 = new G4Box("geo_BS_fwdP0_V2", 100, 100, BS_fwdP0_DHalf);
765 G4Transform3D tfm_BS_fwdP0_V2TR = G4Translate3D(+(100 + BS_fwdP0_Xedge), +(100 + BS_fwdP0_Yside), BS_fwdP0_DHalf);
766 G4Transform3D tfm_BS_fwdP0_V2TL = G4Translate3D(-(100 + BS_fwdP0_Xedge), +(100 + BS_fwdP0_Yside), BS_fwdP0_DHalf);
767 G4Transform3D tfm_BS_fwdP0_V2BR = G4Translate3D(+(100 + BS_fwdP0_Xedge), -(100 + BS_fwdP0_Yside), BS_fwdP0_DHalf);
768 G4Transform3D tfm_BS_fwdP0_V2BL = G4Translate3D(-(100 + BS_fwdP0_Xedge), -(100 + BS_fwdP0_Yside), BS_fwdP0_DHalf);
769
770 G4VSolid* geo_BS_fwdP0_V3 = new G4Box("geo_BS_fwdP0_V3", BS_fwdP0_Xin, BS_fwdP0_Yin, BS_fwdP0_DHalf);
771 G4Transform3D tfm_BS_fwdP0_V3 = G4Translate3D(0, 0, BS_fwdP0_DHalf);
772
773 double BS_fwdP0_C0_DHalf = (BS_fwdZ1 - BS_fwdZ0) / 2;
774 G4VSolid* geo_BS_fwdP0_V4 = new G4Box("geo_BS_fwdP0_V4", 100, 100, BS_fwdP0_C0_DHalf);
775 G4Transform3D tfm_BS_fwdP0_V4T = G4Translate3D(0, +(100 + BS_fwdP0_Yout), BS_fwdP0_C0_DHalf);
776 G4Transform3D tfm_BS_fwdP0_V4B = G4Translate3D(0, -(100 + BS_fwdP0_Yout), BS_fwdP0_C0_DHalf);
777
778 G4VSolid* geo_BS_fwdP0_Base = new G4DisplacedSolid("geo_BS_fwdP0_Base_00", geo_BS_fwdP0_B0, tfm_BS_fwdP0_B0);
779 geo_BS_fwdP0_Base = new G4SubtractionSolid("geo_BS_fwdP0_Base_01", geo_BS_fwdP0_Base, geo_BS_fwdP0_V0T, tfm_BS_fwdP0_V0L);
780 geo_BS_fwdP0_Base = new G4SubtractionSolid("geo_BS_fwdP0_Base_02", geo_BS_fwdP0_Base, geo_BS_fwdP0_V0T, tfm_BS_fwdP0_V0R);
781 geo_BS_fwdP0_Base = new G4SubtractionSolid("geo_BS_fwdP0_Base_03", geo_BS_fwdP0_Base, geo_BS_fwdP0_V0B, tfm_BS_fwdP0_V0L);
782 geo_BS_fwdP0_Base = new G4SubtractionSolid("geo_BS_fwdP0_Base_04", geo_BS_fwdP0_Base, geo_BS_fwdP0_V0B, tfm_BS_fwdP0_V0R);
783 geo_BS_fwdP0_Base = new G4SubtractionSolid("geo_BS_fwdP0_Base_05", geo_BS_fwdP0_Base, geo_BS_fwdP0_V1, tfm_BS_fwdP0_V1);
784 geo_BS_fwdP0_Base = new G4SubtractionSolid("geo_BS_fwdP0_Base_06", geo_BS_fwdP0_Base, geo_BS_fwdP0_V2, tfm_BS_fwdP0_V2TR);
785 geo_BS_fwdP0_Base = new G4SubtractionSolid("geo_BS_fwdP0_Base_07", geo_BS_fwdP0_Base, geo_BS_fwdP0_V2, tfm_BS_fwdP0_V2TL);
786 geo_BS_fwdP0_Base = new G4SubtractionSolid("geo_BS_fwdP0_Base_08", geo_BS_fwdP0_Base, geo_BS_fwdP0_V2, tfm_BS_fwdP0_V2BR);
787 geo_BS_fwdP0_Base = new G4SubtractionSolid("geo_BS_fwdP0_Base_09", geo_BS_fwdP0_Base, geo_BS_fwdP0_V2, tfm_BS_fwdP0_V2BL);
788 geo_BS_fwdP0_Base = new G4SubtractionSolid("geo_BS_fwdP0_Base_10", geo_BS_fwdP0_Base, geo_BS_fwdP0_V3, tfm_BS_fwdP0_V3);
789 geo_BS_fwdP0_Base = new G4SubtractionSolid("geo_BS_fwdP0_Base_11", geo_BS_fwdP0_Base, geo_BS_fwdP0_V4, tfm_BS_fwdP0_V4T);
790 geo_BS_fwdP0_Base = new G4SubtractionSolid("geo_BS_fwdP0_Base_12", geo_BS_fwdP0_Base, geo_BS_fwdP0_V4, tfm_BS_fwdP0_V4B);
791
792 // Parameters for Base20/21 (BWD)
793 double BS_bwdP0_R0 = m_config.getParameter(prep + "bwdP0_R0") * unitFactor;
794 double BS_bwdP0_R1 = m_config.getParameter(prep + "bwdP0_R1") * unitFactor;
795 double BS_bwdP0_Yin = m_config.getParameter(prep + "bwdP0_Yin") * unitFactor;
796 double BS_bwdP0_Xin = m_config.getParameter(prep + "bwdP0_Xin") * unitFactor;
797
798 double BS_bwdP0a_DHalf = (BS_bwdZ0 - BS_bwdZ1) / 2;
799 G4VSolid* geo_BS_bwdP0_B0 = new G4Tubs("geo_BS_bwdP0_B0", 0, BS_bwdP0_R0, BS_bwdP0a_DHalf, 0, 2 * M_PI);
800 G4Transform3D tfm_BS_bwdP0_B0 = G4Translate3D(0, 0, -BS_bwdP0a_DHalf);
801
802 double BS_bwdP0b_DHalf = (BS_bwdZ1 - BS_bwdZ2) / 2;
803 G4VSolid* geo_BS_bwdP0_B1 = new G4Tubs("geo_BS_bwdP0_B1", 0, BS_bwdP0_R1, BS_bwdP0b_DHalf, 0.5 * M_PI, M_PI);
804 G4Transform3D tfm_BS_bwdP0_B1 = G4Translate3D(-BS_bwdP0_Xin, 0, -BS_bwdP0b_DHalf - 2 * BS_bwdP0a_DHalf);
805
806 G4VSolid* geo_BS_bwdP0_B2 = new G4Tubs("geo_BS_bwdP0_B2", 0, BS_bwdP0_R1, BS_bwdP0b_DHalf, 1.5 * M_PI, M_PI);
807 G4Transform3D tfm_BS_bwdP0_B2 = G4Translate3D(+BS_bwdP0_Xin, 0, -BS_bwdP0b_DHalf - 2 * BS_bwdP0a_DHalf);
808
809 G4VSolid* geo_BS_bwdP0_B3 = new G4Box("geo_BS_bwdP0_B3", BS_bwdP0_Xin, BS_bwdP0_R1, BS_bwdP0b_DHalf);
810 G4Transform3D tfm_BS_bwdP0_B3 = G4Translate3D(0, 0, -BS_bwdP0b_DHalf - 2 * BS_bwdP0a_DHalf);
811
812 double BS_bwdP0c_DHalf = (BS_bwdZ0 - BS_bwdZ2) / 2;
813 G4VSolid* geo_BS_bwdP0_V0 = new G4Tubs("geo_BS_bwdP0_V0", 0, BS_bwdP0_Yin, BS_bwdP0c_DHalf, 0.5 * M_PI, M_PI);
814 G4Transform3D tfm_BS_bwdP0_V0 = G4Translate3D(-BS_bwdP0_Xin, 0, -BS_bwdP0c_DHalf);
815
816 G4VSolid* geo_BS_bwdP0_V1 = new G4Tubs("geo_BS_bwdP0_V1", 0, BS_bwdP0_Yin, BS_bwdP0c_DHalf, 1.5 * M_PI, M_PI);
817 G4Transform3D tfm_BS_bwdP0_V1 = G4Translate3D(+BS_bwdP0_Xin, 0, -BS_bwdP0c_DHalf);
818
819 G4VSolid* geo_BS_bwdP0_V2 = new G4Box("geo_BS_bwdP0_V2", BS_bwdP0_Xin, BS_bwdP0_Yin, BS_bwdP0c_DHalf);
820 G4Transform3D tfm_BS_bwdP0_V2 = G4Translate3D(0, 0, -BS_bwdP0c_DHalf);
821
822 G4VSolid* geo_BS_bwdP0_Base = new G4DisplacedSolid("geo_BS_bwdP0_Base_00", geo_BS_bwdP0_B0, tfm_BS_bwdP0_B0);
823 geo_BS_bwdP0_Base = new G4UnionSolid("geo_BS_bwdP0_Base_01", geo_BS_bwdP0_Base, geo_BS_bwdP0_B1, tfm_BS_bwdP0_B1);
824 geo_BS_bwdP0_Base = new G4UnionSolid("geo_BS_bwdP0_Base_02", geo_BS_bwdP0_Base, geo_BS_bwdP0_B2, tfm_BS_bwdP0_B2);
825 geo_BS_bwdP0_Base = new G4UnionSolid("geo_BS_bwdP0_Base_03", geo_BS_bwdP0_Base, geo_BS_bwdP0_B3, tfm_BS_bwdP0_B3);
826 geo_BS_bwdP0_Base = new G4SubtractionSolid("geo_BS_bwdP0_Base_04", geo_BS_bwdP0_Base, geo_BS_bwdP0_V0, tfm_BS_bwdP0_V0);
827 geo_BS_bwdP0_Base = new G4SubtractionSolid("geo_BS_bwdP0_Base_05", geo_BS_bwdP0_Base, geo_BS_bwdP0_V1, tfm_BS_bwdP0_V1);
828 geo_BS_bwdP0_Base = new G4SubtractionSolid("geo_BS_bwdP0_Base_06", geo_BS_bwdP0_Base, geo_BS_bwdP0_V2, tfm_BS_bwdP0_V2);
829
830 // Parameters for Base5/6
831 double BS_P1_Yout = m_config.getParameter(prep + "P1_Yout") * unitFactor;
832 double BS_P1_Yin = m_config.getParameter(prep + "P1_Yin") * unitFactor;
833 double BS_P1_Rout = m_config.getParameter(prep + "P1_Rout") * unitFactor;
834 double BS_P1_Rin = m_config.getParameter(prep + "P1_Rin") * unitFactor;
835 double BS_P1_Aout = m_config.getParameter(prep + "P1_Aout");
836 double BS_P1_Ain = m_config.getParameter(prep + "P1_Ain");
837 double BS_P1_RX = m_config.getParameter(prep + "P1_RX") * unitFactor;
838 double BS_fwdZhole = m_config.getParameter(prep + "fwdZhole") * unitFactor;
839 double BS_bwdZhole = m_config.getParameter(prep + "bwdZhole") * unitFactor;
840 double BS_P1_Rhole = m_config.getParameter(prep + "P1_Rhole") * unitFactor;
841 double BS_P1_Rbump = m_config.getParameter(prep + "P1_Rbump") * unitFactor;
842 double BS_P1_Yhole = m_config.getParameter(prep + "P1_Yhole") * unitFactor;
843 double BS_P1_MillD1 = m_config.getParameter(prep + "P1_MillD1") * unitFactor;
844 double BS_P1_MillD2 = m_config.getParameter(prep + "P1_MillD2") * unitFactor;
845 double BS_P1_MillX = m_config.getParameter(prep + "P1_MillX") * unitFactor;
846 double BS_P1_MillW = m_config.getParameter(prep + "P1_MillW") * unitFactor;
847 double BS_fwdZcut = m_config.getParameter(prep + "fwdZcut") * unitFactor;
848 double BS_bwdZcut = m_config.getParameter(prep + "bwdZcut") * unitFactor;
849 double BS_P1_XcutTL = m_config.getParameter(prep + "P1_XcutTL") * unitFactor;
850 double BS_P1_XcutTR = m_config.getParameter(prep + "P1_XcutTR") * unitFactor;
851 double BS_P1_XcutBL = m_config.getParameter(prep + "P1_XcutBL") * unitFactor;
852 double BS_P1_XcutBR = m_config.getParameter(prep + "P1_XcutBR") * unitFactor;
853
854 double BS_P1_Xout = BS_P1_Rout * cos(BS_P1_Aout) + BS_P1_RX;
855 double BS_P1_Xin = BS_P1_Rin * cos(BS_P1_Ain) + BS_P1_RX;
856
857 double BS_P1fwd_DHalf = (BS_fwdZ3 - BS_fwdZ2) / 2;
858 G4VSolid* geo_BS_P1fwd_B0 = new G4Box("geo_BS_P1fwd_B0", BS_P1_Xout, BS_P1_Yout, BS_P1fwd_DHalf);
859 G4Transform3D tfm_BS_P1fwd_B0 = G4Translate3D(0, 0, BS_P1fwd_DHalf);
860
861 G4VSolid* geo_BS_P1fwd_B1 = new G4Tubs("geo_BS_P1fwd_B1", 0, BS_P1_Rout, BS_P1fwd_DHalf, M_PI - BS_P1_Aout, 2 * BS_P1_Aout);
862 G4Transform3D tfm_BS_P1fwd_B1 = G4Translate3D(-BS_P1_RX, 0, BS_P1fwd_DHalf);
863
864 G4VSolid* geo_BS_P1fwd_B2 = new G4Tubs("geo_BS_P1fwd_B2", 0, BS_P1_Rout, BS_P1fwd_DHalf, 2 * M_PI - BS_P1_Aout, 2 * BS_P1_Aout);
865 G4Transform3D tfm_BS_P1fwd_B2 = G4Translate3D(+BS_P1_RX, 0, BS_P1fwd_DHalf);
866
867 G4VSolid* geo_BS_P1fwd_B3 = new G4Tubs("geo_BS_P1fwd_B3", 0, BS_P1_Rbump, BS_P1fwd_DHalf, 0, 2 * M_PI);
868 G4Transform3D tfm_BS_P1fwd_B3T = G4Translate3D(0, +BS_P1_Yhole, BS_P1fwd_DHalf);
869 G4Transform3D tfm_BS_P1fwd_B3B = G4Translate3D(0, -BS_P1_Yhole, BS_P1fwd_DHalf);
870
871 G4VSolid* geo_BS_P1fwd_V0 = new G4Box("geo_BS_P1fwd_V0", BS_P1_Xin, BS_P1_Yin, BS_P1fwd_DHalf);
872 G4Transform3D tfm_BS_P1fwd_V0 = G4Translate3D(0, 0, BS_P1fwd_DHalf);
873
874 G4VSolid* geo_BS_P1fwd_V1 = new G4Tubs("geo_BS_P1fwd_V1", 0, BS_P1_Rin, BS_P1fwd_DHalf, M_PI - BS_P1_Ain, 2 * BS_P1_Ain);
875 G4Transform3D tfm_BS_P1fwd_V1 = G4Translate3D(-BS_P1_RX, 0, BS_P1fwd_DHalf);
876
877 G4VSolid* geo_BS_P1fwd_V2 = new G4Tubs("geo_BS_P1fwd_V2", 0, BS_P1_Rin, BS_P1fwd_DHalf, 2 * M_PI - BS_P1_Ain, 2 * BS_P1_Ain);
878 G4Transform3D tfm_BS_P1fwd_V2 = G4Translate3D(+BS_P1_RX, 0, BS_P1fwd_DHalf);
879
880 double BS_P1fwd_V3_DHalf = (BS_fwdZ3 - BS_fwdZhole) / 2;
881 G4VSolid* geo_BS_P1fwd_V3 = new G4Tubs("geo_BS_P1fwd_V3", 0, BS_P1_Rhole, BS_P1fwd_V3_DHalf, 0, 2 * M_PI);
882 G4Transform3D tfm_BS_P1fwd_V3T = G4Translate3D(0, +BS_P1_Yhole, -BS_P1fwd_V3_DHalf + 2 * BS_P1fwd_DHalf);
883 G4Transform3D tfm_BS_P1fwd_V3B = G4Translate3D(0, -BS_P1_Yhole, -BS_P1fwd_V3_DHalf + 2 * BS_P1fwd_DHalf);
884
885 G4VSolid* geo_BS_P1fwd_V4 = new G4Box("geo_BS_P1fwd_V4", BS_P1_MillW / 2, 100, BS_P1_MillD1 / 2);
886 G4Transform3D tfm_BS_P1fwd_V4a = G4Translate3D(-BS_P1_MillX, 0, BS_P1_MillD1 / 2) * G4RotateZ3D(0.25 * M_PI);
887 G4Transform3D tfm_BS_P1fwd_V4b = G4Translate3D(-BS_P1_MillX, 0, BS_P1_MillD1 / 2) * G4RotateZ3D(0.75 * M_PI);
888
889 G4VSolid* geo_BS_P1fwd_V5 = new G4Box("geo_BS_P1fwd_V5", BS_P1_MillW / 2, 100, BS_P1_MillD2 / 2);
890 G4Transform3D tfm_BS_P1fwd_V5a = G4Translate3D(+BS_P1_MillX, 0, BS_P1_MillD2 / 2) * G4RotateZ3D(0.25 * M_PI);
891 G4Transform3D tfm_BS_P1fwd_V5b = G4Translate3D(+BS_P1_MillX, 0, BS_P1_MillD2 / 2) * G4RotateZ3D(0.75 * M_PI);
892
893 double BS_P1fwd_V67_DHalf = (BS_fwdZ3 - BS_fwdZcut) / 2;
894 double BS_P1fwd_V67_Pos = (BS_fwdZcut - BS_fwdZ2);
895 G4VSolid* geo_BS_P1fwd_V6 = new G4Box("geo_BS_P1fwd_V6", (BS_P1_XcutTR - BS_P1_XcutTL) / 2, 100, BS_P1fwd_V67_DHalf);
896 G4Transform3D tfm_BS_P1fwd_V6 = G4Translate3D((BS_P1_XcutTR + BS_P1_XcutTL) / 2, +100, BS_P1fwd_V67_DHalf + BS_P1fwd_V67_Pos);
897
898 G4VSolid* geo_BS_P1fwd_V7 = new G4Box("geo_BS_P1fwd_V7", (BS_P1_XcutBR - BS_P1_XcutBL) / 2, 100, BS_P1fwd_V67_DHalf);
899 G4Transform3D tfm_BS_P1fwd_V7 = G4Translate3D((BS_P1_XcutBR + BS_P1_XcutBL) / 2, -100, BS_P1fwd_V67_DHalf + BS_P1fwd_V67_Pos);
900
901
902 G4VSolid* geo_BS_P1fwd_Base = new G4DisplacedSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_B0, tfm_BS_P1fwd_B0);
903 geo_BS_P1fwd_Base = new G4UnionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_B1, tfm_BS_P1fwd_B1);
904 geo_BS_P1fwd_Base = new G4UnionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_B2, tfm_BS_P1fwd_B2);
905 geo_BS_P1fwd_Base = new G4UnionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_B3, tfm_BS_P1fwd_B3T);
906 geo_BS_P1fwd_Base = new G4UnionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_B3, tfm_BS_P1fwd_B3B);
907 geo_BS_P1fwd_Base = new G4SubtractionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_V0, tfm_BS_P1fwd_V0);
908 geo_BS_P1fwd_Base = new G4SubtractionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_V1, tfm_BS_P1fwd_V1);
909 geo_BS_P1fwd_Base = new G4SubtractionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_V2, tfm_BS_P1fwd_V2);
910 geo_BS_P1fwd_Base = new G4SubtractionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_V3, tfm_BS_P1fwd_V3T);
911 geo_BS_P1fwd_Base = new G4SubtractionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_V3, tfm_BS_P1fwd_V3B);
912 geo_BS_P1fwd_Base = new G4SubtractionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_V4, tfm_BS_P1fwd_V4a);
913 geo_BS_P1fwd_Base = new G4SubtractionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_V4, tfm_BS_P1fwd_V4b);
914 geo_BS_P1fwd_Base = new G4SubtractionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_V5, tfm_BS_P1fwd_V5a);
915 geo_BS_P1fwd_Base = new G4SubtractionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_V5, tfm_BS_P1fwd_V5b);
916 geo_BS_P1fwd_Base = new G4SubtractionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_V6, tfm_BS_P1fwd_V6);
917 geo_BS_P1fwd_Base = new G4SubtractionSolid("geo_BS_P1fwd_Base", geo_BS_P1fwd_Base, geo_BS_P1fwd_V7, tfm_BS_P1fwd_V7);
918
919 double BS_P1bwd_DHalf = -(BS_bwdZ3 - BS_bwdZ2) / 2;
920 G4VSolid* geo_BS_P1bwd_B0 = new G4Box("geo_BS_P1bwd_B0", BS_P1_Xout, BS_P1_Yout, BS_P1bwd_DHalf);
921 G4Transform3D tfm_BS_P1bwd_B0 = G4Translate3D(0, 0, BS_P1bwd_DHalf);
922
923 G4VSolid* geo_BS_P1bwd_B1 = new G4Tubs("geo_BS_P1bwd_B1", 0, BS_P1_Rout, BS_P1bwd_DHalf, M_PI - BS_P1_Aout, 2 * BS_P1_Aout);
924 G4Transform3D tfm_BS_P1bwd_B1 = G4Translate3D(-BS_P1_RX, 0, BS_P1bwd_DHalf);
925
926 G4VSolid* geo_BS_P1bwd_B2 = new G4Tubs("geo_BS_P1bwd_B2", 0, BS_P1_Rout, BS_P1bwd_DHalf, 2 * M_PI - BS_P1_Aout, 2 * BS_P1_Aout);
927 G4Transform3D tfm_BS_P1bwd_B2 = G4Translate3D(+BS_P1_RX, 0, BS_P1bwd_DHalf);
928
929 G4VSolid* geo_BS_P1bwd_B3 = new G4Tubs("geo_BS_P1bwd_B3", 0, BS_P1_Rbump, BS_P1bwd_DHalf, 0, 2 * M_PI);
930 G4Transform3D tfm_BS_P1bwd_B3T = G4Translate3D(0, +BS_P1_Yhole, BS_P1bwd_DHalf);
931 G4Transform3D tfm_BS_P1bwd_B3B = G4Translate3D(0, -BS_P1_Yhole, BS_P1bwd_DHalf);
932
933 G4VSolid* geo_BS_P1bwd_V0 = new G4Box("geo_BS_P1bwd_V0", BS_P1_Xin, BS_P1_Yin, BS_P1bwd_DHalf);
934 G4Transform3D tfm_BS_P1bwd_V0 = G4Translate3D(0, 0, BS_P1bwd_DHalf);
935
936 G4VSolid* geo_BS_P1bwd_V1 = new G4Tubs("geo_BS_P1bwd_V1", 0, BS_P1_Rin, BS_P1bwd_DHalf, M_PI - BS_P1_Ain, 2 * BS_P1_Ain);
937 G4Transform3D tfm_BS_P1bwd_V1 = G4Translate3D(-BS_P1_RX, 0, BS_P1bwd_DHalf);
938
939 G4VSolid* geo_BS_P1bwd_V2 = new G4Tubs("geo_BS_P1bwd_V2", 0, BS_P1_Rin, BS_P1bwd_DHalf, 2 * M_PI - BS_P1_Ain, 2 * BS_P1_Ain);
940 G4Transform3D tfm_BS_P1bwd_V2 = G4Translate3D(+BS_P1_RX, 0, BS_P1bwd_DHalf);
941
942 double BS_P1bwd_V3_DHalf = -(BS_bwdZ3 - BS_bwdZhole) / 2;
943 G4VSolid* geo_BS_P1bwd_V3 = new G4Tubs("geo_BS_P1bwd_V3", 0, BS_P1_Rhole, BS_P1bwd_V3_DHalf, 0, 2 * M_PI);
944 G4Transform3D tfm_BS_P1bwd_V3T = G4Translate3D(0, +BS_P1_Yhole, -BS_P1bwd_V3_DHalf + 2 * BS_P1bwd_DHalf);
945 G4Transform3D tfm_BS_P1bwd_V3B = G4Translate3D(0, -BS_P1_Yhole, -BS_P1bwd_V3_DHalf + 2 * BS_P1bwd_DHalf);
946
947 G4VSolid* geo_BS_P1bwd_V4 = new G4Box("geo_BS_P1bwd_V4", BS_P1_MillW / 2, 100, BS_P1_MillD1 / 2);
948 G4Transform3D tfm_BS_P1bwd_V4a = G4Translate3D(-BS_P1_MillX, 0, BS_P1_MillD1 / 2) * G4RotateZ3D(0.25 * M_PI);
949 G4Transform3D tfm_BS_P1bwd_V4b = G4Translate3D(-BS_P1_MillX, 0, BS_P1_MillD1 / 2) * G4RotateZ3D(0.75 * M_PI);
950
951 G4VSolid* geo_BS_P1bwd_V5 = new G4Box("geo_BS_P1bwd_V5", BS_P1_MillW / 2, 100, BS_P1_MillD2 / 2);
952 G4Transform3D tfm_BS_P1bwd_V5a = G4Translate3D(+BS_P1_MillX, 0, BS_P1_MillD2 / 2) * G4RotateZ3D(0.25 * M_PI);
953 G4Transform3D tfm_BS_P1bwd_V5b = G4Translate3D(+BS_P1_MillX, 0, BS_P1_MillD2 / 2) * G4RotateZ3D(0.75 * M_PI);
954
955 double BS_P1bwd_V67_DHalf = -(BS_bwdZ3 - BS_bwdZcut) / 2;
956 double BS_P1bwd_V67_Pos = -(BS_bwdZcut - BS_bwdZ2);
957 G4VSolid* geo_BS_P1bwd_V6 = new G4Box("geo_BS_P1bwd_V6", (BS_P1_XcutTR - BS_P1_XcutTL) / 2, 100, BS_P1bwd_V67_DHalf);
958 G4Transform3D tfm_BS_P1bwd_V6 = G4Translate3D((BS_P1_XcutTR + BS_P1_XcutTL) / 2, +100, BS_P1bwd_V67_DHalf + BS_P1bwd_V67_Pos);
959
960 G4VSolid* geo_BS_P1bwd_V7 = new G4Box("geo_BS_P1bwd_V7", (BS_P1_XcutBR - BS_P1_XcutBL) / 2, 100, BS_P1bwd_V67_DHalf);
961 G4Transform3D tfm_BS_P1bwd_V7 = G4Translate3D((BS_P1_XcutBR + BS_P1_XcutBL) / 2, -100, BS_P1bwd_V67_DHalf + BS_P1bwd_V67_Pos);
962
963
964 G4VSolid* geo_BS_P1bwd_Base = new G4DisplacedSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_B0, tfm_BS_P1bwd_B0);
965 geo_BS_P1bwd_Base = new G4UnionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_B1, tfm_BS_P1bwd_B1);
966 geo_BS_P1bwd_Base = new G4UnionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_B2, tfm_BS_P1bwd_B2);
967 geo_BS_P1bwd_Base = new G4UnionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_B3, tfm_BS_P1bwd_B3T);
968 geo_BS_P1bwd_Base = new G4UnionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_B3, tfm_BS_P1bwd_B3B);
969 geo_BS_P1bwd_Base = new G4SubtractionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_V0, tfm_BS_P1bwd_V0);
970 geo_BS_P1bwd_Base = new G4SubtractionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_V1, tfm_BS_P1bwd_V1);
971 geo_BS_P1bwd_Base = new G4SubtractionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_V2, tfm_BS_P1bwd_V2);
972 geo_BS_P1bwd_Base = new G4SubtractionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_V3, tfm_BS_P1bwd_V3T);
973 geo_BS_P1bwd_Base = new G4SubtractionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_V3, tfm_BS_P1bwd_V3B);
974 geo_BS_P1bwd_Base = new G4SubtractionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_V4, tfm_BS_P1bwd_V4a);
975 geo_BS_P1bwd_Base = new G4SubtractionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_V4, tfm_BS_P1bwd_V4b);
976 geo_BS_P1bwd_Base = new G4SubtractionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_V5, tfm_BS_P1bwd_V5a);
977 geo_BS_P1bwd_Base = new G4SubtractionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_V5, tfm_BS_P1bwd_V5b);
978 geo_BS_P1bwd_Base = new G4SubtractionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_V6, tfm_BS_P1bwd_V6);
979 geo_BS_P1bwd_Base = new G4SubtractionSolid("geo_BS_P1bwd_Base", geo_BS_P1bwd_Base, geo_BS_P1bwd_V7, tfm_BS_P1bwd_V7);
980
981 // Parameters for Base7/8 (FWD) Base23/24 (BWD)
982 double BS_P2_Rout = m_config.getParameter(prep + "P2_Rout") * unitFactor;
983 double BS_P2_Rin = m_config.getParameter(prep + "P2_Rin") * unitFactor;
984 double BS_P2_Xin = m_config.getParameter(prep + "P2_Xin") * unitFactor;
985 double BS_P2_Rhole = m_config.getParameter(prep + "P2_Rhole") * unitFactor;
986 double BS_P2_Yhole = m_config.getParameter(prep + "P2_Yhole") * unitFactor;
987 double BS_P2_XcutTL = m_config.getParameter(prep + "P2_XcutTL") * unitFactor;
988 double BS_P2_XcutTR = m_config.getParameter(prep + "P2_XcutTR") * unitFactor;
989 double BS_P2_XcutBL = m_config.getParameter(prep + "P2_XcutBL") * unitFactor;
990 double BS_P2_XcutBR = m_config.getParameter(prep + "P2_XcutBR") * unitFactor;
991
992 double BS_P2fwd_DHalf = (BS_fwdZ4 - BS_fwdZ3) / 2;
993 G4VSolid* geo_BS_P2fwd_B0 = new G4Tubs("geo_BS_P2fwd_B0", 0, BS_P2_Rout, BS_P2fwd_DHalf, 0, 2 * M_PI);
994 G4Transform3D tfm_BS_P2fwd_B0 = G4Translate3D(0, 0, BS_P2fwd_DHalf);
995
996 G4VSolid* geo_BS_P2fwd_V0 = new G4Box("geo_BS_P2fwd_V0", BS_P2_Xin, BS_P2_Rin, BS_P2fwd_DHalf);
997 G4Transform3D tfm_BS_P2fwd_V0 = G4Translate3D(0, 0, BS_P2fwd_DHalf);
998
999 G4VSolid* geo_BS_P2fwd_V1 = new G4Tubs("geo_BS_P2fwd_V1", 0, BS_P2_Rin, BS_P2fwd_DHalf, 0, 2 * M_PI);
1000 G4Transform3D tfm_BS_P2fwd_V1L = G4Translate3D(-BS_P2_Xin, 0, BS_P2fwd_DHalf);
1001 G4Transform3D tfm_BS_P2fwd_V1R = G4Translate3D(+BS_P2_Xin, 0, BS_P2fwd_DHalf);
1002
1003 G4VSolid* geo_BS_P2fwd_V2 = new G4Tubs("geo_BS_P2fwd_V2", 0, BS_P2_Rhole, BS_P2fwd_DHalf, 0, 2 * M_PI);
1004 G4Transform3D tfm_BS_P2fwd_V2T = G4Translate3D(0, +BS_P2_Yhole, BS_P2fwd_DHalf);
1005 G4Transform3D tfm_BS_P2fwd_V2B = G4Translate3D(0, -BS_P2_Yhole, BS_P2fwd_DHalf);
1006
1007 G4VSolid* geo_BS_P2fwd_V3 = new G4Box("geo_BS_P2fwd_V3", (BS_P2_XcutTR - BS_P2_XcutTL) / 2, 100, BS_P2fwd_DHalf);
1008 G4Transform3D tfm_BS_P2fwd_V3 = G4Translate3D((BS_P2_XcutTR + BS_P2_XcutTL) / 2, +100, BS_P2fwd_DHalf);
1009
1010 G4VSolid* geo_BS_P2fwd_V4 = new G4Box("geo_BS_P2fwd_V4", (BS_P2_XcutBR - BS_P2_XcutBL) / 2, 100, BS_P2fwd_DHalf);
1011 G4Transform3D tfm_BS_P2fwd_V4 = G4Translate3D((BS_P2_XcutBR + BS_P2_XcutBL) / 2, -100, BS_P2fwd_DHalf);
1012
1013 G4VSolid* geo_BS_P2fwd_Base = new G4DisplacedSolid("geo_BS_P2fwd_Base", geo_BS_P2fwd_B0, tfm_BS_P2fwd_B0);
1014 geo_BS_P2fwd_Base = new G4SubtractionSolid("geo_BS_P2fwd_Base", geo_BS_P2fwd_Base, geo_BS_P2fwd_V0, tfm_BS_P2fwd_V0);
1015 geo_BS_P2fwd_Base = new G4SubtractionSolid("geo_BS_P2fwd_Base", geo_BS_P2fwd_Base, geo_BS_P2fwd_V1, tfm_BS_P2fwd_V1L);
1016 geo_BS_P2fwd_Base = new G4SubtractionSolid("geo_BS_P2fwd_Base", geo_BS_P2fwd_Base, geo_BS_P2fwd_V1, tfm_BS_P2fwd_V1R);
1017 geo_BS_P2fwd_Base = new G4SubtractionSolid("geo_BS_P2fwd_Base", geo_BS_P2fwd_Base, geo_BS_P2fwd_V2, tfm_BS_P2fwd_V2T);
1018 geo_BS_P2fwd_Base = new G4SubtractionSolid("geo_BS_P2fwd_Base", geo_BS_P2fwd_Base, geo_BS_P2fwd_V2, tfm_BS_P2fwd_V2B);
1019 geo_BS_P2fwd_Base = new G4SubtractionSolid("geo_BS_P2fwd_Base", geo_BS_P2fwd_Base, geo_BS_P2fwd_V3, tfm_BS_P2fwd_V3);
1020 geo_BS_P2fwd_Base = new G4SubtractionSolid("geo_BS_P2fwd_Base", geo_BS_P2fwd_Base, geo_BS_P2fwd_V4, tfm_BS_P2fwd_V4);
1021
1022
1023 //++++ Assemble and place the FWD bellows shield ++++//
1024 G4Transform3D tfm_BS_fwdP1 = G4Translate3D(0, 0, BS_fwdZ2 - BS_fwdZ0);
1025 G4Transform3D tfm_BS_fwdP2 = G4Translate3D(0, 0, BS_fwdZ3 - BS_fwdZ0);
1026
1027 G4VSolid* geo_BS_fwd = geo_BS_fwdP0_Base;
1028 geo_BS_fwd = new G4UnionSolid("geo_BS_fwd", geo_BS_fwd, geo_BS_P1fwd_Base, tfm_BS_fwdP1);
1029 geo_BS_fwd = new G4UnionSolid("geo_BS_fwd", geo_BS_fwd, geo_BS_P2fwd_Base, tfm_BS_fwdP2);
1030
1031 G4LogicalVolume* logi_BS_fwd = new G4LogicalVolume(geo_BS_fwd, mat_BS, "logi_BS_fwd");
1032
1033 G4Transform3D tfm_BS_fwd = G4Translate3D(0, 0, BS_fwdZ0);
1034 new G4PVPlacement(tfm_BS_fwd, logi_BS_fwd, "phys_BS_fwd", &topVolume, false, 0);
1035 //++++ +++++++++++++++++++++++++++++++++++++++++++ ++++//
1036
1037 //++++ Assemble and place the BWD bellows shield ++++//
1038 G4Transform3D tfm_BS_bwdP1 = G4Translate3D(0, 0, BS_bwdZ2 - BS_bwdZ0) * G4RotateY3D(M_PI);
1039
1040 G4VSolid* geo_BS_bwd = geo_BS_bwdP0_Base;
1041 geo_BS_bwd = new G4UnionSolid("geo_BS_bwd", geo_BS_bwd, geo_BS_P1bwd_Base, tfm_BS_bwdP1);
1042
1043 G4LogicalVolume* logi_BS_bwd = new G4LogicalVolume(geo_BS_bwd, mat_BS, "logi_BS_bwd");
1044
1045 G4Transform3D tfm_BS_bwd = G4Translate3D(0, 0, BS_bwdZ0);
1046 new G4PVPlacement(tfm_BS_bwd, logi_BS_bwd, "phys_BS_bwd", &topVolume, false, 0);
1047 //++++ +++++++++++++++++++++++++++++++++++++++++++ ++++//
1048
1049
1050 //--------------
1051 //- Rest of elements with typical geometry
1052
1053 std::vector<std::string> straightSections;
1054 boost::split(straightSections, m_config.getParameterStr("Straight"), boost::is_any_of(" "));
1055 for (const auto& name : straightSections) {
1056 prep = name + ".";
1057
1058 CryostatElement polycone;
1059
1060 int N = int(m_config.getParameter(prep + "N"));
1061
1062 std::vector<double> Z(N);
1063 std::vector<double> R(N);
1064 std::vector<double> r(N);
1065
1066 for (int i = 0; i < N; ++i) {
1067 ostringstream ossZID;
1068 ossZID << "Z" << i;
1069
1070 ostringstream ossRID;
1071 ossRID << "R" << i;
1072
1073 ostringstream ossrID;
1074 ossrID << "r" << i;
1075
1076 Z[i] = m_config.getParameter(prep + ossZID.str()) * unitFactor;
1077 R[i] = m_config.getParameter(prep + ossRID.str()) * unitFactor;
1078 r[i] = m_config.getParameter(prep + ossrID.str(), 0.0) * unitFactor;
1079 }
1080
1081 polycone.transform = G4Translate3D(0.0, 0.0, 0.0);
1082
1083 //define geometry
1084 string motherVolume = m_config.getParameterStr(prep + "MotherVolume");
1085 string subtract = m_config.getParameterStr(prep + "Subtract", "");
1086 string intersect = m_config.getParameterStr(prep + "Intersect", "");
1087
1088 string geo_polyconexx_name = "geo_" + name + "xx_name";
1089 string geo_polyconex_name = "geo_" + name + "x_name";
1090 string geo_polycone_name = "geo_" + name + "_name";
1091
1092 G4VSolid* geo_polyconexx, *geo_polycone;
1093
1094 if (subtract != "" && intersect != "") {
1095 geo_polyconexx = new G4Polycone(geo_polyconexx_name, 0.0, 2 * M_PI, N, &(Z[0]), &(r[0]), &(R[0]));
1096 G4VSolid* geo_polyconex = new G4SubtractionSolid(geo_polyconex_name, geo_polyconexx, elements[subtract].geo,
1097 elements[motherVolume].transform.inverse()*polycone.transform.inverse()*elements[subtract].transform);
1098 geo_polycone = new G4IntersectionSolid(geo_polycone_name, geo_polyconex, elements[intersect].geo,
1099 elements[motherVolume].transform.inverse()*polycone.transform.inverse()*elements[intersect].transform);
1100 } else if (subtract != "") {
1101 geo_polyconexx = new G4Polycone(geo_polyconexx_name, 0.0, 2 * M_PI, N, &(Z[0]), &(r[0]), &(R[0]));
1102 geo_polycone = new G4SubtractionSolid(geo_polycone_name, geo_polyconexx, elements[subtract].geo,
1103 elements[motherVolume].transform.inverse()*polycone.transform.inverse()*elements[subtract].transform);
1104 } else if (intersect != "") {
1105 geo_polyconexx = new G4Polycone(geo_polyconexx_name, 0.0, 2 * M_PI, N, &(Z[0]), &(r[0]), &(R[0]));
1106 geo_polycone = new G4IntersectionSolid(geo_polycone_name, geo_polyconexx, elements[intersect].geo,
1107 elements[motherVolume].transform.inverse()*polycone.transform.inverse()*elements[intersect].transform);
1108 } else
1109 geo_polycone = new G4Polycone(geo_polycone_name, 0.0, 2 * M_PI, N, &(Z[0]), &(r[0]), &(R[0]));
1110
1111 polycone.geo = geo_polycone;
1112
1113 // define logical volume
1114 string strMat_polycone = m_config.getParameterStr(prep + "Material");
1115 G4Material* mat_polycone = Materials::get(strMat_polycone);
1116 string logi_polycone_name = "logi_" + name + "_name";
1117 polycone.logi = new G4LogicalVolume(polycone.geo, mat_polycone, logi_polycone_name);
1118 setColor(*polycone.logi, "#CC0000");
1119 setVisibility(*polycone.logi, false);
1120
1121 //put volume
1122 string phys_polycone_name = "phys_" + name + "_name";
1123 new G4PVPlacement(polycone.transform, polycone.logi, phys_polycone_name, elements[motherVolume].logi, false, 0);
1124
1125 //to use it later in "intersect" and "subtract"
1126 polycone.transform = polycone.transform * elements[motherVolume].transform;
1127
1128 elements[name] = polycone;
1129 }
1130
1131
1132 //--------------------------------------------------------------------------------------------
1133 //- Shields
1134
1135 std::vector<std::string> shields;
1136 boost::split(shields, m_config.getParameterStr("Shield"), boost::is_any_of(" "));
1137 for (const auto& name : shields) {
1138 prep = name + ".";
1139
1140 //- Shield made as box with optional subtracted box-shaped inner space (hole)
1141
1142 double shield_W = m_config.getParameter(prep + "W") * unitFactor;
1143 double shield_H = m_config.getParameter(prep + "H") * unitFactor;
1144 double shield_L = m_config.getParameter(prep + "L") * unitFactor;
1145 double shield_X0 = m_config.getParameter(prep + "X0") * unitFactor;
1146 double shield_Y0 = m_config.getParameter(prep + "Y0") * unitFactor;
1147 double shield_Z0 = m_config.getParameter(prep + "Z0") * unitFactor;
1148
1149 double shield_hole_W = m_config.getParameter(prep + "holeW", 0) * unitFactor;
1150 double shield_hole_H = m_config.getParameter(prep + "holeH", 0) * unitFactor;
1151 double shield_hole_L = m_config.getParameter(prep + "holeL", 0) * unitFactor;
1152 double shield_hole_dX = m_config.getParameter(prep + "holeDX", 0) * unitFactor;
1153 double shield_hole_dY = m_config.getParameter(prep + "holeDY", 0) * unitFactor;
1154 double shield_hole_dZ = m_config.getParameter(prep + "holeDZ", 0) * unitFactor;
1155
1156 double shield_PHI = m_config.getParameter(prep + "PHI");
1157
1158 // storable element
1159 CryostatElement shield;
1160
1161 shield.transform = G4Translate3D(shield_X0, shield_Y0, shield_Z0);
1162 shield.transform = shield.transform * G4RotateY3D(shield_PHI / Unit::rad);
1163
1164 G4Transform3D transform_shield_hole = G4Translate3D(shield_hole_dX, shield_hole_dY, shield_hole_dZ);
1165
1166 //define geometry
1167 string geo_shieldx_name = "geo_" + name + "x_name";
1168 string geo_shield_hole_name = "geo_" + name + "_hole_name";
1169 string geo_shield_name = "geo_" + name + "_name";
1170
1171 if (shield_hole_W == 0 || shield_hole_H == 0 || shield_hole_L == 0) {
1172 G4Box* geo_shield = new G4Box(geo_shield_name, shield_W / 2.0, shield_H / 2.0, shield_L / 2.0);
1173
1174 shield.geo = geo_shield;
1175 } else {
1176 G4Box* geo_shieldx = new G4Box(geo_shieldx_name, shield_W / 2.0, shield_H / 2.0, shield_L / 2.0);
1177 G4Box* geo_shield_hole = new G4Box(geo_shield_hole_name, shield_hole_W / 2.0, shield_hole_H / 2.0, shield_hole_L / 2.0);
1178 G4SubtractionSolid* geo_shield = new G4SubtractionSolid(geo_shield_name, geo_shieldx, geo_shield_hole,
1179 transform_shield_hole);
1180
1181 shield.geo = geo_shield;
1182 }
1183
1184 string strMat_shield = m_config.getParameterStr(prep + "Material");
1185 G4Material* mat_shield = Materials::get(strMat_shield);
1186
1187 string logi_shield_name = "logi_" + name + "_name";
1188 G4LogicalVolume* logi_shield = new G4LogicalVolume(shield.geo, mat_shield, logi_shield_name);
1189
1190 shield.logi = logi_shield;
1191
1192 //put volume
1193 setColor(*logi_shield, "#0000CC");
1194 //setVisibility(*logi_shield, false);
1195 string phys_shield_name = "phys_" + name + "_name";
1196 new G4PVPlacement(shield.transform, shield.logi, phys_shield_name, &topVolume, false, 0);
1197
1198 elements[name] = shield;
1199 }
1200
1201
1202 // RVC connection structure (simplified shape)
1203 G4Tubs* geo_rvcR = new G4Tubs("geo_rvcR", 60, 60 + 60, (620 - 560) / 2., 0, 2 * M_PI);
1204 G4LogicalVolume* logi_rvcR = new G4LogicalVolume(geo_rvcR, Materials::get("SUS316L"), "logi_rvcR_name");
1205 new G4PVPlacement(0, G4ThreeVector(0, 0, (620 + 560) / 2.), logi_rvcR, "phys_rvcR_name", &topVolume, false, 0);
1206
1207 G4Tubs* geo_rvcL = new G4Tubs("geo_rvcL", 60, 60 + 60, (-560 - (-620)) / 2., 0, 2 * M_PI);
1208 G4LogicalVolume* logi_rvcL = new G4LogicalVolume(geo_rvcL, Materials::get("SUS316L"), "logi_rvcL_name");
1209 new G4PVPlacement(0, G4ThreeVector(0, 0, (-620 - 560) / 2.), logi_rvcL, "phys_rvcL_name", &topVolume, false, 0);
1210
1211 // Added 10 Nov 2018
1212 // Elliptical inner surface around QC1LE
1213 G4EllipticalTube* geo_elp_QC1LEx = new G4EllipticalTube("geo_elp_QC1LEx", 10.5, 13.5, (-675 - (-1225)) / 2.); //in mm
1214 G4IntersectionSolid* geo_elp_QC1LE = new G4IntersectionSolid("geo_elp_QC1LE", elements["D2wal1"].geo, geo_elp_QC1LEx,
1215 G4Translate3D(0, 0, (-675 - 1225) / 2.));
1216 G4LogicalVolume* logi_elp_QC1LE = new G4LogicalVolume(geo_elp_QC1LE, Materials::get("Vacuum"), "logi_elp_QC1LE_name");
1217 new G4PVPlacement(0, G4ThreeVector(0, 0, 0), logi_elp_QC1LE, "phys_elp_QC1LE_name", elements["D2wal1"].logi, false, 0);
1218 // Elliptical inner surface around QC1LP
1219 G4EllipticalTube* geo_elp_QC1LPx = new G4EllipticalTube("geo_elp_QC1LPx", 10.5, 13.5, (-675 - (-1225)) / 2.); //in mm
1220 G4IntersectionSolid* geo_elp_QC1LP = new G4IntersectionSolid("geo_elp_QC1LP", elements["E2wal1"].geo, geo_elp_QC1LPx,
1221 G4Translate3D(0, 0, (-675 - 1225) / 2.));
1222 G4LogicalVolume* logi_elp_QC1LP = new G4LogicalVolume(geo_elp_QC1LP, Materials::get("Vacuum"), "logi_elp_QC1LP_name");
1223 new G4PVPlacement(0, G4ThreeVector(0, 0, 0), logi_elp_QC1LP, "phys_elp_QC1LP_name", elements["E2wal1"].logi, false, 0);
1224 // Elliptical inner surface around QC1RE
1225 G4EllipticalTube* geo_elp_QC1REx = new G4EllipticalTube("geo_elp_QC1REx", 10.5, 13.5, (1225 - 675) / 2.); //in mm
1226 G4IntersectionSolid* geo_elp_QC1RE = new G4IntersectionSolid("geo_elp_QC1RE", elements["A2wal1"].geo, geo_elp_QC1REx,
1227 G4Translate3D(0, 0, (1225 + 675) / 2.));
1228 G4LogicalVolume* logi_elp_QC1RE = new G4LogicalVolume(geo_elp_QC1RE, Materials::get("Vacuum"), "logi_elp_QC1RE_name");
1229 new G4PVPlacement(0, G4ThreeVector(0, 0, 0), logi_elp_QC1RE, "phys_elp_QC1RE_name", elements["A2wal1"].logi, false, 0);
1230 // Elliptical inner surface around QC1RP
1231 G4EllipticalTube* geo_elp_QC1RPx = new G4EllipticalTube("geo_elp_QC1RPx", 10.5, 13.5, (1225 - 675) / 2.); //in mm
1232 G4IntersectionSolid* geo_elp_QC1RP = new G4IntersectionSolid("geo_elp_QC1RP", elements["B2wal1"].geo, geo_elp_QC1RPx,
1233 G4Translate3D(0, 0, (1225 + 675) / 2.));
1234 G4LogicalVolume* logi_elp_QC1RP = new G4LogicalVolume(geo_elp_QC1RP, Materials::get("Vacuum"), "logi_elp_QC1RP_name");
1235 new G4PVPlacement(0, G4ThreeVector(0, 0, 0), logi_elp_QC1RP, "phys_elp_QC1RP_name", elements["B2wal1"].logi, false, 0);
1236
1237
1238
1239
1240 //--------------------------------------------------------------------------------------------
1241 //- 2023 QCS shielding
1242
1243 if (m_config.getParameter("polyBlock-R-L1.L", -1) > 0) {
1244 // earlyPhase3 = false; post LS1
1245
1246 std::vector<std::string> polyBlocks;
1247 boost::split(polyBlocks, m_config.getParameterStr("PolyBlock"), boost::is_any_of(" "));
1248 for (const auto& name : polyBlocks) {
1249 prep = name + ".";
1250 //string type = m_config.getParameterStr(prep + "type");
1251
1252 double block_L = m_config.getParameter(prep + "L") * unitFactor;
1253 double block_R = m_config.getParameter(prep + "R") * unitFactor;
1254 double block_r = m_config.getParameter(prep + "r") * unitFactor;
1255 double block_W = m_config.getParameter(prep + "W") * unitFactor;
1256 double block_w = m_config.getParameter(prep + "w") * unitFactor;
1257 double block_t = m_config.getParameter(prep + "t") * unitFactor;
1258 double block_Z0 = m_config.getParameter(prep + "Z0") * unitFactor;
1259 double block_dr = m_config.getParameter(prep + "dr", 0.0) * unitFactor;
1260 // Number of instances
1261 int block_N = int(m_config.getParameter(prep + "N"));
1262
1263 std::vector<double> block_PHIs(block_N);
1264 for (int i = 0; i < block_N; ++i) {
1265 ostringstream oss_block_num;
1266 oss_block_num << i;
1267 block_PHIs[i] = m_config.getParameter(prep + "PHI" + oss_block_num.str());
1268 }
1269
1270 // Box shaped cuts, if any
1271 double block_cut_L0 = m_config.getParameter(prep + "cutL0", 0.0) * unitFactor;
1272 double block_cut_L1 = m_config.getParameter(prep + "cutL1", 0.0) * unitFactor;
1273 int block_cut_N = 0;
1274 if (block_cut_L0 != 0.0 && block_cut_L1 != 0.0) {
1275 block_cut_N = 2;
1276 } else if (block_cut_L0 != 0.0 || block_cut_L1 != 0.0) {
1277 block_cut_N = 1;
1278 } else {
1279 block_cut_N = 0;
1280 }
1281
1282 //define geometry
1283 string geo_block_name;
1284 if (block_cut_N == 0) {
1285 geo_block_name = "geo_" + name + "_name";
1286 } else {
1287 geo_block_name = "geo_" + name + "_x_name";
1288 }
1289
1290 double block_T = sqrt((block_R - block_r) * (block_R - block_r) + (block_W - block_w) * (block_W - block_w) / 4.0);
1291
1292 int nSect = 5;
1293 std::vector<G4TwoVector> xy(nSect);
1294 xy[0].set(0.0, 0.0);
1295 xy[1].set(-block_T, (block_W - block_w) / 2.0);
1296 xy[2].set(-block_t, block_W / 2.0);
1297 xy[3].set(-block_T, (block_w + block_W) / 2.0);
1298 xy[4].set(0.0, block_W);
1299
1300 G4TwoVector offset1(block_dr, 0.0), offset2(0.0, 0.0);
1301 G4double scale1 = 1.0, scale2 = 1.0;
1302
1303 G4VSolid* geo_block = new G4ExtrudedSolid(geo_block_name, xy, block_L / 2.0, offset1, scale1, offset2, scale2);
1304
1305 for (int i = 0; i < block_cut_N; ++i) {
1306 ostringstream oss_block_num;
1307 oss_block_num << i;
1308
1309 if (i == block_cut_N - 1) {
1310 geo_block_name = "geo_" + name + "_name";
1311 } else {
1312 geo_block_name = "geo_" + name + "_x" + oss_block_num.str() + "_name";
1313 }
1314 string geo_cut_name = "geo_" + name + "_cut" + oss_block_num.str() + "_name";
1315
1316 double cut_L = m_config.getParameter(prep + "cutL" + oss_block_num.str()) * unitFactor;
1317 double cut_W = m_config.getParameter(prep + "cutW" + oss_block_num.str()) * unitFactor;
1318 double cut_H = m_config.getParameter(prep + "cutH" + oss_block_num.str()) * unitFactor;
1319
1320 G4VSolid* geo_cut = new G4Box(geo_cut_name, cut_W / 2.0, cut_H / 2.0, cut_L / 2.0);
1321
1322 double cut_X0 = m_config.getParameter(prep + "cutX0" + oss_block_num.str()) * unitFactor;
1323 double cut_Y0 = m_config.getParameter(prep + "cutY0" + oss_block_num.str()) * unitFactor;
1324 double cut_Z0 = m_config.getParameter(prep + "cutZ0" + oss_block_num.str()) * unitFactor;
1325 double cut_PHI = m_config.getParameter(prep + "cutPHI" + oss_block_num.str());
1326
1327 G4Transform3D cut_transform = G4Translate3D(cut_X0, cut_Y0, cut_Z0);
1328 cut_transform = cut_transform * G4RotateY3D(cut_PHI / Unit::rad);
1329
1330 geo_block = new G4SubtractionSolid(geo_block_name, geo_block, geo_cut, cut_transform);
1331 //geo_block = new G4UnionSolid(geo_block_name, geo_block, geo_cut, cut_transform);
1332 }
1333
1334 // logical volume
1335 string strMat_block = m_config.getParameterStr(prep + "Material");
1336 G4Material* mat_block = Materials::get(strMat_block);
1337
1338 string logi_block_name = "logi_" + name + "_name";
1339 G4LogicalVolume* logi_block = new G4LogicalVolume(geo_block, mat_block, logi_block_name);
1340
1341 //put volume
1342 setColor(*logi_block, "#00CC00");
1343 //setVisibility(*logi_block, false);
1344
1345 for (int i = 0; i < block_N; ++i) {
1346 // storable element
1347 CryostatElement block;
1348 block.geo = geo_block;
1349 block.logi = logi_block;
1350
1351 double block_PHI = block_PHIs[i];
1352 double block_X0 = block_R * cos(block_PHI);
1353 double block_Y0 = block_R * sin(block_PHI);
1354 double block_dPHI = asin(block_W / block_R / 2.0);
1355
1356 block.transform = G4Translate3D(block_X0, block_Y0, block_Z0);
1357 block.transform = block.transform * G4RotateZ3D((block_PHI + block_dPHI) / Unit::rad);
1358
1359 ostringstream oss_block_num;
1360 oss_block_num << i;
1361 string phys_block_name = "phys_" + name + "-" + oss_block_num.str() + "_name";
1362 new G4PVPlacement(block.transform, block.logi, phys_block_name, &topVolume, false, 0);
1363
1364 elements[name] = block;
1365 }
1366 }
1367
1368 std::vector<std::string> SWXLayers;
1369 boost::split(SWXLayers, m_config.getParameterStr("SWXLayer"), boost::is_any_of(" "));
1370 for (const auto& name : SWXLayers) {
1371 prep = name + ".";
1372 //string type = m_config.getParameterStr(prep + "type");
1373
1374 // storable element
1375 CryostatElement layer;
1376
1377 double layer_L = m_config.getParameter(prep + "L") * unitFactor;
1378 double layer_r1 = m_config.getParameter(prep + "r1") * unitFactor;
1379 double layer_r2 = m_config.getParameter(prep + "r2") * unitFactor;
1380 double layer_t = m_config.getParameter(prep + "t") * unitFactor;
1381 double layer_Z0 = m_config.getParameter(prep + "Z0") * unitFactor;
1382 int layer_cut_N = int(m_config.getParameter(prep + "N", 0));
1383
1384 layer.transform = G4Translate3D(0.0, 0.0, layer_Z0);
1385
1386 //define geometry
1387 string geo_layer_name;
1388 if (layer_cut_N == 0) {
1389 geo_layer_name = "geo_" + name + "_name";
1390 } else {
1391 geo_layer_name = "geo_" + name + "_x_name";
1392 }
1393
1394 G4VSolid* geo_layer = new G4Cons(geo_layer_name, layer_r1, layer_r1 + layer_t, layer_r2, layer_r2 + layer_t, layer_L / 2.0, 0.0,
1395 2.0 * M_PI);
1396
1397 for (int i = 0; i < layer_cut_N; ++i) {
1398 ostringstream oss_block_num;
1399 oss_block_num << i;
1400
1401 //string cut_type = m_config.getParameterStr(prep + "cutType" + oss_block_num.str());
1402 double cut_type = m_config.getParameter(prep + "cutType" + oss_block_num.str());
1403 if (i == layer_cut_N - 1) {
1404 geo_layer_name = "geo_" + name + "_name";
1405 } else {
1406 geo_layer_name = "geo_" + name + "_x" + oss_block_num.str() + "_name";
1407 }
1408 string geo_cut_name = "geo_" + name + "_cut" + oss_block_num.str() + "_name";
1409
1410 G4VSolid* geo_cut;
1411
1412 if (cut_type == 0.0) {
1413 double cut_L = m_config.getParameter(prep + "cutL" + oss_block_num.str()) * unitFactor;
1414 double cut_W = m_config.getParameter(prep + "cutW" + oss_block_num.str()) * unitFactor;
1415 double cut_H = m_config.getParameter(prep + "cutH" + oss_block_num.str()) * unitFactor;
1416
1417 geo_cut = new G4Box(geo_cut_name, cut_W / 2.0, cut_H / 2.0, cut_L / 2.0);
1418 } else {
1419 double cut_L = m_config.getParameter(prep + "cutL" + oss_block_num.str()) * unitFactor;
1420 double cut_R = m_config.getParameter(prep + "cutR" + oss_block_num.str()) * unitFactor;
1421
1422 geo_cut = new G4Tubs(geo_cut_name, 0.0, cut_R, cut_L / 2.0, 0.0, 2.0 * M_PI);
1423 }
1424
1425 double cut_X0 = m_config.getParameter(prep + "cutX0" + oss_block_num.str()) * unitFactor;
1426 double cut_Y0 = m_config.getParameter(prep + "cutY0" + oss_block_num.str()) * unitFactor;
1427 double cut_Z0 = m_config.getParameter(prep + "cutZ0" + oss_block_num.str()) * unitFactor;
1428 double cut_PHI = m_config.getParameter(prep + "cutPHI" + oss_block_num.str());
1429 double cut_TH = m_config.getParameter(prep + "cutTH" + oss_block_num.str());
1430
1431 G4Transform3D cut_transform = G4Translate3D(cut_X0, cut_Y0, cut_Z0);
1432 cut_transform = cut_transform * G4RotateY3D(cut_PHI / Unit::rad);
1433 cut_transform = cut_transform * G4RotateX3D(cut_TH / Unit::rad);
1434
1435 geo_layer = new G4SubtractionSolid(geo_layer_name, geo_layer, geo_cut, layer.transform.inverse()*cut_transform);
1436 //geo_layer = new G4UnionSolid(geo_layer_name, geo_layer, geo_cut, layer.transform.inverse()*cut_transform);
1437 }
1438
1439 layer.geo = geo_layer;
1440
1441 // logical volume
1442 string strMat_layer = m_config.getParameterStr(prep + "Material");
1443 G4Material* mat_layer = Materials::get(strMat_layer);
1444
1445 string logi_layer_name = "logi_" + name + "_name";
1446 G4LogicalVolume* logi_layer = new G4LogicalVolume(layer.geo, mat_layer, logi_layer_name);
1447 layer.logi = logi_layer;
1448
1449 //put volume
1450 setColor(*logi_layer, "#B100CC");
1451 //setVisibility(*logi_layer, false);
1452
1453 string phys_layer_name = "phys_" + name + "_name";
1454 new G4PVPlacement(layer.transform, layer.logi, phys_layer_name, &topVolume, false, 0);
1455
1456 // cppcheck-suppress unreadVariable
1457 elements[name] = layer;
1458 }
1459 }
1460
1461 //---------------------------
1462 // for dose simulation
1463 //---------------------------
1464
1465 /*
1466 logi_A1spc1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 101));
1467 logi_A1spc2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 102));
1468 logi_A2wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 103));
1469 logi_A3wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 104));
1470 logi_A3wal2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 105));
1471 logi_A4mag1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 106));
1472 logi_A4mag2p1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 107));
1473 logi_A4mag2p2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 108));
1474 logi_A4mag2p3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 109));
1475 logi_A4mag2p4 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 110));
1476 logi_A4mag3p1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 111));
1477 logi_A4mag3p2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 112));
1478 logi_A4mag4p1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 113));
1479 logi_A4mag4p2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 114));
1480 logi_A4mag4p3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 115));
1481 logi_A4mag4p4 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 116));
1482 logi_A4mag4p5 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 117));
1483 logi_A4mag4p6 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 118));
1484 logi_A4mag4p7 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 119));
1485 logi_A4mag4p8 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 120));
1486 logi_A4mag4p9 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 121));
1487 logi_B1spc1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 122));
1488 logi_B1spc2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 123));
1489 logi_B2wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 124));
1490 logi_B3wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 125));
1491 logi_B3wal2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 126));
1492 logi_B4mag1p1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 127));
1493 logi_B4mag1p2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 128));
1494 logi_B4mag1p3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 129));
1495 logi_B4mag2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 130));
1496 logi_B4mag3p1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 131));
1497 logi_B4mag3p2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 132));
1498 logi_B4mag3p3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 133));
1499 logi_B4mag3p4 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 134));
1500 logi_B4mag3p5 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 135));
1501 logi_B4mag3p6 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 136));
1502 logi_B4mag4p1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 137));
1503 logi_B4mag4p7 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 138));
1504 logi_B4mag4p8 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 139));
1505 logi_B4mag4p9 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 140));
1506 logi_C1wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 141));
1507 logi_C1wal2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 142));
1508 logi_C2spc1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 143));
1509 logi_C2spc2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 144));
1510 logi_C2spc3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 145));
1511 logi_C3wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 146));
1512 logi_C3wal2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 147));
1513 logi_C4spc1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 148));
1514 logi_C4spc2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 149));
1515 logi_C5wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 150));
1516 logi_C5wal2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 151));
1517 logi_C5wal3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 152));
1518 logi_C6spc1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 153));
1519 logi_C6spc2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 154));
1520 logi_C7wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 155));
1521 logi_C7lyr1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 156));
1522 logi_C7lyr2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 157));
1523 logi_C7lyr3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 158));
1524 logi_C7lyr4 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 159));
1525 logi_C7lyr5 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 160));
1526 logi_D1spc1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 161));
1527 logi_D2wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 162));
1528 logi_D3wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 163));
1529 logi_D3wal2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 164));
1530 logi_D4mag1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 165));
1531 logi_D4mag2p1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 166));
1532 logi_D4mag2p2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 167));
1533 logi_D4mag2p3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 168));
1534 logi_D4mag2p4 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 169));
1535 logi_D4mag3p1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 170));
1536 logi_D4mag3p2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 171));
1537 logi_D4mag3p3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 172));
1538 logi_D4mag3p4 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 173));
1539 logi_D4mag3p5 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 174));
1540 logi_D4mag3p6 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 175));
1541 logi_E1spc1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 176));
1542 logi_E2wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 177));
1543 logi_E3wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 178));
1544 logi_E4mag1p1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 179));
1545 logi_E4mag1p2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 180));
1546 logi_E4mag1p3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 181));
1547 logi_E4mag2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 182));
1548 logi_E4mag3p1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 183));
1549 logi_E4mag3p2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 184));
1550 logi_E4mag3p3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 185));
1551 logi_E4mag3p4 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 186));
1552 logi_E4mag3p5 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 187));
1553 logi_F1wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 188));
1554 logi_F1wal2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 189));
1555 logi_F2spc1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 190));
1556 logi_F2spc2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 191));
1557 logi_F2spc3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 192));
1558 logi_F3wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 193));
1559 logi_F3wal2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 194));
1560 logi_F3wal3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 195));
1561 logi_F4spc1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 196));
1562 logi_F5wal1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 197));
1563 logi_F6spc1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 198));
1564 logi_F7lyr1 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 199));
1565 logi_F7lyr2 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 200));
1566 logi_F7lyr3 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 201));
1567 logi_F7lyr4 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 202));
1568 logi_F7lyr5 ->SetSensitiveDetector(new BkgSensitiveDetector("IR", 203));
1569 */
1570 }
double R
typedef autogenerated by FFTW
double sqrt(double a)
sqrt for double
Definition beamHelpers.h:28
int intersect(const TRGCDCLpar &lp1, const TRGCDCLpar &lp2, CLHEP::HepVector &v1, CLHEP::HepVector &v2)
intersection
Definition Lpar.cc:249
void setVisibility(G4LogicalVolume &volume, bool visible)
Helper function to quickly set the visibility of a given volume.
Definition utilities.cc:108
void setColor(G4LogicalVolume &volume, const std::string &color)
Set the color of a logical volume.
Definition utilities.cc:100

◆ createPayloads()

virtual void createPayloads ( const GearDir & content,
const IntervalOfValidity & iov )
inlineoverridevirtual

creates DB payload for CryostatGeo class

Reimplemented from CreatorBase.

Definition at line 95 of file GeoCryostatCreator.h.

96 {
97 DBImportObjPtr<CryostatGeo> importObj;
98 importObj.construct(createConfiguration(content));
99 importObj.import(iov);
100 }

Member Data Documentation

◆ m_config

CryostatGeo m_config
protected

geometry parameters object

Definition at line 118 of file GeoCryostatCreator.h.

◆ m_sensitive

SensitiveDetector* m_sensitive
protected

Sensitive detector.

Definition at line 117 of file GeoCryostatCreator.h.


The documentation for this class was generated from the following files: