11 #include <beast/claws/geometry/CLAWSCreator.h>
12 #include <beast/claws/simulation/SensitiveDetector.h>
14 #include <geometry/Materials.h>
15 #include <geometry/CreatorFactory.h>
16 #include <framework/gearbox/GearDir.h>
17 #include <framework/gearbox/Unit.h>
19 #include <G4LogicalVolume.hh>
20 #include <G4PVPlacement.hh>
23 #include <G4UserLimits.hh>
36 geometry::CreatorFactory<CLAWSCreator>
CLAWSFactory(
"CLAWSCreator");
45 CLAWSCreator::~CLAWSCreator()
54 std::string name = params.getString(
"@name");
55 if (!prefix.empty()) {
56 name = prefix +
"." + name;
58 const std::string type = params.getString(
"@type");
59 const std::string material = params.getString(
"material",
"");
60 std::vector<double> ri = params.getArray(
"r", {0});
62 if (ri.size() > 1) phase = 1;
65 const double top = params.getLength(
"top", 0) /
Unit::mm * CLHEP::mm;
66 const double u = params.getLength(
"u", 0) /
Unit::mm * CLHEP::mm;
67 const bool active = params.getBool(
"active",
false);
70 if (!material.empty()) {
73 G4VSolid* shape{
nullptr};
76 const double length = params.getLength(
"length") /
Unit::mm * CLHEP::mm;
77 const double width = params.getLength(
"width") /
Unit::mm * CLHEP::mm;
78 height = params.getLength(
"height") /
Unit::mm * CLHEP::mm;
79 shape =
new G4Box(name, width / 2, height / 2, length / 2);
80 }
else if (type ==
"tube") {
81 const double length = params.getLength(
"length") /
Unit::mm * CLHEP::mm;
82 height = params.getLength(
"diameter") /
Unit::mm * CLHEP::mm;
83 shape =
new G4Tubs(name, 0, height / 2, length / 2, 0, 2 * M_PI);
85 G4LogicalVolume* volume =
new G4LogicalVolume(shape, mat, name);
92 for (
const GearDir& child : params.getNodes(
"shape")) {
99 double center = ri[0] /
Unit::mm * CLHEP::mm + roffset - height / 2 - top;
101 for (
double phi : params.getArray(
"phi", {M_PI / 2})) {
102 for (
double z : params.getArray(
"z", {0})) {
104 G4Transform3D transform = G4RotateZ3D(phi - M_PI / 2) * G4Translate3D(u, center, z);
105 new G4PVPlacement(transform, volume, name, parent,
false, copyNo++, check);
110 std::vector<double> alpha = params.getArray(
"alpha", {0});
111 for (
double z : params.getArray(
"z", {0})) {
112 double center = ri[i] /
Unit::mm * CLHEP::mm + roffset - height / 2 - top;
115 for (
double phi : params.getArray(
"phi", {M_PI / 2})) {
116 G4Transform3D transform = G4RotateZ3D(phi - M_PI / 2) * G4Translate3D(u, center, z) * G4RotateY3D(alpha[i]);
117 new G4PVPlacement(transform, volume, name, parent,
false, copyNo++, check);
130 double stepLength = content.getLength(
"stepLength", 0) /
Unit::mm * CLHEP::mm;
131 if (stepLength > 0) {
135 for (
auto shape : content.getNodes(
"shape")) {