|
|
|||
File indexing completed on 2026-11-08 09:22:26
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/IAssignmentFinder.hpp" 0014 #include "Acts/Material/ISurfaceMaterialAccumulator.hpp" 0015 #include "Acts/Material/MaterialInteraction.hpp" 0016 #include "Acts/Material/MaterialInteractionAssignment.hpp" 0017 #include "Acts/Material/TrackingGeometryMaterial.hpp" 0018 #include "Acts/Utilities/Logger.hpp" 0019 0020 #include <cstddef> 0021 #include <memory> 0022 #include <span> 0023 #include <utility> 0024 #include <vector> 0025 0026 namespace Acts { 0027 0028 namespace detail { 0029 class WorkerPool; 0030 } // namespace detail 0031 /// Class that implements the material mapping procedure 0032 /// @ingroup material_mapping 0033 class MaterialMapper { 0034 public: 0035 /// @brief nested configuration struct 0036 struct Config { 0037 /// The assignment finder for material interaction assignments 0038 std::shared_ptr<const IAssignmentFinder> assignmentFinder = nullptr; 0039 /// The material accumulator for surfaces 0040 std::shared_ptr<const ISurfaceMaterialAccumulator> 0041 surfaceMaterialAccumulator = nullptr; 0042 /// Number of threads used by the batch @ref mapMaterial call, including 0043 /// the calling thread. The assignment finder must be safe to call 0044 /// concurrently when this is larger than one. 0045 std::size_t numThreads = 1; 0046 }; 0047 0048 /// @brief nested state struct 0049 /// 0050 /// It holds the states of the sub structs 0051 struct State { 0052 /// State of the surface material accumulator 0053 std::unique_ptr<ISurfaceMaterialAccumulator::State> 0054 surfaceMaterialAccumulatorState; 0055 }; 0056 0057 /// @brief nested options struct 0058 /// holds some options for the delegated calls 0059 struct Options { 0060 /// The assignment options (including vetos and re-assignments) 0061 MaterialInteractionAssignment::Options assignmentOptions; 0062 }; 0063 0064 /// @brief MaterialMapper constructor 0065 /// 0066 /// @param cfg the configuration struct 0067 /// @param mlogger the logger instance 0068 explicit MaterialMapper( 0069 const Config& cfg, 0070 std::unique_ptr<const Logger> mlogger = 0071 getDefaultLogger("BinnedSurfaceMaterialAccumulator", Logging::INFO)); 0072 0073 /// @brief Factory for creating the state 0074 /// @param gctx the geometry context 0075 /// @return Unique pointer to a new material mapping state object 0076 std::unique_ptr<State> createState(const GeometryContext& gctx) const; 0077 0078 /// @brief Map the material interactions to the surfaces 0079 /// 0080 /// @param state the state object holding the sub states 0081 /// @param gctx the geometry context 0082 /// @param mctx the magnetic field context 0083 /// @param rmTrack the recorded material track 0084 /// @param options the call options (see above) 0085 /// 0086 /// @return the mapped and unmapped material tracks 0087 std::pair<RecordedMaterialTrack, RecordedMaterialTrack> mapMaterial( 0088 State& state, const GeometryContext& gctx, 0089 const MagneticFieldContext& mctx, const RecordedMaterialTrack& rmTrack, 0090 const Options& options = Options{}) const; 0091 0092 /// @brief Map the material interactions of a batch of tracks 0093 /// 0094 /// The assignment of the tracks runs concurrently on the configured number 0095 /// of threads, the accumulation is delegated to the batch accumulation of 0096 /// the surface material accumulator. The result is identical to calling 0097 /// the single-track @ref mapMaterial for every track in order. 0098 /// 0099 /// @param state the state object holding the sub states 0100 /// @param gctx the geometry context 0101 /// @param mctx the magnetic field context 0102 /// @param rmTracks the recorded material tracks, which are not copied 0103 /// @param options the call options (see above) 0104 /// 0105 /// @return the mapped and unmapped material tracks, in input order 0106 std::vector<std::pair<RecordedMaterialTrack, RecordedMaterialTrack>> 0107 mapMaterial(State& state, const GeometryContext& gctx, 0108 const MagneticFieldContext& mctx, 0109 std::span<const RecordedMaterialTrack* const> rmTracks, 0110 const Options& options = Options{}) const; 0111 0112 /// Finalize the maps 0113 /// @param state Material mapping state containing collected data 0114 /// @param gctx Geometry context for finalization 0115 /// @return Tracking geometry material map with finalized surface and volume materials 0116 TrackingGeometryMaterial finalizeMaps(const State& state, 0117 const GeometryContext& gctx) const; 0118 0119 private: 0120 /// Access method to the logger 0121 const Logger& logger() const { return *m_logger; } 0122 0123 /// The configuration 0124 Config m_cfg; 0125 0126 /// The logger 0127 std::unique_ptr<const Logger> m_logger; 0128 0129 /// The worker pool for batch mapping, nullptr for serial execution 0130 std::shared_ptr<detail::WorkerPool> m_pool; 0131 }; 0132 0133 } // namespace Acts
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|