Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CommonGeometry.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CommonGeometry.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 
16 
17 #include <string>
18 
19 #include <boost/program_options.hpp>
20 
21 namespace ActsExamples {
22 namespace Geometry {
23 
33 std::pair<std::shared_ptr<const Acts::TrackingGeometry>,
34  std::vector<std::shared_ptr<ActsExamples::IContextDecorator>>>
35 build(const boost::program_options::variables_map& vm,
37  // Material decoration
38  std::shared_ptr<const Acts::IMaterialDecorator> matDeco = nullptr;
39  auto matType = vm["mat-input-type"].template as<std::string>();
40  if (matType == "none") {
41  matDeco = std::make_shared<const Acts::MaterialWiper>();
42  } else if (matType == "file") {
43  // Retrieve the filename
44  auto fileName = vm["mat-input-file"].template as<std::string>();
45  // json or root based decorator
46  if (fileName.find(".json") != std::string::npos ||
47  fileName.find(".cbor") != std::string::npos) {
48  // Set up the converter first
50  // Set up the json-based decorator
51  matDeco = std::make_shared<const Acts::JsonMaterialDecorator>(
52  jsonGeoConvConfig, fileName, Acts::Logging::INFO);
53  } else if (fileName.find(".root") != std::string::npos) {
54  // Set up the root-based decorator
56  rootMatDecConfig.fileName = fileName;
57  matDeco = std::make_shared<const ActsExamples::RootMaterialDecorator>(
58  rootMatDecConfig, Acts::Logging::INFO);
59  }
60  }
61 
63  return detector.finalize(vm, matDeco);
64 }
65 
66 } // namespace Geometry
67 } // namespace ActsExamples