11 #include <beast/srsensor/geometry/DiamondCreator.h>
12 #include <beast/srsensor/simulation/SensitiveDetector.h>
14 #include <geometry/Materials.h>
15 #include <geometry/CreatorFactory.h>
16 #include <framework/gearbox/GearDir.h>
17 #include <framework/logging/Logger.h>
19 #include <boost/format.hpp>
20 #include <boost/foreach.hpp>
21 #include <boost/algorithm/string.hpp>
23 #include <G4LogicalVolume.hh>
24 #include <G4PVPlacement.hh>
28 #include <G4UserLimits.hh>
31 using namespace boost;
44 geometry::CreatorFactory<DiamondCreator>
DiamondFactory(
"DIAMONDCreator");
46 DiamondCreator::DiamondCreator(): m_sensitive(0)
51 DiamondCreator::~DiamondCreator()
59 double stepSize = content.getLength(
"stepSize", 5 * CLHEP::um);
63 vector<double> bar_diamond = content.getArray(
"bar_diamond");
64 B2INFO(
"Contents of bar_diamond: ");
65 BOOST_FOREACH(
double value, bar_diamond) {
66 B2INFO(
"value: " << value);
70 BOOST_FOREACH(
const GearDir & activeParams, content.getNodes(
"Active")) {
73 G4Box* s_DIAMOND =
new G4Box(
"s_DIAMOND",
74 activeParams.
getLength(
"diamond_dx")*CLHEP::cm,
75 activeParams.
getLength(
"diamond_dy")*CLHEP::cm,
76 activeParams.
getLength(
"diamond_dz")*CLHEP::cm);
78 string matDIAMOND = activeParams.
getString(
"MaterialDIAMOND");
82 l_DIAMOND->SetUserLimits(
new G4UserLimits(stepSize));
85 G4ThreeVector DIAMONDpos = G4ThreeVector(
86 activeParams.
getLength(
"x_diamond") * CLHEP::cm,
87 activeParams.
getLength(
"y_diamond") * CLHEP::cm,
88 activeParams.
getLength(
"z_diamond") * CLHEP::cm
91 G4RotationMatrix* rot_diamond =
new G4RotationMatrix();
92 rot_diamond->rotateX(activeParams.
getAngle(
"AngleX"));
93 rot_diamond->rotateY(activeParams.
getAngle(
"AngleY"));
94 rot_diamond->rotateZ(activeParams.
getAngle(
"AngleZ"));
97 new G4PVPlacement(rot_diamond, DIAMONDpos, l_DIAMOND,
"p_DIAMOND", &topVolume,
false, diamondNb);