11 #include <beast/cave/geometry/CaveCreator.h>
12 #include <beast/cave/simulation/SensitiveDetector.h>
14 #include <geometry/CreatorFactory.h>
15 #include <framework/gearbox/GearDir.h>
16 #include <framework/logging/Logger.h>
18 #include <boost/format.hpp>
19 #include <boost/foreach.hpp>
20 #include <boost/algorithm/string.hpp>
22 #include <G4LogicalVolume.hh>
23 #include <G4PVPlacement.hh>
27 #include <G4UserLimits.hh>
30 using namespace boost;
43 geometry::CreatorFactory<CaveCreator>
CaveFactory(
"CAVECreator");
45 CaveCreator::CaveCreator(): m_sensitive(0)
50 CaveCreator::~CaveCreator()
61 G4String name, symbol;
62 G4double fractionmass;
64 A = 1.01 * CLHEP::g / CLHEP::mole;
65 G4Element* elH =
new G4Element(name =
"Hydrogen", symbol =
"H" , Z = 1, A);
67 A = 12.01 * CLHEP::g / CLHEP::mole;
68 G4Element* elC =
new G4Element(name =
"Carbon" , symbol =
"C" , Z = 6, A);
70 A = 16.00 * CLHEP::g / CLHEP::mole;
71 G4Element* elO =
new G4Element(name =
"Oxygen" , symbol =
"O" , Z = 8, A);
73 A = 22.99 * CLHEP::g / CLHEP::mole;
74 G4Element* elNa =
new G4Element(name =
"Natrium" , symbol =
"Na" , Z = 11 , A);
76 A = 200.59 * CLHEP::g / CLHEP::mole;
77 G4Element* elHg =
new G4Element(name =
"Hg" , symbol =
"Hg" , Z = 80, A);
79 A = 26.98 * CLHEP::g / CLHEP::mole;
80 G4Element* elAl =
new G4Element(name =
"Aluminium" , symbol =
"Al" , Z = 13, A);
82 A = 28.09 * CLHEP::g / CLHEP::mole;
83 G4Element* elSi =
new G4Element(name =
"Silicon", symbol =
"Si", Z = 14, A);
85 A = 39.1 * CLHEP::g / CLHEP::mole;
86 G4Element* elK =
new G4Element(name =
"K" , symbol =
"K" , Z = 19 , A);
88 A = 69.72 * CLHEP::g / CLHEP::mole;
89 G4Element* elCa =
new G4Element(name =
"Calzium" , symbol =
"Ca" , Z = 31 , A);
91 A = 55.85 * CLHEP::g / CLHEP::mole;
92 G4Element* elFe =
new G4Element(name =
"Iron" , symbol =
"Fe", Z = 26, A);
94 density = 2.03 * CLHEP::g / CLHEP::cm3;
95 G4Material* Concrete =
new G4Material(
"Concrete", density, 10);
96 Concrete->AddElement(elH , fractionmass = 0.01);
97 Concrete->AddElement(elO , fractionmass = 0.529);
98 Concrete->AddElement(elNa , fractionmass = 0.016);
99 Concrete->AddElement(elHg , fractionmass = 0.002);
100 Concrete->AddElement(elAl , fractionmass = 0.034);
101 Concrete->AddElement(elSi , fractionmass = 0.337);
102 Concrete->AddElement(elK , fractionmass = 0.013);
103 Concrete->AddElement(elCa , fractionmass = 0.044);
104 Concrete->AddElement(elFe , fractionmass = 0.014);
105 Concrete->AddElement(elC , fractionmass = 0.001);
109 double stepSize = content.getLength(
"stepSize", 5 * CLHEP::um);
113 vector<double> bar = content.getArray(
"bar");
114 B2INFO(
"Contents of bar: ");
115 BOOST_FOREACH(
double value, bar) {
116 B2INFO(
"value: " << value);
120 BOOST_FOREACH(
const GearDir & activeParams, content.getNodes(
"Active")) {
123 G4Box* s_CAVE =
new G4Box(
"s_CAVE",
129 G4LogicalVolume* l_CAVE =
new G4LogicalVolume(s_CAVE, Concrete,
"l_CAVE", 0, 0);
132 l_CAVE->SetUserLimits(
new G4UserLimits(stepSize));
135 G4ThreeVector CAVEpos = G4ThreeVector(
136 activeParams.
getLength(
"x_cave") * CLHEP::cm,
137 activeParams.
getLength(
"y_cave") * CLHEP::cm,
138 activeParams.
getLength(
"z_cave") * CLHEP::cm
141 G4RotationMatrix* rot_cave =
new G4RotationMatrix();
142 rot_cave->rotateX(activeParams.
getLength(
"AngleX"));
143 rot_cave->rotateY(activeParams.
getLength(
"AngleY"));
144 rot_cave->rotateZ(activeParams.
getLength(
"AngleZ"));
151 new G4PVPlacement(rot_cave, CAVEpos, l_CAVE,
"p_CAVE", &topVolume,
false, detID);