From 969d3d84ddb4171dac8f7a89404e946240e60f38 Mon Sep 17 00:00:00 2001 From: jhrdinka <julia.hrdinka@cern.ch> Date: Tue, 9 Jan 2018 11:29:28 +0100 Subject: [PATCH] Adapt program options in order to read in multiple dd4hep geometry description files --- Core/include/ACTFW/Utilities/Options.hpp | 12 ++++++++- .../Plugins/DD4hep/DD4hepDetectorOptions.hpp | 25 ++++++++++--------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Core/include/ACTFW/Utilities/Options.hpp b/Core/include/ACTFW/Utilities/Options.hpp index 7a1b76d2..5b9f897a 100644 --- a/Core/include/ACTFW/Utilities/Options.hpp +++ b/Core/include/ACTFW/Utilities/Options.hpp @@ -11,7 +11,8 @@ #include <string> -using read_range = std::vector<double>; +using read_range = std::vector<double>; +using read_strings = std::vector<std::string>; namespace std { std::ostream& @@ -22,6 +23,15 @@ operator<<(std::ostream& os, const read_range& vec) } return os; } + +std::ostream& +operator<<(std::ostream& os, const read_strings& vec) +{ + for (auto item : vec) { + os << item << " "; + } + return os; +} } #endif // ACTFW_OPTIONS_H diff --git a/Plugins/DD4hep/include/ACTFW/Plugins/DD4hep/DD4hepDetectorOptions.hpp b/Plugins/DD4hep/include/ACTFW/Plugins/DD4hep/DD4hepDetectorOptions.hpp index 9b650352..604f667a 100644 --- a/Plugins/DD4hep/include/ACTFW/Plugins/DD4hep/DD4hepDetectorOptions.hpp +++ b/Plugins/DD4hep/include/ACTFW/Plugins/DD4hep/DD4hepDetectorOptions.hpp @@ -31,12 +31,13 @@ namespace Options { { opt.add_options()( "dd4hep-input", - po::value<std::string>()->default_value( - "file:Detectors/DD4hepDetector/compact/FCChhTrackerTkLayout.xml"), - "The location of the input DD4hep file, use 'file:foo.xml'")( - "dd4hep-envelopeR", - po::value<double>()->default_value(0.), - "The envelop cover in R for DD4hep volumes.")( + po::value<read_strings>()->multitoken()->default_value( + {"file:Detectors/DD4hepDetector/compact/FCChhTrackerTkLayout.xml"}), + "The locations of the input DD4hep files, use 'file:foo.xml'. In case " + "you want to read in multiple files, just seperate the strings by " + "space.")("dd4hep-envelopeR", + po::value<double>()->default_value(0.), + "The envelop cover in R for DD4hep volumes.")( "dd4hep-envelopeZ", po::value<double>()->default_value(0.), "The envelop cover in z for DD4hep volumes.")( @@ -62,12 +63,12 @@ namespace Options { // DETECTOR configuration: // -------------------------------------------------------------------------------- FW::DD4hep::GeometryService::Config gsConfig("GeometryService", logLevel); - gsConfig.xmlFileName = vm["dd4hep-input"].template as<std::string>(); - gsConfig.bTypePhi = Acts::equidistant; - gsConfig.bTypeR = Acts::arbitrary; - gsConfig.bTypeZ = Acts::equidistant; - gsConfig.envelopeR = vm["dd4hep-envelopeR"].template as<double>(); - gsConfig.envelopeZ = vm["dd4hep-envelopeZ"].template as<double>(); + gsConfig.xmlFileNames = vm["dd4hep-input"].template as<read_strings>(); + gsConfig.bTypePhi = Acts::equidistant; + gsConfig.bTypeR = Acts::arbitrary; + gsConfig.bTypeZ = Acts::equidistant; + gsConfig.envelopeR = vm["dd4hep-envelopeR"].template as<double>(); + gsConfig.envelopeZ = vm["dd4hep-envelopeZ"].template as<double>(); gsConfig.buildDigitizationModules = vm["dd4hep-digitizationmodules"].template as<bool>(); return gsConfig; -- GitLab