11 #include <beast/qcsmonitor/geometry/QcsmonitorCreator.h>
12 #include <beast/qcsmonitor/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>
20 #include <boost/format.hpp>
21 #include <boost/foreach.hpp>
22 #include <boost/algorithm/string.hpp>
24 #include <G4LogicalVolume.hh>
25 #include <G4PVPlacement.hh>
29 #include <G4UserLimits.hh>
32 #include <G4VisAttributes.hh>
35 using namespace boost;
44 namespace qcsmonitor {
48 geometry::CreatorFactory<QcsmonitorCreator>
QcsmonitorFactory(
"QCSMONITORCreator");
50 QcsmonitorCreator::QcsmonitorCreator(): m_sensitive(0)
55 QcsmonitorCreator::~QcsmonitorCreator()
63 double stepSize = content.getLength(
"stepSize", 5 * CLHEP::um);
65 G4VisAttributes* red =
new G4VisAttributes(G4Colour(1, 0, 0));
66 red->SetForceAuxEdgeVisible(
true);
67 G4VisAttributes* green =
new G4VisAttributes(G4Colour(0, 1, 0));
68 green->SetForceAuxEdgeVisible(
true);
69 G4VisAttributes* gray =
new G4VisAttributes(G4Colour(.5, .5, .5));
70 gray->SetForceAuxEdgeVisible(
true);
71 G4VisAttributes* coppercolor =
new G4VisAttributes(G4Colour(218. / 255., 138. / 255., 103. / 255.));
72 coppercolor->SetForceAuxEdgeVisible(
true);
75 BOOST_FOREACH(
const GearDir & activeParams, content.getNodes(
"Active")) {
76 int phase = activeParams.
getInt(
"phase");
77 G4double dx_scint = activeParams.
getLength(
"dx_scint") / 2.*CLHEP::cm;
78 G4double dy_scint = activeParams.
getLength(
"dy_scint") / 2.*CLHEP::cm;
79 G4double dz_scint = activeParams.
getLength(
"dz_scint") / 2.*CLHEP::cm;
80 double thetaZ = activeParams.
getAngle(
"ThetaZ");
81 G4VSolid* s_scint =
new G4Box(
"s_scint", dx_scint, dy_scint, dz_scint);
83 l_scint->SetVisAttributes(green);
85 l_scint->SetUserLimits(
new G4UserLimits(stepSize));
93 for (
double x : activeParams.
getArray(
"x", {0})) {
99 for (
double y : activeParams.
getArray(
"y", {0})) {
106 for (
double z : activeParams.
getArray(
"z", {0})) {
111 r_pos[dim] = sqrt(x_pos[dim] * x_pos[dim] + y_pos[dim] * y_pos[dim]);
118 for (
double r : activeParams.
getArray(
"r", {0})) {
120 r_pos[dim] = r + dz_scint;
123 for (
int i = 0; i < 100; i++) {
131 G4Transform3D transform;
132 for (
double phi : activeParams.
getArray(
"Phi", {M_PI / 2})) {
134 for (
int i = 0; i < dim; i++) {
136 transform = G4RotateZ3D(phi - M_PI / 2) * G4Translate3D(0, r_pos[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ);
140 transform = G4Translate3D(x_pos[i], y_pos[i], z_pos[i]) * G4RotateZ3D(phi) * G4RotateX3D(thetaZ);
145 new G4PVPlacement(transform, l_scint, TString::Format(
"p_scint_%d", detID).Data() , &topVolume,
false, detID);
146 B2INFO(
"QCSS-" << detID <<
" placed at: " << transform.getTranslation() <<
" mm ");