EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SurfaceMaterialMapper.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SurfaceMaterialMapper.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018-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 
11 // Workaround for building on clang+libstdc++
13 
27 
28 namespace Acts {
29 
30 class TrackingGeometry;
31 
34  bool operator()(const Surface& sf) const {
35  return (sf.surfaceMaterial() != nullptr);
36  }
37 };
38 
41  bool operator()(const TrackingVolume& vf) const {
42  return (vf.volumeMaterial() != nullptr);
43  }
44 };
45 
73  public:
75 
79  struct Config {
81  std::array<double, 2> etaRange = {{-6., 6.}};
83  bool emptyBinCorrection = true;
85  bool mapperDebugOutput = false;
86  };
87 
91  struct State {
93  State(std::reference_wrapper<const GeometryContext> gctx,
94  std::reference_wrapper<const MagneticFieldContext> mctx)
95  : geoContext(gctx), magFieldContext(mctx) {}
96 
98  std::map<GeometryIdentifier, AccumulatedSurfaceMaterial>
100 
102  std::map<GeometryIdentifier, std::unique_ptr<const ISurfaceMaterial>>
104 
106  std::map<GeometryIdentifier, std::shared_ptr<const IVolumeMaterial>>
108 
110  std::reference_wrapper<const GeometryContext> geoContext;
111 
113  std::reference_wrapper<const MagneticFieldContext> magFieldContext;
114  };
115 
117  SurfaceMaterialMapper() = delete;
118 
124  SurfaceMaterialMapper(const Config& cfg, StraightLinePropagator propagator,
125  std::unique_ptr<const Logger> slogger =
126  getDefaultLogger("SurfaceMaterialMapper",
127  Logging::INFO));
128 
137  const MagneticFieldContext& mctx,
138  const TrackingGeometry& tGeometry) const;
139 
147  void finalizeMaps(State& mState) const;
148 
156  void mapMaterialTrack(State& mState, RecordedMaterialTrack& mTrack) const;
157 
158  private:
163  void resolveMaterialSurfaces(State& mState,
164  const TrackingVolume& tVolume) const;
165 
170  void checkAndInsert(State& /*mState*/, const Surface& surface) const;
171 
176  void collectMaterialVolumes(State& /*mState*/,
177  const TrackingVolume& tVolume) const;
178 
180  const Logger& logger() const { return *m_logger; }
181 
184 
187 
189  std::unique_ptr<const Logger> m_logger;
190 };
191 } // namespace Acts