77 double stepMax = 5.0 *
Unit::mm * unitFactor;
78 int flag_limitStep = int(
m_config.getParameter(
"LimitStepLength"));
82 map<string, FarBeamLineElement> elements;
94 std::string prep =
"TubeR.";
96 int TubeR_N = int(
m_config.getParameter(prep +
"N"));
98 std::vector<double> TubeR_Z(TubeR_N);
99 std::vector<double> TubeR_R(TubeR_N);
100 std::vector<double> TubeR_r(TubeR_N);
102 for (
int i = 0; i < TubeR_N; ++i) {
103 ostringstream ossZID;
106 ostringstream ossRID;
109 ostringstream ossrID;
112 TubeR_Z[i] =
m_config.getParameter(prep + ossZID.str()) * unitFactor;
113 TubeR_R[i] =
m_config.getParameter(prep + ossRID.str()) * unitFactor;
114 TubeR_r[i] =
m_config.getParameter(prep + ossrID.str(), 0.0) * unitFactor;
117 tubeR.
transform = G4Translate3D(0.0, 0.0, 0.0);
120 tubeR.
geo =
new G4Polycone(
"geo_TubeR_name", 0.0, 2 * M_PI, TubeR_N, &(TubeR_Z[0]), &(TubeR_r[0]), &(TubeR_R[0]));
124 elements[
"TubeR"] = tubeR;
134 int TubeL_N = int(
m_config.getParameter(prep +
"N"));
136 std::vector<double> TubeL_Z(TubeL_N);
137 std::vector<double> TubeL_R(TubeL_N);
138 std::vector<double> TubeL_r(TubeL_N);
140 for (
int i = 0; i < TubeL_N; ++i) {
141 ostringstream ossZID;
144 ostringstream ossRID;
147 ostringstream ossrID;
150 TubeL_Z[i] =
m_config.getParameter(prep + ossZID.str()) * unitFactor;
151 TubeL_R[i] =
m_config.getParameter(prep + ossRID.str()) * unitFactor;
152 TubeL_r[i] =
m_config.getParameter(prep + ossrID.str(), 0.0) * unitFactor;
155 tubeL.
transform = G4Translate3D(0.0, 0.0, 0.0);
158 tubeL.
geo =
new G4Polycone(
"geo_TubeL_name", 0.0, 2 * M_PI, TubeL_N, &(TubeL_Z[0]), &(TubeL_r[0]), &(TubeL_R[0]));
162 elements[
"TubeL"] = tubeL;
164 std::vector<double> zero_r(N, 0.);
166 std::vector<std::string> straightSections;
167 boost::split(straightSections,
m_config.getParameterStr(
"Straight"), boost::is_any_of(
" "));
168 for (
const auto& name : straightSections) {
173 string type =
m_config.getParameterStr(prep +
"type");
178 std::vector<double> Polycone_Z(N);
179 std::vector<double> Polycone_R(N);
180 std::vector<double> Polycone_r(N);
182 Polycone_Z[1] =
m_config.getParameter(prep +
"L") * unitFactor;
183 Polycone_R[0] =
m_config.getParameter(prep +
"R") * unitFactor;
184 Polycone_R[1] =
m_config.getParameter(prep +
"R") * unitFactor;
185 Polycone_r[0] =
m_config.getParameter(prep +
"r") * unitFactor;
186 Polycone_r[1] =
m_config.getParameter(prep +
"r") * unitFactor;
188 double Polycone_X0 =
m_config.getParameter(prep +
"X0") * unitFactor;
189 double Polycone_Y0 =
m_config.getParameter(prep +
"Y0", 0) * unitFactor;
190 double Polycone_Z0 =
m_config.getParameter(prep +
"Z0") * unitFactor;
191 double Polycone_PHI =
m_config.getParameter(prep +
"PHI");
192 double Polycone_PHIYZ =
m_config.getParameter(prep +
"PHIYZ", 0);
194 polycone.
transform = G4Translate3D(Polycone_X0, Polycone_Y0, Polycone_Z0);
196 if (Polycone_PHIYZ != 0)
200 string subtract =
m_config.getParameterStr(prep +
"Subtract",
"");
203 string geo_polyconexx_name =
"geo_" + name +
"xx_name";
204 string geo_polyconex_name =
"geo_" + name +
"x_name";
205 string geo_polycone_name =
"geo_" + name +
"_name";
207 G4VSolid* geo_polyconexx(NULL), *geo_polycone(NULL);
211 geo_polyconexx =
new G4Polycone(geo_polyconexx_name, 0.0, 2 * M_PI, N, &(Polycone_Z[0]), &(zero_r[0]), &(Polycone_R[0]));
213 geo_polyconexx =
new G4Polycone(geo_polyconexx_name, 0.0, 2 * M_PI, N, &(Polycone_Z[0]), &(Polycone_r[0]), &(Polycone_R[0]));
214 else if (type ==
"pipe")
215 geo_polycone =
new G4Polycone(geo_polycone_name, 0.0, 2 * M_PI, N, &(Polycone_Z[0]), &(zero_r[0]), &(Polycone_R[0]));
217 geo_polycone =
new G4Polycone(geo_polycone_name, 0.0, 2 * M_PI, N, &(Polycone_Z[0]), &(Polycone_r[0]), &(Polycone_R[0]));
221 G4VSolid* geo_polyconex =
new G4SubtractionSolid(geo_polyconex_name, geo_polyconexx, elements[subtract].geo,
222 polycone.
transform.inverse()*elements[subtract].transform);
223 geo_polycone =
new G4IntersectionSolid(geo_polycone_name, geo_polyconex, elements[
intersect].geo,
225 }
else if (subtract !=
"")
226 geo_polycone =
new G4SubtractionSolid(geo_polycone_name, geo_polyconexx, elements[subtract].geo,
227 polycone.
transform.inverse()*elements[subtract].transform);
229 geo_polycone =
new G4IntersectionSolid(geo_polycone_name, geo_polyconexx, elements[
intersect].geo,
232 polycone.
geo = geo_polycone;
235 string strMat_polycone =
m_config.getParameterStr(prep +
"Material");
237 string logi_polycone_name =
"logi_" + name +
"_name";
238 G4LogicalVolume* logi_polycone =
new G4LogicalVolume(polycone.
geo, mat_polycone, logi_polycone_name);
239 setColor(*logi_polycone,
"#CC0000");
242 polycone.
logi = logi_polycone;
245 string phys_polycone_name =
"phys_" + name +
"_name";
246 new G4PVPlacement(polycone.
transform, logi_polycone, phys_polycone_name, &topVolume,
false, 0);
248 elements[name] = polycone;
251 for (
int i = 0; i < N; ++i)
252 sum += Polycone_r[i];
253 if (type ==
"pipe" && sum != 0) {
257 string nameVac = name +
"Vac";
260 string geo_vacuumxx_name =
"geo_" + nameVac +
"xx_name";
261 string geo_vacuum_name =
"geo_" + nameVac +
"_name";
263 G4VSolid* geo_vacuumxx, *geo_vacuum;
265 geo_vacuumxx =
new G4Polycone(geo_vacuumxx_name, 0.0, 2 * M_PI, N, &(Polycone_Z[0]), &(zero_r[0]), &(Polycone_r[0]));
266 geo_vacuum =
new G4IntersectionSolid(geo_vacuumxx_name, geo_vacuumxx, geo_polycone);
268 vacuum.
geo = geo_vacuum;
273 string logi_vacuum_name =
"logi_" + nameVac +
"_name";
274 G4LogicalVolume* logi_vacuum =
new G4LogicalVolume(vacuum.
geo, mat_vacuum, logi_vacuum_name);
275 if (flag_limitStep) logi_vacuum->SetUserLimits(
new G4UserLimits(stepMax));
279 vacuum.
logi = logi_vacuum;
282 string phys_vacuum_name =
"phys_" + nameVac +
"_name";
284 new G4PVPlacement(0, G4ThreeVector(0, 0, 0), logi_vacuum, phys_vacuum_name, logi_polycone,
false, 0);
286 elements[nameVac] = vacuum;
291 std::vector<std::string> bendingSections;
292 boost::split(bendingSections,
m_config.getParameterStr(
"Bending"), boost::is_any_of(
" "));
293 for (
const auto& name : bendingSections) {
298 string type =
m_config.getParameterStr(prep +
"type");
302 double torus_r =
m_config.getParameter(prep +
"r") * unitFactor;
303 double torus_R =
m_config.getParameter(prep +
"R") * unitFactor;
304 double torus_RT =
m_config.getParameter(prep +
"RT") * unitFactor;
305 double torus_X0 =
m_config.getParameter(prep +
"X0") * unitFactor;
306 double torus_Z0 =
m_config.getParameter(prep +
"Z0") * unitFactor;
307 double torus_SPHI =
m_config.getParameter(prep +
"SPHI");
308 double torus_DPHI =
m_config.getParameter(prep +
"DPHI");
310 torus.
transform = G4Translate3D(torus_X0, 0.0, torus_Z0);
314 string subtract =
m_config.getParameterStr(prep +
"Subtract",
"");
317 string geo_torusxx_name =
"geo_" + name +
"xx_name";
318 string geo_torusx_name =
"geo_" + name +
"x_name";
319 string geo_torus_name =
"geo_" + name +
"_name";
321 G4VSolid* geo_torus(NULL);
324 G4VSolid* geo_torusxx(NULL);
326 geo_torusxx =
new G4Torus(geo_torusxx_name, 0, torus_R, torus_RT, torus_SPHI, torus_DPHI);
328 geo_torusxx =
new G4Torus(geo_torusxx_name, torus_r, torus_R, torus_RT, torus_SPHI, torus_DPHI);
330 G4VSolid* geo_torusx =
new G4SubtractionSolid(geo_torusx_name, geo_torusxx, elements[subtract].geo,
331 torus.
transform.inverse()*elements[subtract].transform);
332 geo_torus =
new G4IntersectionSolid(geo_torus_name, geo_torusx, elements[
intersect].geo,
334 }
else if (subtract !=
"")
335 geo_torus =
new G4SubtractionSolid(geo_torus_name, geo_torusxx, elements[subtract].geo,
336 torus.
transform.inverse()*elements[subtract].transform);
338 geo_torus =
new G4IntersectionSolid(geo_torus_name, geo_torusxx, elements[
intersect].geo,
340 }
else if (type ==
"pipe")
341 geo_torus =
new G4Torus(geo_torus_name, 0, torus_R, torus_RT, torus_SPHI, torus_DPHI);
343 geo_torus =
new G4Torus(geo_torus_name, torus_r, torus_R, torus_RT, torus_SPHI, torus_DPHI);
345 torus.
geo = geo_torus;
348 string strMat_torus =
m_config.getParameterStr(prep +
"Material");
350 string logi_torus_name =
"logi_" + name +
"_name";
351 G4LogicalVolume* logi_torus =
new G4LogicalVolume(torus.
geo, mat_torus, logi_torus_name);
355 torus.
logi = logi_torus;
358 string phys_torus_name =
"phys_" + name +
"_name";
359 new G4PVPlacement(torus.
transform, logi_torus, phys_torus_name, &topVolume,
false, 0);
361 elements[name] = torus;
363 if (type ==
"pipe" && torus_r != 0) {
367 string nameVac = name +
"Vac";
370 string geo_vacuumxx_name =
"geo_" + nameVac +
"xx_name";
371 string geo_vacuum_name =
"geo_" + nameVac +
"_name";
373 G4VSolid* geo_vacuumxx, *geo_vacuum;
375 geo_vacuumxx =
new G4Torus(geo_vacuumxx_name, 0.0, torus_r, torus_RT, torus_SPHI, torus_DPHI);
376 geo_vacuum =
new G4IntersectionSolid(geo_vacuum_name, geo_vacuumxx, geo_torus);
378 vacuum.
geo = geo_vacuum;
383 string logi_vacuum_name =
"logi_" + nameVac +
"_name";
384 G4LogicalVolume* logi_vacuum =
new G4LogicalVolume(vacuum.
geo, mat_vacuum, logi_vacuum_name);
385 if (flag_limitStep) logi_vacuum->SetUserLimits(
new G4UserLimits(stepMax));
389 vacuum.
logi = logi_vacuum;
392 string phys_vacuum_name =
"phys_" + nameVac +
"_name";
394 new G4PVPlacement(0, G4ThreeVector(0, 0, 0), logi_vacuum, phys_vacuum_name, logi_torus,
false, 0);
396 elements[nameVac] = vacuum;
404 std::vector<std::string> shields;
405 boost::split(shields,
m_config.getParameterStr(
"Shield"), boost::is_any_of(
" "));
406 for (
const auto& name : shields) {
411 double shield_W =
m_config.getParameter(prep +
"W") * unitFactor;
412 double shield_H =
m_config.getParameter(prep +
"H") * unitFactor;
413 double shield_L =
m_config.getParameter(prep +
"L") * unitFactor;
414 double shield_X0 =
m_config.getParameter(prep +
"X0") * unitFactor;
415 double shield_Y0 =
m_config.getParameter(prep +
"Y0") * unitFactor;
416 double shield_Z0 =
m_config.getParameter(prep +
"Z0") * unitFactor;
418 double shield_hole_W =
m_config.getParameter(prep +
"holeW", 0) * unitFactor;
419 double shield_hole_H =
m_config.getParameter(prep +
"holeH", 0) * unitFactor;
420 double shield_hole_L =
m_config.getParameter(prep +
"holeL", 0) * unitFactor;
421 double shield_hole_dX =
m_config.getParameter(prep +
"holeDX", 0) * unitFactor;
422 double shield_hole_dY =
m_config.getParameter(prep +
"holeDY", 0) * unitFactor;
423 double shield_hole_dZ =
m_config.getParameter(prep +
"holeDZ", 0) * unitFactor;
425 double shield_PHI =
m_config.getParameter(prep +
"PHI");
430 shield.
transform = G4Translate3D(shield_X0, shield_Y0, shield_Z0);
433 G4Transform3D transform_shield_hole = G4Translate3D(shield_hole_dX, shield_hole_dY, shield_hole_dZ);
436 string geo_shieldx_name =
"geo_" + name +
"x_name";
437 string geo_shield_hole_name =
"geo_" + name +
"_hole_name";
438 string geo_shield_name =
"geo_" + name +
"_name";
440 if (shield_hole_W == 0 || shield_hole_H == 0 || shield_hole_L == 0) {
441 G4Box* geo_shield =
new G4Box(geo_shield_name, shield_W / 2.0, shield_H / 2.0, shield_L / 2.0);
443 shield.
geo = geo_shield;
445 G4Box* geo_shieldx =
new G4Box(geo_shieldx_name, shield_W / 2.0, shield_H / 2.0, shield_L / 2.0);
446 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);
447 G4SubtractionSolid* geo_shield =
new G4SubtractionSolid(geo_shield_name, geo_shieldx, geo_shield_hole,
448 transform_shield_hole);
450 shield.
geo = geo_shield;
453 string strMat_shield =
m_config.getParameterStr(prep +
"Material");
456 string logi_shield_name =
"logi_" + name +
"_name";
457 G4LogicalVolume* logi_shield =
new G4LogicalVolume(shield.
geo, mat_shield, logi_shield_name);
459 shield.
logi = logi_shield;
464 string phys_shield_name =
"phys_" + name +
"_name";
465 new G4PVPlacement(shield.
transform, shield.
logi, phys_shield_name, &topVolume,
false, 0);
467 elements[name] = shield;
475 G4Tubs* geo_Tube =
new G4Tubs(
"geo_Tube_name", 3995 * CLHEP::mm, 4000 * CLHEP::mm, 29 * CLHEP::m, 0. * CLHEP::deg, 360.*CLHEP::deg);
477 G4LogicalVolume* logi_Tube =
new G4LogicalVolume(geo_Tube, mat_Tube,
"logi_Tube_name");
482 bool radiation_study =
false;
484 if (radiation_study && elements.count(
"GateShieldL")) {
485 new G4PVPlacement(elements[
"GateShieldL"].transform, logi_Tube,
"phys_Tube_name", &topVolume,
false, 0);
494 if (radiation_study) {
496 if (elements.count(
"PolyShieldL"))
498 if (elements.count(
"PolyShieldR"))
502 if (elements.count(
"ConcreteShieldL"))
504 if (elements.count(
"ConcreteShieldR"))
508 if (elements.count(
"GateShieldL"))
510 if (elements.count(
"GateShieldR"))
521 std::vector<std::string> collimators;
522 boost::split(collimators,
m_config.getParameterStr(
"Collimator"), boost::is_any_of(
" "));
523 for (
const auto& name : collimators) {
529 string type =
m_config.getParameterStr(prep +
"type");
530 string motherVolume =
m_config.getParameterStr(prep +
"MotherVolume");
531 string motherVolumeVacuum = motherVolume +
"Vac";
536 G4Translate3D translation;
537 elements[motherVolumeVacuum].transform.getDecomposition(scale, rotation, translation);
538 double zz = rotation.zz();
542 double collimator_d1 =
m_config.getParameter(prep +
"d1") * unitFactor;
543 double collimator_d2 =
m_config.getParameter(prep +
"d2") * unitFactor;
544 double collimator_fullH =
m_config.getParameter(prep +
"fullH") * unitFactor;
545 double collimator_headH =
m_config.getParameter(prep +
"headH") * unitFactor;
546 double collimator_minW =
m_config.getParameter(prep +
"minW") * unitFactor;
547 double collimator_maxW =
m_config.getParameter(prep +
"maxW") * unitFactor;
548 double collimator_th =
m_config.getParameter(prep +
"th") * unitFactor;
549 double collimator_Z =
m_config.getParameter(prep +
"Z") * unitFactor;
551 B2WARNING(
"Collimator " << name <<
" displacement d1 is set to " << collimator_d1 <<
"mm (must be negative)");
552 B2WARNING(
"Collimator " << name <<
" displacement d2 is set to " << collimator_d2 <<
"mm (must be positive)");
562 double head_dz = collimator_headH / 2.0;
563 if (type ==
"vertical") {
564 head_dx1 = collimator_th / 2.0;
565 head_dx2 = collimator_th / 2.0;
566 head_dy1 = ((collimator_maxW - collimator_minW) * collimator_headH / collimator_fullH + collimator_minW) / 2.0;
567 head_dy2 = collimator_minW / 2.0;
569 head_dx1 = ((collimator_maxW - collimator_minW) * collimator_headH / collimator_fullH + collimator_minW) / 2.0;
570 head_dx2 = collimator_minW / 2.0;
571 head_dy1 = collimator_th / 2.0;
572 head_dy2 = collimator_th / 2.0;
580 G4Transform3D transform_head1 = G4Translate3D(0.0, 0.0, collimator_Z);
581 G4Transform3D transform_head2 = G4Translate3D(0.0, 0.0, collimator_Z);
584 if (type ==
"vertical") {
585 transform_head1 = transform_head1 * G4Translate3D(0.0, -head_dz + collimator_d1, 0.0);
586 transform_head1 = transform_head1 * G4RotateX3D(-M_PI / 2 /
Unit::rad);
588 transform_head2 = transform_head2 * G4Translate3D(0.0, head_dz + collimator_d2, 0.0);
589 transform_head2 = transform_head2 * G4RotateX3D(M_PI / 2 /
Unit::rad);
592 transform_head1 = transform_head1 * G4Translate3D(-head_dz + collimator_d1, 0.0, 0.0);
593 transform_head1 = transform_head1 * G4RotateY3D(M_PI / 2 /
Unit::rad);
595 transform_head2 = transform_head2 * G4Translate3D(head_dz + collimator_d2, 0.0, 0.0);
596 transform_head2 = transform_head2 * G4RotateY3D(-M_PI / 2 /
Unit::rad);
598 transform_head1 = transform_head1 * G4Translate3D(head_dz - collimator_d1, 0.0, 0.0);
599 transform_head1 = transform_head1 * G4RotateY3D(-M_PI / 2 /
Unit::rad);
601 transform_head2 = transform_head2 * G4Translate3D(-head_dz - collimator_d2, 0.0, 0.0);
602 transform_head2 = transform_head2 * G4RotateY3D(M_PI / 2 /
Unit::rad);
606 collimator_head1.
transform = transform_head1;
607 collimator_head2.
transform = transform_head2;
610 string geo_headx_name =
"geo_" + name +
"_headx_name";
612 string geo_head1_name =
"geo_" + name +
"_head1_name";
613 string geo_head2_name =
"geo_" + name +
"_head2_name";
615 G4VSolid* geo_headx =
new G4Trd(geo_headx_name, head_dx1, head_dx2, head_dy1, head_dy2, head_dz);
617 G4VSolid* geo_head1 =
new G4IntersectionSolid(geo_head1_name, geo_headx, elements[motherVolumeVacuum].geo,
619 G4VSolid* geo_head2 =
new G4IntersectionSolid(geo_head2_name, geo_headx, elements[motherVolumeVacuum].geo,
622 collimator_head1.
geo = geo_head1;
623 collimator_head2.
geo = geo_head2;
626 string strMat_head =
m_config.getParameterStr(prep +
"HeadMaterial");
628 string logi_head1_name =
"logi_" + name +
"_head1_name";
629 string logi_head2_name =
"logi_" + name +
"_head2_name";
630 G4LogicalVolume* logi_head1 =
new G4LogicalVolume(geo_head1, mat_head, logi_head1_name);
631 G4LogicalVolume* logi_head2 =
new G4LogicalVolume(geo_head2, mat_head, logi_head2_name);
638 double volume_head1 = logi_head1->GetSolid()->GetCubicVolume();
639 double volume_head2 = logi_head2->GetSolid()->GetCubicVolume();
641 collimator_head1.
logi = logi_head1;
642 collimator_head2.
logi = logi_head2;
645 string phys_head1_name =
"phys_" + name +
"_head1" +
"_name";
646 string phys_head2_name =
"phys_" + name +
"_head2" +
"_name";
647 if (volume_head1 != 0)
648 new G4PVPlacement(collimator_head1.
transform, logi_head1, phys_head1_name, elements[motherVolumeVacuum].logi,
false, 0);
649 if (volume_head2 != 0)
650 new G4PVPlacement(collimator_head2.
transform, logi_head2, phys_head2_name, elements[motherVolumeVacuum].logi,
false, 0);
653 collimator_head1.
transform = collimator_head1.
transform * elements[motherVolumeVacuum].transform;
654 collimator_head2.
transform = collimator_head2.
transform * elements[motherVolumeVacuum].transform;
656 string name_head1 = name +
"_head1";
657 string name_head2 = name +
"_head2";
658 elements[name_head1] = collimator_head1;
659 elements[name_head2] = collimator_head2;
669 double body_dz = (collimator_fullH - collimator_headH) / 2.0;
670 if (type ==
"vertical") {
671 body_dx1 = collimator_th / 2.0;
672 body_dx2 = collimator_th / 2.0;
673 body_dy1 = collimator_maxW / 2.0;
674 body_dy2 = ((collimator_maxW - collimator_minW) * collimator_headH / collimator_fullH + collimator_minW) / 2.0;
676 body_dx1 = collimator_maxW / 2.0;
677 body_dx2 = ((collimator_maxW - collimator_minW) * collimator_headH / collimator_fullH + collimator_minW) / 2.0;
678 body_dy1 = collimator_th / 2.0;
679 body_dy2 = collimator_th / 2.0;
687 if (type ==
"vertical") {
688 collimator_body1.
transform = G4Translate3D(0.0, -head_dz - body_dz, 0.0) * transform_head1;
689 collimator_body2.
transform = G4Translate3D(0.0, head_dz + body_dz, 0.0) * transform_head2;
692 collimator_body1.
transform = G4Translate3D(-head_dz - body_dz, 0.0, 0.0) * transform_head1;
693 collimator_body2.
transform = G4Translate3D(head_dz + body_dz, 0.0, 0.0) * transform_head2;
695 collimator_body1.
transform = G4Translate3D(head_dz + body_dz, 0.0, 0.0) * transform_head1;
696 collimator_body2.
transform = G4Translate3D(-head_dz - body_dz, 0.0, 0.0) * transform_head2;
701 string geo_bodyx_name =
"geo_" + name +
"_bodyx_name";
703 string geo_body1_name =
"geo_" + name +
"_body1_name";
704 string geo_body2_name =
"geo_" + name +
"_body2_name";
706 G4VSolid* geo_bodyx =
new G4Trd(geo_bodyx_name, body_dx1, body_dx2, body_dy1, body_dy2, body_dz);
708 G4VSolid* geo_body1 =
new G4IntersectionSolid(geo_body1_name, geo_bodyx, elements[motherVolumeVacuum].geo,
710 G4VSolid* geo_body2 =
new G4IntersectionSolid(geo_body2_name, geo_bodyx, elements[motherVolumeVacuum].geo,
713 collimator_body1.
geo = geo_body1;
714 collimator_body2.
geo = geo_body2;
717 string strMat_body =
m_config.getParameterStr(prep +
"Material");
719 string logi_body1_name =
"logi_" + name +
"_body1_name";
720 string logi_body2_name =
"logi_" + name +
"_body2_name";
721 G4LogicalVolume* logi_body1 =
new G4LogicalVolume(geo_body1, mat_body, logi_body1_name);
722 G4LogicalVolume* logi_body2 =
new G4LogicalVolume(geo_body2, mat_body, logi_body2_name);
729 double volume_body1 = logi_body1->GetSolid()->GetCubicVolume();
730 double volume_body2 = logi_body2->GetSolid()->GetCubicVolume();
732 collimator_body1.
logi = logi_body1;
733 collimator_body2.
logi = logi_body2;
736 string phys_body1_name =
"phys_" + name +
"_body1" +
"_name";
737 string phys_body2_name =
"phys_" + name +
"_body2" +
"_name";
738 if (volume_body1 != 0)
739 new G4PVPlacement(collimator_body1.
transform, logi_body1, phys_body1_name, elements[motherVolumeVacuum].logi,
false, 0);
740 if (volume_body2 != 0)
741 new G4PVPlacement(collimator_body2.
transform, logi_body2, phys_body2_name, elements[motherVolumeVacuum].logi,
false, 0);
744 collimator_body1.
transform = collimator_body1.
transform * elements[motherVolumeVacuum].transform;
745 collimator_body2.
transform = collimator_body2.
transform * elements[motherVolumeVacuum].transform;
747 string name_body1 = name +
"_body1";
748 string name_body2 = name +
"_body2";
749 elements[name_body1] = collimator_body1;
750 elements[name_body2] = collimator_body2;
761 if (
m_config.getParameter(
"ACSL.box1_W", -1) > 0) {
765 std::string name =
"ACSL";
768 double acsl_X0 =
m_config.getParameter(prep +
"X0") * unitFactor;
769 double acsl_Y0 =
m_config.getParameter(prep +
"Y0") * unitFactor;
770 double acsl_Z0 =
m_config.getParameter(prep +
"Z0") * unitFactor;
771 double acsl_PHI =
m_config.getParameter(prep +
"PHI");
773 double acsl_box1_W =
m_config.getParameter(prep +
"box1_W") * unitFactor;
774 double acsl_box1_H =
m_config.getParameter(prep +
"box1_H") * unitFactor;
775 double acsl_box1_L =
m_config.getParameter(prep +
"box1_L") * unitFactor;
777 double acsl_box2_W =
m_config.getParameter(prep +
"box2_W") * unitFactor;
778 double acsl_box2_H =
m_config.getParameter(prep +
"box2_H") * unitFactor;
779 double acsl_box2_L =
m_config.getParameter(prep +
"box2_L") * unitFactor;
780 double acsl_box2_dX =
m_config.getParameter(prep +
"box2_dX") * unitFactor;
781 double acsl_box2_dY =
m_config.getParameter(prep +
"box2_dY") * unitFactor;
782 double acsl_box2_dZ =
m_config.getParameter(prep +
"box2_dZ") * unitFactor;
784 double acsl_trd1_X1 =
m_config.getParameter(prep +
"trd1_X1") * unitFactor;
785 double acsl_trd1_X2 =
m_config.getParameter(prep +
"trd1_X2") * unitFactor;
786 double acsl_trd1_Y1 =
m_config.getParameter(prep +
"trd1_Y1") * unitFactor;
787 double acsl_trd1_Y2 =
m_config.getParameter(prep +
"trd1_Y2") * unitFactor;
788 double acsl_trd1_Z =
m_config.getParameter(prep +
"trd1_Z") * unitFactor;
789 double acsl_trd1_dX =
m_config.getParameter(prep +
"trd1_dX") * unitFactor;
790 double acsl_trd1_dY =
m_config.getParameter(prep +
"trd1_dY") * unitFactor;
791 double acsl_trd1_dZ =
m_config.getParameter(prep +
"trd1_dZ") * unitFactor;
792 double acsl_trd1_PHI =
m_config.getParameter(prep +
"trd1_PHI");
794 double acsl_trd2_X1 =
m_config.getParameter(prep +
"trd2_X1") * unitFactor;
795 double acsl_trd2_X2 =
m_config.getParameter(prep +
"trd2_X2") * unitFactor;
796 double acsl_trd2_Y1 =
m_config.getParameter(prep +
"trd2_Y1") * unitFactor;
797 double acsl_trd2_Y2 =
m_config.getParameter(prep +
"trd2_Y2") * unitFactor;
798 double acsl_trd2_Z =
m_config.getParameter(prep +
"trd2_Z") * unitFactor;
799 double acsl_trd2_dX =
m_config.getParameter(prep +
"trd2_dX") * unitFactor;
800 double acsl_trd2_dY =
m_config.getParameter(prep +
"trd2_dY") * unitFactor;
801 double acsl_trd2_dZ =
m_config.getParameter(prep +
"trd2_dZ") * unitFactor;
802 double acsl_trd2_PHI =
m_config.getParameter(prep +
"trd2_PHI");
805 string geo_box1_name =
"geo_" + name +
"_box1_name";
806 string geo_box2_name =
"geo_" + name +
"_box2_name";
807 string geo_trd1_name =
"geo_" + name +
"_trd1_name";
808 string geo_trd2_name =
"geo_" + name +
"_trd2_name";
809 string geo_acsl_name =
"geo_" + name +
"_name";
811 G4Box* geo_box1 =
new G4Box(geo_box1_name, acsl_box1_W / 2.0, acsl_box1_H / 2.0, acsl_box1_L / 2.0);
812 G4Box* geo_box2 =
new G4Box(geo_box2_name, acsl_box2_W / 2.0, acsl_box2_H / 2.0, acsl_box2_L / 2.0);
813 G4Trd* geo_trd1 =
new G4Trd(geo_trd1_name, acsl_trd1_X1, acsl_trd1_X2, acsl_trd1_Y1, acsl_trd1_Y2, acsl_trd1_Z);
814 G4Trd* geo_trd2 =
new G4Trd(geo_trd2_name, acsl_trd2_X1, acsl_trd2_X2, acsl_trd2_Y1, acsl_trd2_Y2, acsl_trd2_Z);
819 G4Transform3D box2_trans = G4Translate3D(acsl_box2_dX, acsl_box2_dY, acsl_box2_dZ);
821 G4Transform3D trd1_trans = G4Translate3D(acsl_trd1_dX, acsl_trd1_dY, acsl_trd1_dZ);
822 trd1_trans = trd1_trans * G4RotateY3D(acsl_trd1_PHI /
Unit::rad);
824 G4Transform3D trd2_trans = G4Translate3D(acsl_trd2_dX, acsl_trd2_dY, acsl_trd2_dZ);
825 trd2_trans = trd2_trans * G4RotateY3D(acsl_trd2_PHI /
Unit::rad);
827 ACSL.
transform = G4Translate3D(acsl_X0, acsl_Y0, acsl_Z0);
842 string geo_interm1_name =
"geo_" + name +
"_interm1_name";
843 string geo_interm2_name =
"geo_" + name +
"_interm2_name";
844 G4UnionSolid* geo_interm1 =
new G4UnionSolid(geo_interm1_name, geo_box1, geo_box2, box2_trans);
845 G4UnionSolid* geo_interm2 =
new G4UnionSolid(geo_interm2_name, geo_interm1, geo_trd1, trd1_trans);
846 G4UnionSolid* geo_acsl =
new G4UnionSolid(geo_acsl_name, geo_interm2, geo_trd2, trd2_trans);
851 string strMat_acsl =
m_config.getParameterStr(prep +
"Material");
853 string logi_acsl_name =
"logi_" + name +
"_name";
854 G4LogicalVolume* logi_acsl =
new G4LogicalVolume(geo_acsl, mat_acsl, logi_acsl_name);
858 ACSL.
logi = logi_acsl;
861 string phys_acsl_name =
"phys_" + name +
"_name";
862 new G4PVPlacement(ACSL.
transform, ACSL.
logi, phys_acsl_name, &topVolume,
false, 0);
880 double acsr1_X0 =
m_config.getParameter(prep +
"X0") * unitFactor;
881 double acsr1_Y0 =
m_config.getParameter(prep +
"Y0") * unitFactor;
882 double acsr1_Z0 =
m_config.getParameter(prep +
"Z0") * unitFactor;
883 double acsr1_PHI0 =
m_config.getParameter(prep +
"PHI0");
885 double acsr1_X1 =
m_config.getParameter(prep +
"X1") * unitFactor;
886 double acsr1_X2 =
m_config.getParameter(prep +
"X2") * unitFactor;
887 double acsr1_Y1 =
m_config.getParameter(prep +
"Y1") * unitFactor;
888 double acsr1_Y2 =
m_config.getParameter(prep +
"Y2") * unitFactor;
889 double acsr1_Z =
m_config.getParameter(prep +
"Z") * unitFactor;
890 double acsr1_THETA =
m_config.getParameter(prep +
"THETA");
891 double acsr1_PHI =
m_config.getParameter(prep +
"PHI");
892 double acsr1_ANG =
m_config.getParameter(prep +
"ANG");
894 double acsr1_dx = (acsr1_X1 - acsr1_X2) / 2.0;
895 double acsr1_dy = (acsr1_Y2 - acsr1_Y1) / 2.0;
908 string geo_acsr1_name =
"geo_" + name +
"_name";
909 G4Trap* geo_acsr1 =
new G4Trap(geo_acsr1_name, acsr1_Z, acsr1_THETA, acsr1_PHI, acsr1_Y1, acsr1_X1, acsr1_X1, acsr1_ANG, acsr1_Y2,
910 acsr1_X2, acsr1_X2, acsr1_ANG);
913 ACSR1.
geo = geo_acsr1;
916 ACSR1.
transform = G4Translate3D(acsr1_X0, acsr1_Y0 - acsr1_dy, acsr1_Z0 - acsr1_dx);
920 string strMat_acsr1 =
m_config.getParameterStr(prep +
"Material");
922 string logi_acsr1_name =
"logi_" + name +
"_name";
923 G4LogicalVolume* logi_acsr1 =
new G4LogicalVolume(geo_acsr1, mat_acsr1, logi_acsr1_name);
927 ACSR1.
logi = logi_acsr1;
930 string phys_acsr1_name =
"phys_" + name +
"_name";
931 new G4PVPlacement(ACSR1.
transform, ACSR1.
logi, phys_acsr1_name, &topVolume,
false, 0);
944 double acsr2_X0 =
m_config.getParameter(prep +
"X0") * unitFactor;
945 double acsr2_Y0 =
m_config.getParameter(prep +
"Y0") * unitFactor;
946 double acsr2_Z0 =
m_config.getParameter(prep +
"Z0") * unitFactor;
947 double acsr2_PHI0 =
m_config.getParameter(prep +
"PHI0");
949 double acsr2_X1 =
m_config.getParameter(prep +
"X1") * unitFactor;
950 double acsr2_X2 =
m_config.getParameter(prep +
"X2") * unitFactor;
951 double acsr2_Y1 =
m_config.getParameter(prep +
"Y1") * unitFactor;
952 double acsr2_Y2 =
m_config.getParameter(prep +
"Y2") * unitFactor;
953 double acsr2_Z =
m_config.getParameter(prep +
"Z") * unitFactor;
954 double acsr2_THETA =
m_config.getParameter(prep +
"THETA");
955 double acsr2_PHI =
m_config.getParameter(prep +
"PHI");
956 double acsr2_ANG =
m_config.getParameter(prep +
"ANG");
958 double acsr2_dx = (acsr2_X1 - acsr2_X2) / 2.0;
959 double acsr2_dy = (acsr2_Y2 - acsr2_Y1) / 2.0;
972 string geo_acsr2_name =
"geo_" + name +
"_name";
973 G4Trap* geo_acsr2 =
new G4Trap(geo_acsr2_name, acsr2_Z, acsr2_THETA, acsr2_PHI, acsr2_Y1, acsr2_X1, acsr2_X1, acsr2_ANG, acsr2_Y2,
974 acsr2_X2, acsr2_X2, acsr2_ANG);
977 ACSR2.
geo = geo_acsr2;
980 ACSR2.
transform = G4Translate3D(acsr2_X0, acsr2_Y0 - acsr2_dy, acsr2_Z0 - acsr2_dx);
984 string strMat_acsr2 =
m_config.getParameterStr(prep +
"Material");
986 string logi_acsr2_name =
"logi_" + name +
"_name";
987 G4LogicalVolume* logi_acsr2 =
new G4LogicalVolume(geo_acsr2, mat_acsr2, logi_acsr2_name);
991 ACSR2.
logi = logi_acsr2;
994 string phys_acsr2_name =
"phys_" + name +
"_name";
995 new G4PVPlacement(ACSR2.
transform, ACSR2.
logi, phys_acsr2_name, &topVolume,
false, 0);
1013 double apsl1_W =
m_config.getParameter(prep +
"W") * unitFactor;
1014 double apsl1_H =
m_config.getParameter(prep +
"H") * unitFactor;
1015 double apsl1_L =
m_config.getParameter(prep +
"L") * unitFactor;
1016 double apsl1_X0 =
m_config.getParameter(prep +
"X0") * unitFactor;
1017 double apsl1_Y0 =
m_config.getParameter(prep +
"Y0") * unitFactor;
1018 double apsl1_Z0 =
m_config.getParameter(prep +
"Z0") * unitFactor;
1019 double apsl1_hole_R =
m_config.getParameter(prep +
"holeR") * unitFactor;
1020 double apsl1_hole_D =
m_config.getParameter(prep +
"holeD") * unitFactor;
1021 double apsl1_hole_dX =
m_config.getParameter(prep +
"holeDX") * unitFactor;
1022 double apsl1_hole_dY =
m_config.getParameter(prep +
"holeDY") * unitFactor;
1023 double apsl1_hole_dZ =
m_config.getParameter(prep +
"holeDZ") * unitFactor;
1024 double apsl1_PHI =
m_config.getParameter(prep +
"PHI");
1027 APSL1.
transform = G4Translate3D(apsl1_X0, apsl1_Y0, apsl1_Z0);
1030 G4Transform3D transform_apsl1_hole = G4Translate3D(apsl1_hole_dX, apsl1_hole_dY, apsl1_hole_dZ);
1033 string geo_apsl1_box_name =
"geo_" + name +
"_box_name";
1034 string geo_apsl1_hole_name =
"geo_" + name +
"_hole_name";
1035 string geo_apsl1_name =
"geo_" + name +
"_name";
1037 G4Box* geo_apsl1_box =
new G4Box(geo_apsl1_box_name, apsl1_W / 2.0, apsl1_H / 2.0, apsl1_L / 2.0);
1038 G4Tubs* geo_apsl1_hole =
new G4Tubs(geo_apsl1_hole_name, 0.0, apsl1_hole_R, apsl1_hole_D / 2.0, 0.0, 2.0 * M_PI);
1039 G4SubtractionSolid* geo_apsl1 =
new G4SubtractionSolid(geo_apsl1_name, geo_apsl1_box, geo_apsl1_hole, transform_apsl1_hole);
1041 APSL1.
geo = geo_apsl1;
1044 string strMat_apsl1 =
m_config.getParameterStr(prep +
"Material");
1046 string logi_apsl1_name =
"logi_" + name +
"_name";
1047 G4LogicalVolume* logi_apsl1 =
new G4LogicalVolume(geo_apsl1, mat_apsl1, logi_apsl1_name);
1051 APSL1.
logi = logi_apsl1;
1054 string phys_apsl1_name =
"phys_" + name +
"_name";
1055 new G4PVPlacement(APSL1.
transform, APSL1.
logi, phys_apsl1_name, &topVolume,
false, 0);
1068 double apsl2_W =
m_config.getParameter(prep +
"W") * unitFactor;
1069 double apsl2_H =
m_config.getParameter(prep +
"H") * unitFactor;
1070 double apsl2_L =
m_config.getParameter(prep +
"L") * unitFactor;
1071 double apsl2_X0 =
m_config.getParameter(prep +
"X0") * unitFactor;
1072 double apsl2_Y0 =
m_config.getParameter(prep +
"Y0") * unitFactor;
1073 double apsl2_Z0 =
m_config.getParameter(prep +
"Z0") * unitFactor;
1074 double apsl2_hole_R =
m_config.getParameter(prep +
"holeR") * unitFactor;
1075 double apsl2_hole_D =
m_config.getParameter(prep +
"holeD") * unitFactor;
1076 double apsl2_hole_dX =
m_config.getParameter(prep +
"holeDX") * unitFactor;
1077 double apsl2_hole_dY =
m_config.getParameter(prep +
"holeDY") * unitFactor;
1078 double apsl2_hole_dZ =
m_config.getParameter(prep +
"holeDZ") * unitFactor;
1079 double apsl2_PHI =
m_config.getParameter(prep +
"PHI");
1082 APSL2.
transform = G4Translate3D(apsl2_X0, apsl2_Y0, apsl2_Z0);
1085 G4Transform3D transform_apsl2_hole = G4Translate3D(apsl2_hole_dX, apsl2_hole_dY, apsl2_hole_dZ);
1088 string geo_apsl2_box_name =
"geo_" + name +
"_box_name";
1089 string geo_apsl2_hole_name =
"geo_" + name +
"_hole_name";
1090 string geo_apsl2_name =
"geo_" + name +
"_name";
1092 G4Box* geo_apsl2_box =
new G4Box(geo_apsl2_box_name, apsl2_W / 2.0, apsl2_H / 2.0, apsl2_L / 2.0);
1093 G4Tubs* geo_apsl2_hole =
new G4Tubs(geo_apsl2_hole_name, 0.0, apsl2_hole_R, apsl2_hole_D / 2.0, 0.0, 2.0 * M_PI);
1094 G4SubtractionSolid* geo_apsl2 =
new G4SubtractionSolid(geo_apsl2_name, geo_apsl2_box, geo_apsl2_hole, transform_apsl2_hole);
1096 APSL2.
geo = geo_apsl2;
1099 string strMat_apsl2 =
m_config.getParameterStr(prep +
"Material");
1101 string logi_apsl2_name =
"logi_" + name +
"_name";
1102 G4LogicalVolume* logi_apsl2 =
new G4LogicalVolume(geo_apsl2, mat_apsl2, logi_apsl2_name);
1106 APSL2.
logi = logi_apsl2;
1109 string phys_apsl2_name =
"phys_" + name +
"_name";
1110 new G4PVPlacement(APSL2.
transform, APSL2.
logi, phys_apsl2_name, &topVolume,
false, 0);
1128 double apsr1_W =
m_config.getParameter(prep +
"W") * unitFactor;
1129 double apsr1_H =
m_config.getParameter(prep +
"H") * unitFactor;
1130 double apsr1_L =
m_config.getParameter(prep +
"L") * unitFactor;
1131 double apsr1_X0 =
m_config.getParameter(prep +
"X0") * unitFactor;
1132 double apsr1_Y0 =
m_config.getParameter(prep +
"Y0") * unitFactor;
1133 double apsr1_Z0 =
m_config.getParameter(prep +
"Z0") * unitFactor;
1134 double apsr1_hole_R =
m_config.getParameter(prep +
"holeR") * unitFactor;
1135 double apsr1_hole_D =
m_config.getParameter(prep +
"holeD") * unitFactor;
1136 double apsr1_hole_dX =
m_config.getParameter(prep +
"holeDX") * unitFactor;
1137 double apsr1_hole_dY =
m_config.getParameter(prep +
"holeDY") * unitFactor;
1138 double apsr1_hole_dZ =
m_config.getParameter(prep +
"holeDZ") * unitFactor;
1139 double apsr1_PHI =
m_config.getParameter(prep +
"PHI");
1142 APSR1.
transform = G4Translate3D(apsr1_X0, apsr1_Y0, apsr1_Z0);
1145 G4Transform3D transform_apsr1_hole = G4Translate3D(apsr1_hole_dX, apsr1_hole_dY, apsr1_hole_dZ);
1148 string geo_apsr1_box_name =
"geo_" + name +
"_box_name";
1149 string geo_apsr1_hole_name =
"geo_" + name +
"_hole_name";
1150 string geo_apsr1_name =
"geo_" + name +
"_name";
1152 G4Box* geo_apsr1_box =
new G4Box(geo_apsr1_box_name, apsr1_W / 2.0, apsr1_H / 2.0, apsr1_L / 2.0);
1153 G4Tubs* geo_apsr1_hole =
new G4Tubs(geo_apsr1_hole_name, 0.0, apsr1_hole_R, apsr1_hole_D / 2.0, 0.0, 2.0 * M_PI);
1154 G4SubtractionSolid* geo_apsr1 =
new G4SubtractionSolid(geo_apsr1_name, geo_apsr1_box, geo_apsr1_hole, transform_apsr1_hole);
1156 APSR1.
geo = geo_apsr1;
1159 string strMat_apsr1 =
m_config.getParameterStr(prep +
"Material");
1161 string logi_apsr1_name =
"logi_" + name +
"_name";
1162 G4LogicalVolume* logi_apsr1 =
new G4LogicalVolume(geo_apsr1, mat_apsr1, logi_apsr1_name);
1166 APSR1.
logi = logi_apsr1;
1169 string phys_apsr1_name =
"phys_" + name +
"_name";
1170 new G4PVPlacement(APSR1.
transform, APSR1.
logi, phys_apsr1_name, &topVolume,
false, 0);
1183 double apsr2_W =
m_config.getParameter(prep +
"W") * unitFactor;
1184 double apsr2_H =
m_config.getParameter(prep +
"H") * unitFactor;
1185 double apsr2_L =
m_config.getParameter(prep +
"L") * unitFactor;
1186 double apsr2_X0 =
m_config.getParameter(prep +
"X0") * unitFactor;
1187 double apsr2_Y0 =
m_config.getParameter(prep +
"Y0") * unitFactor;
1188 double apsr2_Z0 =
m_config.getParameter(prep +
"Z0") * unitFactor;
1189 double apsr2_hole_R =
m_config.getParameter(prep +
"holeR") * unitFactor;
1190 double apsr2_hole_D =
m_config.getParameter(prep +
"holeD") * unitFactor;
1191 double apsr2_hole_dX =
m_config.getParameter(prep +
"holeDX") * unitFactor;
1192 double apsr2_hole_dY =
m_config.getParameter(prep +
"holeDY") * unitFactor;
1193 double apsr2_hole_dZ =
m_config.getParameter(prep +
"holeDZ") * unitFactor;
1194 double apsr2_PHI =
m_config.getParameter(prep +
"PHI");
1197 APSR2.
transform = G4Translate3D(apsr2_X0, apsr2_Y0, apsr2_Z0);
1200 G4Transform3D transform_apsr2_hole = G4Translate3D(apsr2_hole_dX, apsr2_hole_dY, apsr2_hole_dZ);
1203 string geo_apsr2_box_name =
"geo_" + name +
"_box_name";
1204 string geo_apsr2_hole_name =
"geo_" + name +
"_hole_name";
1205 string geo_apsr2_name =
"geo_" + name +
"_name";
1207 G4Box* geo_apsr2_box =
new G4Box(geo_apsr2_box_name, apsr2_W / 2.0, apsr2_H / 2.0, apsr2_L / 2.0);
1208 G4Tubs* geo_apsr2_hole =
new G4Tubs(geo_apsr2_hole_name, 0.0, apsr2_hole_R, apsr2_hole_D / 2.0, 0.0, 2.0 * M_PI);
1209 G4SubtractionSolid* geo_apsr2 =
new G4SubtractionSolid(geo_apsr2_name, geo_apsr2_box, geo_apsr2_hole, transform_apsr2_hole);
1211 APSR2.
geo = geo_apsr2;
1214 string strMat_apsr2 =
m_config.getParameterStr(prep +
"Material");
1216 string logi_apsr2_name =
"logi_" + name +
"_name";
1217 G4LogicalVolume* logi_apsr2 =
new G4LogicalVolume(geo_apsr2, mat_apsr2, logi_apsr2_name);
1221 APSR2.
logi = logi_apsr2;
1224 string phys_apsr2_name =
"phys_" + name +
"_name";
1225 new G4PVPlacement(APSR2.
transform, APSR2.
logi, phys_apsr2_name, &topVolume,
false, 0);