File indexing completed on 2025-01-18 09:27:41
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Units.hpp"
0012 #include "Acts/Detector/ProtoBinning.hpp"
0013 #include "Acts/Geometry/Extent.hpp"
0014 #include "Acts/Plugins/DD4hep/DD4hepConversionHelpers.hpp"
0015 #include "Acts/Utilities/BinningData.hpp"
0016 #include "Acts/Utilities/detail/AxisFwd.hpp"
0017
0018 #include <optional>
0019 #include <sstream>
0020 #include <string>
0021 #include <tuple>
0022 #include <vector>
0023
0024 #include <DDRec/DetectorData.h>
0025
0026 namespace Acts {
0027
0028 static std::vector<std::tuple<std::string, BinningValue>> allowedBinnings = {
0029 {"x", binX}, {"y", binY}, {"z", binZ}, {"phi", binPhi}, {"r", binR}};
0030
0031
0032
0033
0034
0035
0036 inline BinningValue stringToBinningValue(const std::string &binningString) {
0037 if (binningString == "x") {
0038 return binX;
0039 } else if (binningString == "y") {
0040 return binY;
0041 } else if (binningString == "z") {
0042 return binZ;
0043 } else if (binningString == "phi") {
0044 return binPhi;
0045 } else if (binningString == "r") {
0046 return binR;
0047 } else {
0048 throw std::invalid_argument("DD4hepBinningHelpers: Binning value " +
0049 binningString + " not allowed.");
0050 }
0051 }
0052
0053
0054
0055
0056
0057
0058
0059
0060 inline std::vector<BinningValue> stringToBinningValues(
0061 const std::string &binningString, const char &del = ',') {
0062 if (binningString.empty()) {
0063 return {};
0064 }
0065 std::vector<BinningValue> bBinning;
0066 std::stringstream s(binningString);
0067 std::string b = "";
0068 while (getline(s, b, del)) {
0069 bBinning.push_back(stringToBinningValue(b));
0070 }
0071 return bBinning;
0072 }
0073
0074 namespace DD4hepBinningHelpers {
0075
0076
0077
0078
0079
0080
0081
0082 std::vector<Acts::Experimental::ProtoBinning> convertBinning(
0083 const dd4hep::DetElement &dd4hepElement, const std::string &bname);
0084
0085 }
0086 }