9#include <beast/fangs/geometry/FANGSCreator.h>
10#include <beast/fangs/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 const double r = params.getLength(
"r", 0) /
Unit::mm * CLHEP::mm;
64 const double top = params.getLength(
"top", 0) /
Unit::mm * CLHEP::mm;
65 const double u = params.getLength(
"u", 0) /
Unit::mm * CLHEP::mm;
66 const bool active = params.getBool(
"active",
false);
69 if (!material.empty()) {
72 G4VSolid* shape{
nullptr};
75 const double length = params.getLength(
"length") /
Unit::mm * CLHEP::mm;
76 const double width = params.getLength(
"width") /
Unit::mm * CLHEP::mm;
77 height = params.getLength(
"height") /
Unit::mm * CLHEP::mm;
78 shape =
new G4Box(name, width / 2, height / 2, length / 2);
79 }
else if (type ==
"tube") {
80 const double length = params.getLength(
"length") /
Unit::mm * CLHEP::mm;
81 height = params.getLength(
"diameter") /
Unit::mm * CLHEP::mm;
82 shape =
new G4Tubs(name, 0, height / 2, length / 2, 0, 2 * M_PI);
84 G4LogicalVolume* volume =
new G4LogicalVolume(shape, mat, name);
91 for (
const GearDir& child : params.getNodes(
"shape")) {
96 const double center = r + roffset - height / 2 - top;
97 for (
double phi : params.getArray(
"phi", {M_PI / 2})) {
98 for (
double z : params.getArray(
"z", {0})) {
100 G4Transform3D transform = G4RotateZ3D(phi - M_PI / 2) * G4Translate3D(u, center, z);
101 new G4PVPlacement(transform, volume, name, parent,
false, copyNo++, check);
109 double stepLength = content.getLength(
"stepLength", 0) /
Unit::mm * CLHEP::mm;
110 if (stepLength > 0) {
114 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...
FANGSCreator(Simulation::SensitiveDetectorBase *sensitive=nullptr)
Constructor.
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Creation of the detector geometry from Gearbox (XML).
virtual ~FANGSCreator()
Destructor.
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 FANGS detector.
static G4Material * get(const std::string &name)
Find given material.
geometry::CreatorFactory< FANGSCreator > FANGSFactory("FANGSCreator")
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.