13 #include <boost/program_options.hpp>
15 using namespace Acts::UnitLiterals;
17 namespace ActsExamples {
19 void AlignedDetectorWithOptions::addOptions(
20 boost::program_options::options_description& opt)
const {
26 boost::program_options::value<size_t>()->default_value(1324354657),
27 "Seed for the decorator random numbers.")(
29 boost::program_options::value<size_t>()->default_value(100),
30 "Size of a valid IOV.")(
32 boost::program_options::value<size_t>()->default_value(200),
33 "Span until garbage collection is active.")(
34 "align-no-gc", boost::program_options::bool_switch())(
36 boost::program_options::value<double>()->default_value(100.),
37 "Sigma of the in-plane misalignment in [um]")(
39 boost::program_options::value<double>()->default_value(50.),
40 "Sigma of the out-of-plane misalignment in [um]")(
42 boost::program_options::value<double>()->default_value(20.),
43 "Sigma of the in-plane rotation misalignment in [mrad]")(
45 boost::program_options::value<double>()->default_value(0.),
46 "Sigma of the out-of-plane rotation misalignment in [mrad]")(
48 boost::program_options::value<size_t>()->default_value(3),
49 "Output log level of the alignment decorator.")(
51 boost::program_options::value<bool>()->default_value(
false),
52 "Keep the first iov batch nominal.")(
54 boost::program_options::value<std::string>()->default_value(
"internal"));
58 const boost::program_options::variables_map& vm,
59 std::shared_ptr<const Acts::IMaterialDecorator> mdecorator)
60 -> std::pair<TrackingGeometryPtr, ContextDecorators> {
66 cfg.buildLevel = vm[
"geo-generic-buildlevel"].template as<size_t>();
75 cfg.buildProto = (vm[
"mat-input-type"].template as<std::string>() ==
"proto");
77 cfg.decoratorLogLevel =
80 cfg.seed = vm[
"align-seed"].template as<size_t>();
81 cfg.iovSize = vm[
"align-iovsize"].template as<size_t>();
82 cfg.flushSize = vm[
"align-flushsize"].template as<size_t>();
83 cfg.doGarbageCollection = !vm[
"align-no-gc"].as<
bool>();
86 cfg.sigmaInPlane = vm[
"align-sigma-iplane"].template as<double>() * 1_um;
87 cfg.sigmaOutPlane = vm[
"align-sigma-oplane"].template as<double>() * 1_um;
88 cfg.sigmaInRot = vm[
"align-sigma-irot"].template as<double>() * 0.001;
89 cfg.sigmaOutRot = vm[
"align-sigma-orot"].template as<double>() * 0.001;
90 cfg.firstIovNominal = vm[
"align-firstnominal"].template as<bool>();
93 if (mode ==
"external") {
94 cfg.mode = Config::Mode::External;
95 }
else if (mode ==
"internal") {
96 cfg.mode = Config::Mode::Internal;
98 throw std::invalid_argument{
99 "--align-mode must be 'external' or 'internal'"};
102 return m_detector.finalize(cfg, mdecorator);