20 #include <boost/program_options.hpp>
22 namespace po = boost::program_options;
24 namespace ActsExamples {
33 template <
typename options_t>
35 opt.add_options()(
"geo-tgeo-filename",
36 po::value<std::string>()->default_value(
""),
38 "geo-tgeo-worldvolume", po::value<std::string>()->default_value(
""),
39 "Root world volume to start search from.")(
40 "geo-tgeo-unit-scalor", po::value<double>()->default_value(10.),
41 "Unit scalor from ROOT to Acts.")(
42 "geo-tgeo-bp-parameters",
44 po::value<read_range>()->multitoken()->default_value({}),
47 "Potential beam pipe parameters {r, z, t} in [mm].")(
48 "geo-tgeo-nlayers", po::value<read_series>()->default_value({}),
49 "Number of layers on the negative side.")(
50 "geo-tgeo-clayers", po::value<read_series>()->default_value({}),
51 "Number of layers in the barrel.")(
52 "geo-tgeo-players", po::value<read_series>()->default_value({}),
53 "Number of layers on the positive side.")(
54 "geo-tgeo-ringlayout", po::value<read_series>()->default_value({}),
55 "Indicator if ring layout is present.")(
56 "geo-tgeo-ringtolerance", po::value<read_range>()->default_value({}),
57 "Tolerance for ring layout detection in [mm].")(
58 "geo-tgeo-nvolume-name", po::value<read_strings>()->default_value({}),
59 "Name identifier of the volume for searching negative layers.")(
60 "geo-tgeo-cvolume-name", po::value<read_strings>()->default_value({}),
61 "Name identifier of the volume for searching central layers.")(
62 "geo-tgeo-pvolume-name", po::value<read_strings>()->default_value({}),
63 "Name identifier of the volume for searching positive layers.")(
64 "geo-tgeo-nmodule-name", po::value<read_strings>()->default_value({}),
65 "Name identifier for negative sensitive objects, odered along the "
66 "series.")(
"geo-tgeo-cmodule-name",
67 po::value<read_strings>()->default_value({}),
68 "Name identifier for central sensitive objects, odered "
70 "geo-tgeo-pmodule-name", po::value<read_strings>()->default_value({}),
71 "Name identifier for positive sensitive objects, odered along the "
72 "series.")(
"geo-tgeo-nlayer-r-range",
73 po::value<std::vector<Interval>>()->default_value({}),
74 "Radial range(s) for negative layers "
75 "to restrict the module parsing (optional).")(
76 "geo-tgeo-clayer-r-range",
77 po::value<std::vector<Interval>>()->default_value({}),
78 "Radial range(s) for central layers "
79 "to restrict the module parsing (optional).")(
80 "geo-tgeo-player-r-range",
81 po::value<std::vector<Interval>>()->default_value({}),
82 "Radial range(s) for positive layers "
83 "to restrict the module parsing (optional).")(
84 "geo-tgeo-nlayer-z-range",
85 po::value<std::vector<Interval>>()->default_value({}),
86 "Longitudinal range(s) for negative layers "
87 "to restrict the module parsing (optional).")(
88 "geo-tgeo-clayer-z-range",
89 po::value<std::vector<Interval>>()->default_value({}),
90 "Longitudinal range(s) for central layers "
91 "to restrict the module parsing (optional).")(
92 "geo-tgeo-player-z-range",
93 po::value<std::vector<Interval>>()->default_value({}),
94 "Longitudinal range(s) for positive layers "
95 "to restrict the module parsing (optional).")(
96 "geo-tgeo-nlayer-r-split", po::value<read_range>()->default_value({}),
97 "R-tolerances (if > 0.) that triggers splitting "
98 " of collected surfaces into different negative layers.")(
99 "geo-tgeo-nlayer-z-split", po::value<read_range>()->default_value({}),
100 "Z-tolerances (if > 0.) that triggers splitting "
101 " of collected surfaces into different negative layers.")(
102 "geo-tgeo-clayer-r-split", po::value<read_range>()->default_value({}),
103 "R-tolerances (if > 0.) that triggers splitting "
104 " of collected surfaces into different central layers.")(
105 "geo-tgeo-clayer-z-split", po::value<read_range>()->default_value({}),
106 "Z-tolerances (if > 0.) that triggers splitting "
107 " of collected surfaces into different central layers.")(
108 "geo-tgeo-player-r-split", po::value<read_range>()->default_value({}),
109 "R-tolerances (if > 0.) that triggers splitting "
110 " of collected surfaces into different positive layers.")(
111 "geo-tgeo-sfbin-z-tolerance",
112 po::value<std::vector<Interval>>()->default_value({}),
113 "Tolerance interval in z [mm] for automated surface binning.")(
114 "geo-tgeo-sfbin-r-tolerance",
115 po::value<std::vector<Interval>>()->default_value({}),
116 "Tolerance interval in r [mm] for automated surface binninng.")(
117 "geo-tgeo-sfbin-phi-tolerance",
118 po::value<std::vector<Interval>>()->default_value({}),
119 "Tolerance interval in phi [rad] for automated surface binning.")(
120 "geo-tgeo-nmodule-axes", po::value<read_strings>()->default_value({}),
121 "Axes definition for negative sensitive objects, odered "
122 "along the series.")(
123 "geo-tgeo-player-z-split", po::value<read_range>()->default_value({}),
124 "Z-tolerances (if > 0.) that triggers splitting "
125 " of collected surfaces into different positive layers.")(
126 "geo-tgeo-cmodule-axes", po::value<read_strings>()->default_value({}),
128 "Axes definition for central sensitive objects, odered along the "
129 "series.")(
"geo-tgeo-pmodule-axes",
130 po::value<read_strings>()->default_value({}),
131 "Axes definition for positive sensitive objects, odered "
132 "along the series.");
143 template <
typename variable_map_t>
145 const variable_map_t& vm) {
146 std::vector<Acts::TGeoLayerBuilder::Config> detLayerConfigs;
150 vm[
"geo-detector-volume"].template as<read_strings>();
151 double unitScalor = vm[
"geo-tgeo-unit-scalor"].template as<double>();
154 read_series nLayers = vm[
"geo-tgeo-nlayers"].template as<read_series>();
155 read_series cLayers = vm[
"geo-tgeo-clayers"].template as<read_series>();
156 read_series pLayers = vm[
"geo-tgeo-players"].template as<read_series>();
158 std::array<read_series, 3> layers = {nLayers, cLayers, pLayers};
160 std::array<size_t, 3> seriesSize = {nLayers.size(), cLayers.size(),
163 read_series ringLayout = vm[
"geo-tgeo-ringlayout"].template as<read_series>();
166 vm[
"geo-tgeo-ringtolerance"].template as<read_range>();
173 vm[
"geo-tgeo-nvolume-name"].template as<read_strings>();
175 vm[
"geo-tgeo-cvolume-name"].template as<read_strings>();
177 vm[
"geo-tgeo-pvolume-name"].template as<read_strings>();
179 std::array<read_strings, 3> volumeName = {nVolumeName, cVolumeName,
183 vm[
"geo-tgeo-nmodule-name"].template as<read_strings>();
185 vm[
"geo-tgeo-cmodule-name"].template as<read_strings>();
187 vm[
"geo-tgeo-pmodule-name"].template as<read_strings>();
190 std::array<read_strings, 3> sensitiveNames = {
191 nSensitiveNames, cSensitiveNames, pSensitiveNames};
194 vm[
"geo-tgeo-nmodule-axes"].template as<read_strings>();
196 vm[
"geo-tgeo-cmodule-axes"].template as<read_strings>();
198 vm[
"geo-tgeo-pmodule-axes"].template as<read_strings>();
200 std::array<read_strings, 3> sensitiveAxes = {nSensitiveAxes, cSensitiveAxes,
204 std::vector<Interval> nRrange =
205 vm[
"geo-tgeo-nlayer-r-range"].template as<std::vector<Interval>>();
206 std::vector<Interval> cRrange =
207 vm[
"geo-tgeo-clayer-r-range"].template as<std::vector<Interval>>();
208 std::vector<Interval> pRrange =
209 vm[
"geo-tgeo-player-r-range"].template as<std::vector<Interval>>();
210 std::array<std::vector<Interval>, 3> rRange = {nRrange, cRrange, pRrange};
213 std::vector<Interval> nZrange =
214 vm[
"geo-tgeo-nlayer-z-range"].template as<std::vector<Interval>>();
215 std::vector<Interval> cZrange =
216 vm[
"geo-tgeo-clayer-z-range"].template as<std::vector<Interval>>();
217 std::vector<Interval> pZrange =
218 vm[
"geo-tgeo-player-z-range"].template as<std::vector<Interval>>();
219 std::array<std::vector<Interval>, 3> zRange = {nZrange, cZrange, pZrange};
223 vm[
"geo-tgeo-nlayer-r-split"].template as<read_range>();
225 vm[
"geo-tgeo-nlayer-z-split"].template as<read_range>();
227 vm[
"geo-tgeo-clayer-r-split"].template as<read_range>();
229 vm[
"geo-tgeo-clayer-z-split"].template as<read_range>();
231 vm[
"geo-tgeo-player-r-split"].template as<read_range>();
233 vm[
"geo-tgeo-player-z-split"].template as<read_range>();
235 std::array<read_range, 3> splitTolR = {nLayerSplitR, cLayerSplitR,
238 std::array<read_range, 3> splitTolZ = {nLayerSplitZ, cLayerSplitZ,
242 std::vector<Interval> binToleranceR =
243 vm[
"geo-tgeo-sfbin-r-tolerance"].template as<std::vector<Interval>>();
244 std::vector<Interval> binToleranceZ =
245 vm[
"geo-tgeo-sfbin-z-tolerance"].template as<std::vector<Interval>>();
246 std::vector<Interval> binTolerancePhi =
247 vm[
"geo-tgeo-sfbin-phi-tolerance"].template as<std::vector<Interval>>();
250 size_t max_series = *std::max_element(seriesSize.begin(), seriesSize.end());
251 std::array<size_t, 3> ti = {0, 0, 0};
256 auto beamPipeParameters =
257 vm[
"geo-tgeo-bp-parameters"].template as<read_range>();
258 if (beamPipeParameters.size() > 2) {
264 [](
const std::string& sensorNames) -> std::vector<std::string> {
265 std::vector<std::string> sensors;
266 std::istringstream feed(sensorNames);
268 while (
getline(feed, split,
'|')) {
269 sensors.push_back(split);
275 for (
size_t idet = 0; idet < max_series; ++idet) {
280 if (binTolerancePhi.size() == binToleranceZ.size() and
281 binToleranceR.size() == binToleranceZ.size()) {
284 auto tolR = binToleranceR[idet];
285 std::vector<std::pair<double, double>> binTolerances{(int)
Acts::binValues,
287 binTolerances[
Acts::binR] = {tolR.lower.value_or(0.),
288 tolR.upper.value_or(0.)};
290 auto tolZ = binToleranceZ[idet];
291 binTolerances[
Acts::binZ] = {tolZ.lower.value_or(0.),
292 tolZ.upper.value_or(0.)};
293 auto tolPhi = binTolerancePhi[idet];
294 binTolerances[
Acts::binPhi] = {tolPhi.lower.value_or(0.),
295 tolPhi.upper.value_or(0.)};
302 for (
unsigned int ncp = 0; ncp < 3; ++ncp) {
304 unsigned int nl = layers[ncp].size() > idet ? layers[ncp][idet] : 0;
305 for (
unsigned int in = 0;
in < nl; ++
in, ++ti[ncp]) {
308 lConfig.
volumeName = volumeName[ncp][ti[ncp]];
309 lConfig.
sensorNames = splitAtOr(sensitiveNames[ncp][ti[ncp]]);
310 lConfig.
localAxes = sensitiveAxes[ncp][ti[ncp]];
313 auto rR = rRange[ncp];
314 if (rR.size() > ti[ncp]) {
315 double rMin = rR[ti[ncp]].lower.value_or(0.);
321 if (splitTolR[ncp].size() > ti[ncp]) {
322 double rsp = splitTolR[ncp][ti[ncp]];
328 auto zR = zRange[ncp];
329 if (zR.size() > ti[ncp]) {
337 if (splitTolZ[ncp].size() > ti[ncp]) {
338 double zsp = splitTolZ[ncp][ti[ncp]];
349 layerBuilderConfig.
unit = unitScalor;
352 detLayerConfigs.push_back(layerBuilderConfig);
354 return detLayerConfigs;