9#include <beast/dosi/geometry/DosiCreator.h>
10#include <beast/dosi/simulation/SensitiveDetector.h>
12#include <geometry/Materials.h>
13#include <geometry/CreatorFactory.h>
14#include <framework/gearbox/GearDir.h>
17#include <boost/format.hpp>
18#include <boost/foreach.hpp>
19#include <boost/algorithm/string.hpp>
21#include <G4LogicalVolume.hh>
22#include <G4PVPlacement.hh>
26#include <G4UserLimits.hh>
29#include <G4VisAttributes.hh>
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 G4double dx_dosi = activeParams.
getLength(
"dx_dosi") / 2.*CLHEP::cm;
77 G4double dy_dosi = activeParams.
getLength(
"dy_dosi") / 2.*CLHEP::cm;
78 G4double dz_dosi = activeParams.
getLength(
"dz_dosi") / 2.*CLHEP::cm;
79 double thetaZ = activeParams.
getAngle(
"ThetaZ");
80 G4VSolid* s_dosi =
new G4Box(
"s_dosi", dx_dosi, dy_dosi, dz_dosi);
84 l_dosi->SetVisAttributes(green);
86 l_dosi->SetUserLimits(
new G4UserLimits(stepSize));
90 for (
double z : activeParams.
getArray(
"z", {0})) {
96 for (
double r : activeParams.
getArray(
"r", {0})) {
98 r_pos[dim] = r + dz_dosi;
103 G4Transform3D transform;
104 for (
double phi : activeParams.
getArray(
"Phi", {M_PI / 2})) {
106 for (
int i = 0; i < dim; i++) {
107 transform = G4RotateZ3D(phi - M_PI / 2) * G4Translate3D(0, r_pos[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ);
108 new G4PVPlacement(transform, l_dosi, TString::Format(
"p_dosi_%d", detID).Data(), &topVolume,
false, detID);
GearDir is the basic class used for accessing the parameter store.
virtual ~DosiCreator()
Destructor.
DosiCreator()
Constructor.
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Creation of the detector geometry from Gearbox (XML).
SensitiveDetector * m_sensitive
SensitiveDetector DOSI.
Sensitive Detector implementation of the DOSI detector.
double getAngle(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard angle unit.
std::vector< double > getArray(const std::string &path) const noexcept(false)
Get the parameter path as a list of double values converted to the standard unit.
double getLength(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard length unit.
static G4Material * get(const std::string &name)
Find given material.
geometry::CreatorFactory< DosiCreator > DosiFactory("DOSICreator")
Creator creates the DOSI 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.