Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-12 08:00:18

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Geometry/GeometryContext.hpp"
0012 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0013 #include "Acts/Material/MaterialInteraction.hpp"
0014 #include "Acts/Material/MaterialInteractionAssignment.hpp"
0015 #include "Acts/Material/TrackingGeometryMaterial.hpp"
0016 #include "Acts/Material/interface/IAssignmentFinder.hpp"
0017 #include "Acts/Material/interface/ISurfaceMaterialAccumulator.hpp"
0018 #include "Acts/Utilities/Logger.hpp"
0019 
0020 #include <memory>
0021 #include <utility>
0022 #include <vector>
0023 
0024 namespace Acts {
0025 /// Class that implements the material mapping procedure
0026 /// @ingroup material_mapping
0027 class MaterialMapper {
0028  public:
0029   /// @brief nested configuration struct
0030   struct Config {
0031     /// The assignment finder for material interaction assignments
0032     std::shared_ptr<const IAssignmentFinder> assignmentFinder = nullptr;
0033     /// The material accumulator for surfaces
0034     std::shared_ptr<const ISurfaceMaterialAccumulator>
0035         surfaceMaterialAccumulator = nullptr;
0036   };
0037 
0038   /// @brief nested state struct
0039   ///
0040   /// It holds the states of the sub structs
0041   struct State {
0042     /// State of the surface material accumulator
0043     std::unique_ptr<ISurfaceMaterialAccumulator::State>
0044         surfaceMaterialAccumulatorState;
0045   };
0046 
0047   /// @brief nested options struct
0048   /// holds some options for the delegated calls
0049   struct Options {
0050     /// The assignment options (including vetos and re-assignments)
0051     MaterialInteractionAssignment::Options assignmentOptions;
0052   };
0053 
0054   /// @brief MaterialMapper constructor
0055   ///
0056   /// @param cfg the configuration struct
0057   /// @param mlogger the logger instance
0058   explicit MaterialMapper(
0059       const Config& cfg,
0060       std::unique_ptr<const Logger> mlogger =
0061           getDefaultLogger("BinnedSurfaceMaterialAccumulator", Logging::INFO));
0062 
0063   /// @brief Factory for creating the state
0064   /// @param gctx the geometry context
0065   /// @return Unique pointer to a new material mapping state object
0066   std::unique_ptr<State> createState(const GeometryContext& gctx) const;
0067 
0068   /// @brief Map the material interactions to the surfaces
0069   ///
0070   /// @param state the state object holding the sub states
0071   /// @param gctx the geometry context
0072   /// @param mctx the magnetic field context
0073   /// @param rmTrack the recorded material track
0074   /// @param options the call options (see above)
0075   ///
0076   /// @return the mapped and unmapped material tracks
0077   std::pair<RecordedMaterialTrack, RecordedMaterialTrack> mapMaterial(
0078       State& state, const GeometryContext& gctx,
0079       const MagneticFieldContext& mctx, const RecordedMaterialTrack& rmTrack,
0080       const Options& options = Options{}) const;
0081 
0082   /// Finalize the maps
0083   /// @param state Material mapping state containing collected data
0084   /// @param gctx Geometry context for finalization
0085   /// @return Tracking geometry material map with finalized surface and volume materials
0086   TrackingGeometryMaterial finalizeMaps(const State& state,
0087                                         const GeometryContext& gctx) const;
0088 
0089  private:
0090   /// Access method to the logger
0091   const Logger& logger() const { return *m_logger; }
0092 
0093   /// The configuration
0094   Config m_cfg;
0095 
0096   /// The logger
0097   std::unique_ptr<const Logger> m_logger;
0098 };
0099 
0100 }  // namespace Acts