9 #include <beast/cave/geometry/CaveCreator.h>
10 #include <beast/cave/simulation/SensitiveDetector.h>
12 #include <geometry/CreatorFactory.h>
13 #include <framework/gearbox/GearDir.h>
14 #include <framework/logging/Logger.h>
16 #include <boost/format.hpp>
17 #include <boost/foreach.hpp>
18 #include <boost/algorithm/string.hpp>
20 #include <G4LogicalVolume.hh>
21 #include <G4PVPlacement.hh>
25 #include <G4UserLimits.hh>
28 using namespace boost;
43 CaveCreator::CaveCreator(): m_sensitive(0)
62 G4String name, symbol;
63 G4double fractionmass;
65 A = 1.01 * CLHEP::g / CLHEP::mole;
66 G4Element* elH =
new G4Element(name =
"Hydrogen", symbol =
"H" , Z = 1, A);
68 A = 12.01 * CLHEP::g / CLHEP::mole;
69 G4Element* elC =
new G4Element(name =
"Carbon" , symbol =
"C" , Z = 6, A);
71 A = 16.00 * CLHEP::g / CLHEP::mole;
72 G4Element* elO =
new G4Element(name =
"Oxygen" , symbol =
"O" , Z = 8, A);
74 A = 22.99 * CLHEP::g / CLHEP::mole;
75 G4Element* elNa =
new G4Element(name =
"Natrium" , symbol =
"Na" , Z = 11 , A);
77 A = 200.59 * CLHEP::g / CLHEP::mole;
78 G4Element* elHg =
new G4Element(name =
"Hg" , symbol =
"Hg" , Z = 80, A);
80 A = 26.98 * CLHEP::g / CLHEP::mole;
81 G4Element* elAl =
new G4Element(name =
"Aluminium" , symbol =
"Al" , Z = 13, A);
83 A = 28.09 * CLHEP::g / CLHEP::mole;
84 G4Element* elSi =
new G4Element(name =
"Silicon", symbol =
"Si", Z = 14, A);
86 A = 39.1 * CLHEP::g / CLHEP::mole;
87 G4Element* elK =
new G4Element(name =
"K" , symbol =
"K" , Z = 19 , A);
89 A = 69.72 * CLHEP::g / CLHEP::mole;
90 G4Element* elCa =
new G4Element(name =
"Calzium" , symbol =
"Ca" , Z = 31 , A);
92 A = 55.85 * CLHEP::g / CLHEP::mole;
93 G4Element* elFe =
new G4Element(name =
"Iron" , symbol =
"Fe", Z = 26, A);
95 density = 2.03 * CLHEP::g / CLHEP::cm3;
96 G4Material* Concrete =
new G4Material(
"Concrete", density, 10);
97 Concrete->AddElement(elH , fractionmass = 0.01);
98 Concrete->AddElement(elO , fractionmass = 0.529);
99 Concrete->AddElement(elNa , fractionmass = 0.016);
100 Concrete->AddElement(elHg , fractionmass = 0.002);
101 Concrete->AddElement(elAl , fractionmass = 0.034);
102 Concrete->AddElement(elSi , fractionmass = 0.337);
103 Concrete->AddElement(elK , fractionmass = 0.013);
104 Concrete->AddElement(elCa , fractionmass = 0.044);
105 Concrete->AddElement(elFe , fractionmass = 0.014);
106 Concrete->AddElement(elC , fractionmass = 0.001);
110 double stepSize = content.getLength(
"stepSize", 5 * CLHEP::um);
114 vector<double> bar = content.getArray(
"bar");
115 B2INFO(
"Contents of bar: ");
116 BOOST_FOREACH(
double value, bar) {
117 B2INFO(
"value: " << value);
121 BOOST_FOREACH(
const GearDir & activeParams, content.getNodes(
"Active")) {
124 G4Box* s_CAVE =
new G4Box(
"s_CAVE",
130 G4LogicalVolume* l_CAVE =
new G4LogicalVolume(s_CAVE, Concrete,
"l_CAVE", 0, 0);
133 l_CAVE->SetUserLimits(
new G4UserLimits(stepSize));
136 G4ThreeVector CAVEpos = G4ThreeVector(
137 activeParams.
getLength(
"x_cave") * CLHEP::cm,
138 activeParams.
getLength(
"y_cave") * CLHEP::cm,
139 activeParams.
getLength(
"z_cave") * CLHEP::cm
142 G4RotationMatrix* rot_cave =
new G4RotationMatrix();
143 rot_cave->rotateX(activeParams.
getLength(
"AngleX"));
144 rot_cave->rotateY(activeParams.
getLength(
"AngleY"));
145 rot_cave->rotateZ(activeParams.
getLength(
"AngleZ"));
152 new G4PVPlacement(rot_cave, CAVEpos, l_CAVE,
"p_CAVE", &topVolume,
false, detID);
GearDir is the basic class used for accessing the parameter store.
virtual ~CaveCreator()
Destructor.
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Creation of the detector geometry from Gearbox (XML).
SensitiveDetector * m_sensitive
SensitiveDetector cave.
Sensitive Detector implementation of the CAVE detector.
double getLength(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard length unit.
geometry::CreatorFactory< CaveCreator > CaveFactory("CAVECreator")
Creator creates the cave geometry.
GeometryTypes
Flag indiciating the type of geometry to be used.
Abstract base class for different kinds of events.
Very simple class to provide an easy way to register creators with the CreatorManager.