ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PayloadDetector.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PayloadDetector.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 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 
10 
11 #include <boost/program_options.hpp>
12 
23 
25  boost::program_options::options_description& opt) const {
28  // Add the bfield options for the magnetic field scaling
30  // specify the rotation setp
31  opt.add_options()(
32  "align-rotation-step",
33  boost::program_options::value<double>()->default_value(0.25 * M_PI),
34  "Rotation step of the RotationDecorator")(
35  "align-loglevel",
36  boost::program_options::value<size_t>()->default_value(3),
37  "Output log level of the alignment decorator.");
38 }
39 
41  const boost::program_options::variables_map& vm,
42  std::shared_ptr<const Acts::IMaterialDecorator> mdecorator)
43  -> std::pair<TrackingGeometryPtr, ContextDecorators> {
44  // --------------------------------------------------------------------------------
45  DetectorElement::ContextType nominalContext;
46  // set geometry building logging level
47  Acts::Logging::Level surfaceLogLevel =
48  Acts::Logging::Level(vm["geo-surface-loglevel"].template as<size_t>());
49  Acts::Logging::Level layerLogLevel =
50  Acts::Logging::Level(vm["geo-layer-loglevel"].template as<size_t>());
51  Acts::Logging::Level volumeLogLevel =
52  Acts::Logging::Level(vm["geo-volume-loglevel"].template as<size_t>());
53 
54  bool buildProto =
55  (vm["mat-input-type"].template as<std::string>() == "proto");
56 
58  TrackingGeometryPtr pTrackingGeometry =
59  FW::Generic::buildDetector<DetectorElement>(
60  nominalContext, detectorStore, 0, std::move(mdecorator), buildProto,
61  surfaceLogLevel, layerLogLevel, volumeLogLevel);
62 
63  ContextDecorators pContextDecorators = {};
64 
65  // Alignment service
66  Decorator::Config agcsConfig;
67  agcsConfig.trackingGeometry = pTrackingGeometry;
68  agcsConfig.rotationStep = vm["align-rotation-step"].template as<double>();
69 
70  Acts::Logging::Level decoratorLogLevel =
71  Acts::Logging::Level(vm["align-loglevel"].template as<size_t>());
72 
73  // Create the service
74  auto agcDecorator = std::make_shared<Decorator>(
75  agcsConfig,
76  Acts::getDefaultLogger("PayloadDecorator", decoratorLogLevel));
77  pContextDecorators.push_back(agcDecorator);
78 
79  if (vm["bf-context-scalable"].template as<bool>()) {
81  bfsConfig.scalor = vm["bf-bscalor"].template as<double>();
82 
83  auto bfDecorator = std::make_shared<FW::BField::BFieldScalor>(bfsConfig);
84 
85  pContextDecorators.push_back(bfDecorator);
86  }
87 
88  // return the pair of geometry and the alignment decorator(s)
89  return std::make_pair<TrackingGeometryPtr, ContextDecorators>(
90  std::move(pTrackingGeometry), std::move(pContextDecorators));
91 }