34 #include <boost/program_options.hpp>
36 namespace ActsExamples {
43 void readTGeoLayerBuilderConfigs(
const Variables& vm,
45 const auto path = vm[
"geo-tgeo-jsonconfig"].template as<std::string>();
50 void writeTGeoDetectorConfig(
const Variables& vm,
52 const auto path = vm[
"geo-tgeo-dump-jsonconfig"].template as<std::string>();
59 djson[
"geo-tgeo-unit-scalor"] = config.unitScalor;
60 djson[
"geo-tgeo-build-beampipe"] = config.buildBeamPipe;
61 djson[
"geo-tgeo-beampipe-parameters"] =
62 std::array<double, 3>{config.beamPipeRadius, config.beamPipeHalflengthZ,
63 config.beamPipeLayerThickness};
66 if (config.volumes.empty()) {
67 config.volumes.emplace_back();
69 djson[
"Volumes"] = config.volumes;
71 outfile << djson.dump(2) << std::endl;
77 boost::program_options::options_description& opt)
const {
80 auto tmp = opt.add_options();
82 tmp(
"geo-tgeo-filename", value<std::string>()->default_value(
""),
84 tmp(
"geo-tgeo-jsonconfig", value<std::string>()->default_value(
""),
85 "Json config file name.");
86 tmp(
"geo-tgeo-dump-jsonconfig",
87 value<std::string>()->default_value(
"tgeo_empty_config.json"),
88 "Json file to dump empty config into.");
92 const boost::program_options::variables_map& vm,
93 std::shared_ptr<const Acts::IMaterialDecorator> mdecorator)
94 -> std::pair<TrackingGeometryPtr, ContextDecorators> {
107 if (vm[
"geo-tgeo-jsonconfig"].as<std::string>().empty()) {
108 writeTGeoDetectorConfig(vm, config);
109 std::exit(EXIT_SUCCESS);
112 else if (not(vm[
"geo-tgeo-dump-jsonconfig"].as<std::string>().
compare(
113 "tgeo_empty_cofig.json") == 0)) {
114 readTGeoLayerBuilderConfigs(vm, config);
115 writeTGeoDetectorConfig(vm, config);
117 readTGeoLayerBuilderConfigs(vm, config);
120 return m_detector.finalize(config,
std::move(mdecorator));