9#include <beast/claws/geometry/CLAWSCreator.h>
10#include <beast/claws/simulation/SensitiveDetector.h>
12#include <geometry/Materials.h>
13#include <geometry/CreatorFactory.h>
14#include <framework/gearbox/GearDir.h>
15#include <framework/gearbox/Unit.h>
17#include <G4LogicalVolume.hh>
18#include <G4PVPlacement.hh>
21#include <G4UserLimits.hh>
57 std::string name = params.getString(
"@name");
58 if (!prefix.empty()) {
59 name = prefix +
"." + name;
61 const std::string type = params.getString(
"@type");
62 const std::string material = params.getString(
"material",
"");
63 std::vector<double> ri = params.getArray(
"r", {0});
65 if (ri.size() > 1) phase = 1;
68 const double top = params.getLength(
"top", 0) /
Unit::mm * CLHEP::mm;
69 const double u = params.getLength(
"u", 0) /
Unit::mm * CLHEP::mm;
70 const bool active = params.getBool(
"active",
false);
73 if (!material.empty()) {
76 G4VSolid* shape{
nullptr};
79 const double length = params.getLength(
"length") /
Unit::mm * CLHEP::mm;
80 const double width = params.getLength(
"width") /
Unit::mm * CLHEP::mm;
81 height = params.getLength(
"height") /
Unit::mm * CLHEP::mm;
82 shape =
new G4Box(name, width / 2, height / 2, length / 2);
83 }
else if (type ==
"tube") {
84 const double length = params.getLength(
"length") /
Unit::mm * CLHEP::mm;
85 height = params.getLength(
"diameter") /
Unit::mm * CLHEP::mm;
86 shape =
new G4Tubs(name, 0, height / 2, length / 2, 0, 2 * M_PI);
88 G4LogicalVolume* volume =
new G4LogicalVolume(shape, mat, name);
95 for (
const GearDir& child : params.getNodes(
"shape")) {
102 double center = ri[0] /
Unit::mm * CLHEP::mm + roffset - height / 2 - top;
104 for (
double phi : params.getArray(
"phi", {M_PI / 2})) {
105 for (
double z : params.getArray(
"z", {0})) {
107 G4Transform3D transform = G4RotateZ3D(phi - M_PI / 2) * G4Translate3D(u, center, z);
108 new G4PVPlacement(transform, volume, name, parent,
false, copyNo++, check);
113 std::vector<double> alpha = params.getArray(
"alpha", {0});
114 for (
double z : params.getArray(
"z", {0})) {
115 double center = ri[i] /
Unit::mm * CLHEP::mm + roffset - height / 2 - top;
118 for (
double phi : params.getArray(
"phi", {M_PI / 2})) {
119 G4Transform3D transform = G4RotateZ3D(phi - M_PI / 2) * G4Translate3D(u, center, z) * G4RotateY3D(alpha[i]);
120 new G4PVPlacement(transform, volume, name, parent,
false, copyNo++, check);
133 double stepLength = content.getLength(
"stepLength", 0) /
Unit::mm * CLHEP::mm;
134 if (stepLength > 0) {
138 for (
auto shape : content.getNodes(
"shape")) {
GearDir is the basic class used for accessing the parameter store.
Base class for all Sensitive Detectors to create hits during simulation.
static const double mm
[millimeters]
void createShape(const std::string &prefix, const GearDir ¶ms, G4LogicalVolume *parent, double roffset, bool check)
create a shape (box or cylinder) from XML description and place all child shapes in it by recursively...
virtual ~CLAWSCreator()
Destructor.
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Creation of the detector geometry from Gearbox (XML).
CLAWSCreator(Simulation::SensitiveDetectorBase *sensitive=nullptr)
Constructor.
G4UserLimits * m_stepLength
pointer to the G4Userlimits to set for sensitive volumes (if any)
Simulation::SensitiveDetectorBase * m_sensitive
pointer to the sensitive detector implementation
G4Material * m_topMaterial
pointer to the material in the top volume to use as default
Sensitive Detector implementation of the CLAWS detector.
static G4Material * get(const std::string &name)
Find given material.
geometry::CreatorFactory< CLAWSCreator > CLAWSFactory("CLAWSCreator")
Creator creates the CLAW 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.