EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DD4hepLayerBuilder.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DD4hepLayerBuilder.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2018 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 #include "Acts/Utilities/Units.hpp"
18 
19 class TGeoMatrix;
20 
21 namespace dd4hep {
22 class DetElement;
23 }
24 
25 namespace Acts {
26 
33 
35  public:
38  struct Config {
40  std::string configurationName = "undefined";
42  std::shared_ptr<const LayerCreator> layerCreator = nullptr;
56  std::vector<dd4hep::DetElement> negativeLayers;
59  std::vector<dd4hep::DetElement> centralLayers;
64  std::vector<dd4hep::DetElement> positiveLayers;
76  };
77 
82  std::unique_ptr<const Logger> logger);
84  ~DD4hepLayerBuilder() override;
85 
91  const LayerVector negativeLayers(const GeometryContext& gctx) const final;
92 
98  const LayerVector centralLayers(const GeometryContext& gctx) const final;
99 
105  const LayerVector positiveLayers(const GeometryContext& gctx) const final;
106 
109  const std::string& identification() const final;
110 
113  void setConfiguration(const Config& config);
114 
116  Config getConfiguration() const;
117 
119  void setLogger(std::unique_ptr<const Logger> logger);
120 
121  private:
124 
126  std::unique_ptr<const Logger> m_logger;
127 
129  const Logger& logger() const { return *m_logger; }
130 
137  const GeometryContext& gctx,
138  const std::vector<dd4hep::DetElement>& dendcapLayers,
139  const std::string& side) const;
140 
147  void resolveSensitive(
148  const dd4hep::DetElement& detElement,
149  std::vector<std::shared_ptr<const Acts::Surface>>& surfaces) const;
150 
157  std::shared_ptr<const Acts::Surface> createSensitiveSurface(
158  const dd4hep::DetElement& detElement, bool isDisc = false) const;
159 
160  // Private helper function to convert the TGeo transformation matrix into
161  // an Acts transformation matrix
162  // @param tGeoTrans TGeo transformation matrix which should be converted
163  Acts::Transform3D convertTransform(const TGeoMatrix* tGeoTrans) const;
164 };
165 
166 inline const std::string& DD4hepLayerBuilder::identification() const {
167  return m_cfg.configurationName;
168 }
169 
171  return m_cfg;
172 }
173 
174 } // namespace Acts