EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DD4hepGeometryService.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DD4hepGeometryService.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 
17 
18 #include <functional>
19 #include <memory>
20 
21 #include <DD4hep/DetElement.h>
22 #include <DD4hep/Detector.h>
23 #include <TGeoNode.h>
24 
25 namespace ActsExamples {
26 namespace DD4hep {
27 
35 class DD4hepGeometryService final : public BareService {
36  public:
37  struct Config {
41  std::vector<std::string> xmlFileNames;
43  std::string name;
56  double envelopeR;
62  double envelopeZ;
64  std::function<void(std::vector<dd4hep::DetElement>& detectors)>
67  std::shared_ptr<const Acts::IMaterialDecorator> matDecorator = nullptr;
68  };
69 
70  DD4hepGeometryService(const Config& cfg);
71  ~DD4hepGeometryService() final override;
72 
75  dd4hep::DetElement dd4hepGeometry();
76 
79  TGeoNode* tgeoGeometry();
80 
82  dd4hep::Detector* lcdd();
83 
87  std::unique_ptr<const Acts::TrackingGeometry> trackingGeometry(
88  const Acts::GeometryContext& gctx);
89 
90  private:
92  ActsExamples::ProcessCode buildDD4hepGeometry();
93 
95  ActsExamples::ProcessCode buildTrackingGeometry(
96  const Acts::GeometryContext& gctx);
97 
101  dd4hep::Detector* m_lcdd = nullptr;
103  dd4hep::DetElement m_dd4hepGeometry;
105  std::unique_ptr<const Acts::TrackingGeometry> m_trackingGeometry;
106 };
107 
108 } // namespace DD4hep
109 } // namespace ActsExamples