Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DD4hepDetectorOptions.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DD4hepDetectorOptions.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
14 
15 #include <cstdlib>
16 #include <utility>
17 
18 #include <boost/program_options.hpp>
19 
20 namespace po = boost::program_options;
21 
22 namespace ActsExamples {
23 
24 namespace Options {
25 
27 template <typename aopt_t>
28 void addDD4hepOptions(aopt_t& opt) {
29  opt.add_options()(
30  "dd4hep-input", po::value<std::vector<std::string>>(),
31  "The locations of the input DD4hep files, use 'file:foo.xml'. In case "
32  "you want to read in multiple files, add the option multiple times.")(
33  "dd4hep-envelopeR", po::value<double>()->default_value(1.),
34  "The envelop cover in R for DD4hep volumes in mm.")(
35  "dd4hep-envelopeR", po::value<double>()->default_value(1.),
36  "The tolerance added to the geometrical extension in r of the "
37  "layers contained to build the volume envelope around in mm.")(
38  "dd4hep-envelopeZ", po::value<double>()->default_value(1.),
39  "The tolerance added to the geometrical extension in z of the "
40  "layers contained to build the volume envelope around in mm.")(
41  "dd4hep-layerThickness", po::value<double>()->default_value(10e-10),
42  "In case no surfaces (to be contained by the layer) are handed over, "
43  "the layer thickness will be set to this value.")(
44  "dd4hep-buildFCChh", po::value<bool>()->default_value(true),
45  "If you are not building the FCChh detector please set this flag to "
46  "false.")("dd4hep-loglevel", po::value<size_t>()->default_value(2),
47  "The output log level of the geometry building. Please set the "
48  "wished "
49  "number (0 = VERBOSE, 1 = "
50  "DEBUG, 2 = INFO, 3 = WARNING, 4 = ERROR, 5 = FATAL).");
51 }
52 
54 template <typename amap_t>
56  const amap_t& vm) {
57  using namespace Acts::UnitLiterals;
59  gsConfig.logLevel =
60  Acts::Logging::Level(vm["dd4hep-loglevel"].template as<size_t>());
61  gsConfig.xmlFileNames =
62  vm["dd4hep-input"].template as<std::vector<std::string>>();
63  gsConfig.bTypePhi = Acts::equidistant;
64  gsConfig.bTypeR = Acts::arbitrary;
65  gsConfig.bTypeZ = Acts::equidistant;
66  gsConfig.envelopeR = vm["dd4hep-envelopeR"].template as<double>() * 1_mm;
67  gsConfig.envelopeZ = vm["dd4hep-envelopeZ"].template as<double>() * 1_mm;
68  gsConfig.defaultLayerThickness =
69  vm["dd4hep-layerThickness"].template as<double>() * 1_mm;
70  if (vm["dd4hep-buildFCChh"].template as<bool>()) {
71  gsConfig.sortDetectors = ActsExamples::DD4hep::sortFCChhDetElements;
72  }
73  return gsConfig;
74 }
75 } // namespace Options
76 } // namespace ActsExamples