Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-13 08:12:47

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/ISurfaceMaterialAccumulater.hpp"
0018 #include "Acts/Utilities/Logger.hpp"
0019 
0020 #include <memory>
0021 #include <utility>
0022 #include <vector>
0023 
0024 namespace Acts {
0025 /// @brief material mapping procedure
0026 class MaterialMapper {
0027  public:
0028   using SurfaceMaterialMap
0029       [[deprecated("Use Acts::SurfaceMaterialMaps directly")]] =
0030           SurfaceMaterialMaps;
0031   using VolumeMaterialMap
0032       [[deprecated("Use Acts::VolumeMaterialMaps directly")]] =
0033           VolumeMaterialMaps;
0034   using DetectorMaterialMaps
0035       [[deprecated("Use Acts::TrackingGeometryMaterial directly")]] =
0036           TrackingGeometryMaterial;
0037 
0038   /// @brief nested configuration struct
0039   struct Config {
0040     // The assignment finder
0041     std::shared_ptr<const IAssignmentFinder> assignmentFinder = nullptr;
0042     // The material accumulater for surfaces
0043     std::shared_ptr<const ISurfaceMaterialAccumulater>
0044         surfaceMaterialAccumulater = nullptr;
0045   };
0046 
0047   /// @brief nested state struct
0048   ///
0049   /// It holds the states of the sub structs
0050   struct State {
0051     std::unique_ptr<ISurfaceMaterialAccumulater::State>
0052         surfaceMaterialAccumulaterState;
0053   };
0054 
0055   /// @brief nested options struct
0056   /// holds some options for the delegated calls
0057   struct Options {
0058     // The assignment options (including vetos and re-assignments)
0059     MaterialInteractionAssignment::Options assignmentOptions;
0060   };
0061 
0062   /// @brief MaterialMapper constructor
0063   ///
0064   /// @param cfg the configuration struct
0065   /// @param mlogger the logger instance
0066   explicit MaterialMapper(
0067       const Config& cfg,
0068       std::unique_ptr<const Logger> mlogger =
0069           getDefaultLogger("BinnedSurfaceMaterialAccumulater", Logging::INFO));
0070 
0071   /// @brief Factory for creating the state
0072   std::unique_ptr<State> createState() const;
0073 
0074   /// @brief Map the material interactions to the surfaces
0075   ///
0076   /// @param state the state object holding the sub states
0077   /// @param gctx the geometry context
0078   /// @param mctx the magnetic field context
0079   /// @param rmTrack the recorded material track
0080   /// @param options the call options (see above)
0081   ///
0082   /// @return the mapped and unmapped material tracks
0083   std::pair<RecordedMaterialTrack, RecordedMaterialTrack> mapMaterial(
0084       State& state, const GeometryContext& gctx,
0085       const MagneticFieldContext& mctx, const RecordedMaterialTrack& rmTrack,
0086       const Options& options = Options{}) const;
0087 
0088   /// Finalize the maps
0089   TrackingGeometryMaterial finalizeMaps(const State& state) const;
0090 
0091  private:
0092   /// Access method to the logger
0093   const Logger& logger() const { return *m_logger; }
0094 
0095   /// The configuration
0096   Config m_cfg;
0097 
0098   /// The logger
0099   std::unique_ptr<const Logger> m_logger;
0100 };
0101 
0102 }  // namespace Acts