Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DD4hepDetector.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DD4hepDetector.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 
13 
14 #include <stdexcept>
15 
16 #include <boost/program_options.hpp>
17 
18 namespace ActsExamples {
19 namespace DD4hep {
20 
22 
24  std::shared_ptr<DD4hepGeometryService> _geometryService)
25  : geometryService(std::move(_geometryService)) {}
26 
28 
31  std::shared_ptr<const Acts::IMaterialDecorator> mdecorator)
32  -> std::pair<TrackingGeometryPtr, ContextDecorators> {
33  Acts::GeometryContext dd4HepContext;
34  config.matDecorator = std::move(mdecorator);
35  geometryService =
36  std::make_shared<ActsExamples::DD4hep::DD4hepGeometryService>(config);
37  TrackingGeometryPtr dd4tGeometry =
38  geometryService->trackingGeometry(dd4HepContext);
39  if (!dd4tGeometry) {
40  throw std::runtime_error{
41  "Did not receive tracking geometry from DD4hep geometry service"};
42  }
43  ContextDecorators dd4ContextDecorators = {};
44  // return the pair of geometry and empty decorators
45  return std::make_pair<TrackingGeometryPtr, ContextDecorators>(
46  std::move(dd4tGeometry), std::move(dd4ContextDecorators));
47 }
48 
49 } // namespace DD4hep
50 } // namespace ActsExamples