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 
11 // Workaround for building on clang+libstdc++
13 
29 
30 namespace Acts {
31 
34  std::vector<std::pair<Acts::MaterialSlab, std::vector<Acts::Vector3D>>>;
35 
36 //
59 
61  public:
63 
67  struct Config {
69  float mappingStep = 1.;
70  };
71 
75  struct State {
77  State(std::reference_wrapper<const GeometryContext> gctx,
78  std::reference_wrapper<const MagneticFieldContext> mctx)
79  : geoContext(gctx), magFieldContext(mctx) {}
80 
82  std::map<GeometryIdentifier, RecordedMaterialVolumePoint> recordedMaterial;
83 
85  std::map<GeometryIdentifier, BinUtility> materialBin;
86 
88  std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>
90 
92  std::map<GeometryIdentifier, std::unique_ptr<const IVolumeMaterial>>
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:
146  bool operator()(const Surface& sf) const {
147  return (sf.geometryId().boundary() != 0);
148  }
149  };
150 
153  bool operator()(const TrackingVolume& vf) const {
154  return (vf.volumeMaterial() != nullptr);
155  }
156  };
157 
162  void resolveMaterialVolume(State& mState,
163  const TrackingVolume& tVolume) const;
164 
169  void checkAndInsert(State& /*mState*/, const TrackingVolume& volume) const;
170 
175  void collectMaterialSurfaces(State& /*mState*/,
176  const TrackingVolume& tVolume) const;
177 
186  Vector3D direction) const;
187 
189  const Logger& logger() const { return *m_logger; }
190 
193 
196 
198  std::unique_ptr<const Logger> m_logger;
199 };
200 
201 } // namespace Acts