Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DD4hepDetectorSurfaceFactory.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DD4hepDetectorSurfaceFactory.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2023 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 <tuple>
19 #include <vector>
20 
21 #include <DD4hep/DD4hepUnits.h>
22 
23 class TGeoMatrix;
24 
25 namespace dd4hep {
26 class DetElement;
27 }
28 
29 namespace Acts {
30 
31 using namespace UnitLiterals;
32 
33 class DD4hepDetectorElement;
34 
40  public:
43  std::tuple<std::shared_ptr<DD4hepDetectorElement>,
44  std::shared_ptr<Surface>>;
45 
48  using DD4hepPassiveSurface = std::tuple<std::shared_ptr<Surface>, bool>;
49 
51  struct Cache {
53  std::vector<DD4hepSensitiveSurface> sensitiveSurfaces;
55  std::vector<DD4hepPassiveSurface> passiveSurfaces;
57  std::size_t convertedSurfaces = 0;
59  std::size_t convertedMaterials = 0;
61  std::vector<Experimental::ProtoBinning> binnings = {};
63  std::vector<Experimental::ProtoSupport> supports = {};
64  };
65 
67  struct Options {
69  bool convertSensitive = true;
71  bool convertPassive = true;
73  bool convertMaterial = true;
75  bool convertProxyMaterial = true;
77  ActsScalar surfaceMaterialThickness = 1_mm;
78  };
79 
84  std::unique_ptr<const Logger> mlogger = getDefaultLogger(
85  "DD4hepDetectorSurfaceFactory", Acts::Logging::INFO));
86 
94  void construct(Cache& cache, const dd4hep::DetElement& dd4hepElement,
95  const Options& options);
96 
97  private:
99  static constexpr ActsScalar unitLength =
100  Acts::UnitConstants::mm / dd4hep::millimeter;
101 
103  std::unique_ptr<const Logger> m_logger;
104 
106  const Logger& logger() const { return *m_logger; }
107 
116  void recursiveConstruct(Cache& cache, const dd4hep::DetElement& dd4hepElement,
117  const Options& options, int level);
118 
125  DD4hepSensitiveSurface constructSensitiveComponents(
126  const dd4hep::DetElement& dd4hepElement, const Options& options) const;
127 
134  DD4hepPassiveSurface constructPassiveComponents(
135  const dd4hep::DetElement& dd4hepElement, const Options& options) const;
136 
145  void attachSurfaceMaterial(const dd4hep::DetElement& dd4hepElement,
147  const Options& options) const;
148 };
149 
150 } // namespace Acts