16 #include "DD4hep/CartesianGridXZ.h"
22 double halflengthX,
double halflengthZ,
double thickness,
26 halflengthX *= scalor;
27 halflengthZ *= scalor;
30 std::make_shared<const Acts::RectangleBounds>(halflengthX, halflengthZ);
31 dd4hep::CartesianGridXZ cartesianGrid = segmentation;
32 if (cartesianGrid.isValid()) {
34 double gridSizeX = cartesianGrid.gridSizeX() * scalor;
35 double gridSizeZ = cartesianGrid.gridSizeZ() * scalor;
37 (cartesianGrid.gridSizeX() != 0) ? (2 * halflengthX) / gridSizeX : 0;
39 (cartesianGrid.gridSizeZ() != 0) ? (2 * halflengthZ) / gridSizeZ : 0;
41 std::shared_ptr<const Acts::CartesianSegmentation> actsSegmentation =
42 std::make_shared<const Acts::CartesianSegmentation>(bounds, bins0,
46 return (std::make_shared<const Acts::DigitizationModule>(actsSegmentation,
53 double halflengthX,
double halflengthZ,
double thickness,
double gridSizeX,
57 halflengthX *= scalor;
58 halflengthZ *= scalor;
61 std::make_shared<const Acts::RectangleBounds>(halflengthX, halflengthZ);
64 (gridSizeX != 0) ? (2 * halflengthX) / (gridSizeX * scalor) : 0;
66 (gridSizeZ != 0) ? (2 * halflengthZ) / (gridSizeZ * scalor) : 0;
68 std::shared_ptr<const Acts::CartesianSegmentation> actsSegmentation =
69 std::make_shared<const Acts::CartesianSegmentation>(bounds, bins0, bins1);
73 return (std::make_shared<const Acts::DigitizationModule>(actsSegmentation,
78 double minHalflengthX,
double maxHalflengthX,
double halflengthZ,
82 minHalflengthX *= scalor;
83 maxHalflengthX *= scalor;
84 halflengthZ *= scalor;
87 auto bounds = std::make_shared<const Acts::TrapezoidBounds>(
88 minHalflengthX, maxHalflengthX, halflengthZ);
90 dd4hep::CartesianGridXZ cartesianGrid = segmentation;
91 if (cartesianGrid.isValid()) {
93 double gridSizeX = cartesianGrid.gridSizeX() * scalor;
94 double gridSizeZ = cartesianGrid.gridSizeZ() * scalor;
96 (cartesianGrid.gridSizeX() != 0) ? (2 * maxHalflengthX) / gridSizeX : 0;
98 (cartesianGrid.gridSizeZ() != 0) ? (2 * halflengthZ) / gridSizeZ : 0;
100 std::shared_ptr<const Acts::CartesianSegmentation> actsSegmentation =
101 std::make_shared<const Acts::CartesianSegmentation>(bounds, bins0,
105 return (std::make_shared<const Acts::DigitizationModule>(actsSegmentation,
112 double minHalflengthX,
double maxHalflengthX,
double halflengthZ,
113 double thickness,
double gridSizeX,
double gridSizeZ) {
116 minHalflengthX *= scalor;
117 maxHalflengthX *= scalor;
118 halflengthZ *= scalor;
121 auto bounds = std::make_shared<const Acts::TrapezoidBounds>(
122 minHalflengthX, maxHalflengthX, halflengthZ);
126 (gridSizeX != 0) ? (2 * maxHalflengthX) / (gridSizeX * scalor) : 0;
128 (gridSizeZ != 0) ? (2 * halflengthZ) / (gridSizeZ * scalor) : 0;
130 std::shared_ptr<const Acts::CartesianSegmentation> actsSegmentation =
131 std::make_shared<const Acts::CartesianSegmentation>(bounds, bins0, bins1);
134 return (std::make_shared<const Acts::DigitizationModule>(actsSegmentation,
139 const std::string& nodeName,
140 const std::string& attrName,
141 const std::string& attrValue) {
142 for (dd4hep::xml::Collection_t xCompColl(mother, nodeName.c_str());
143 nullptr != xCompColl; ++xCompColl) {
144 if (xCompColl.attr<std::string>(attrName.c_str()) == attrValue) {
145 return static_cast<dd4hep::xml::Component
>(xCompColl);
149 return dd4hep::xml::Component(
nullptr);
153 const std::string& attrName,
154 const double& defaultValue) {
155 if (node.hasAttr(_Unicode(attrName.c_str()))) {
156 return node.attr<
double>(attrName.c_str());