21 #include <DD4hep/DD4hepUnits.h>
22 #include <DD4hep/DetElement.h>
23 #include <DD4hep/DetFactoryHelper.h>
24 #include <DD4hep/Objects.h>
25 #include <DDRec/DetectorData.h>
26 #include <XML/Utilities.h>
58 const xml_comp_t &xmlBinning,
const std::string &bname,
59 const std::vector<std::string> &bvals) {
61 variantParams.set<
int>(
std::string(bname +
"_dim"), bvals.size());
62 for (
const auto &bv : bvals) {
64 int nBins = Acts::getAttrValueOr<int>(xmlBinning,
std::string(
"n" + bv), 0);
67 Acts::getAttrValueOr<int>(xmlBinning,
std::string(bv +
"expansion"), 0);
68 variantParams.set<
int>(bname +
"_" + bv +
"_exp", nExpansion);
72 variantParams.set<
std::string>(bname +
"_" + bv +
"_type",
"equidistant");
74 variantParams.set<
int>(bname +
"_" + bv +
"_n", nBins);
76 variantParams.set<
double>(
77 bname +
"_" + bv +
"_min",
78 xmlBinning.attr<
double>(
std::string(bv +
"min").c_str()));
79 variantParams.set<
double>(
80 bname +
"_" + bv +
"_max",
81 xmlBinning.attr<
double>(
std::string(bv +
"max").c_str()));
84 variantParams.set<
std::string>(bname +
"_" + bv +
"_type",
"variable");
89 int end = boundaries.find(del);
92 double unitScalar = 1.;
98 double bR = unitScalar * dd4hep::_toFloat(boundaries.substr(0, end));
99 variantParams.set<
double>(
101 boundaries.erase(boundaries.begin(), boundaries.begin() + end + 1);
102 end = boundaries.find(del);
104 double bR = unitScalar * std::stod(boundaries.substr(0, end));
105 variantParams.set<
double>(bname +
"_" + bv +
"_b" +
std::to_string(ib),
108 variantParams.set<
int>(bname +
"_" + bv +
"_n",
ib);
120 const dd4hep::DetElement &dd4hepElement,
const std::string &bname) {
121 std::vector<Experimental::ProtoBinning> protoBinnings;
124 getParamOr<std::string>(bname +
"_" + ab +
"_type", dd4hepElement,
"");
125 if (not
type.empty()) {
127 auto bType = Acts::detail::AxisBoundaryType::Bound;
130 ? detail::AxisType::Equidistant
131 : detail::AxisType::Variable;
132 int nBins = getParamOr<int>(bname +
"_" + ab +
"_n", dd4hepElement, 0);
134 getParamOr<int>(bname +
"_" + ab +
"_exp", dd4hepElement, 0);
135 if (aType == detail::AxisType::Equidistant) {
137 auto min = getParamOr<ActsScalar>(bname +
"_" + ab +
"_min",
139 auto max = getParamOr<ActsScalar>(bname +
"_" + ab +
"_max",
142 if (bVal ==
binPhi and (max -
min) > 1.9 * M_PI) {
143 bType = Acts::detail::AxisBoundaryType::Closed;
146 bVal, bType,
min, max, nBins, nExpansion));
149 std::vector<ActsScalar>
edges;
150 for (
int ib = 0;
ib <= nBins; ++
ib) {
151 edges.push_back(getParamOr<ActsScalar>(
155 if (bVal ==
binPhi and (edges.back() - edges.front()) > 1.9 * M_PI) {
156 bType = Acts::detail::AxisBoundaryType::Closed;
158 protoBinnings.push_back(
163 return protoBinnings;