ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VolumeMaterialMapper.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file VolumeMaterialMapper.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019-2020 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 
25 
26 namespace Acts {
27 
30  std::vector<std::pair<Acts::MaterialProperties, Acts::Vector3D>>;
31 
32 //
55 
57  public:
59 
61  struct MaterialVolume {
62  bool operator()(const TrackingVolume& vf) const {
63  return (vf.volumeMaterial() != nullptr);
64  }
65  };
66 
70  struct Config {
72  float mappingStep = 1.;
74  bool mapperDebugOutput = false;
75  };
76 
80  struct State {
82  State(std::reference_wrapper<const GeometryContext> gctx,
83  std::reference_wrapper<const MagneticFieldContext> mctx)
84  : geoContext(gctx), magFieldContext(mctx) {}
85 
87  std::map<GeometryID, RecordedMaterialPoint> recordedMaterial;
88 
90  std::map<GeometryID, BinUtility> materialBin;
91 
93  std::map<GeometryID, std::unique_ptr<const IVolumeMaterial>> volumeMaterial;
94 
96  std::reference_wrapper<const GeometryContext> geoContext;
97 
99  std::reference_wrapper<const MagneticFieldContext> magFieldContext;
100  };
101 
103  VolumeMaterialMapper() = delete;
104 
110  VolumeMaterialMapper(const Config& cfg, StraightLinePropagator propagator,
111  std::unique_ptr<const Logger> slogger = getDefaultLogger(
112  "VolumeMaterialMapper", Logging::INFO));
113 
122  const MagneticFieldContext& mctx,
123  const TrackingGeometry& tGeometry) const;
124 
132  void finalizeMaps(State& mState) const;
133 
141  void mapMaterialTrack(State& mState, RecordedMaterialTrack& mTrack) const;
142 
143  private:
148  void resolveMaterialVolume(State& mState,
149  const TrackingVolume& tVolume) const;
150 
155  void checkAndInsert(State& /*mState*/, const TrackingVolume& volume) const;
156 
161  void collectMaterialSurface(State& /*mState*/,
162  const TrackingVolume& tVolume) const;
163 
165  const Logger& logger() const { return *m_logger; }
166 
169 
172 
174  std::unique_ptr<const Logger> m_logger;
175 };
176 
177 } // namespace Acts