Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Core/include/Acts/Material/ISurfaceMaterialAccumulator.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/Geometry/GeometryIdentifier.hpp"
0014 #include "Acts/Material/IAssignmentFinder.hpp"
0015 #include "Acts/Material/ISurfaceMaterial.hpp"
0016 #include "Acts/Material/MaterialInteraction.hpp"
0017 #include "Acts/Material/TrackingGeometryMaterial.hpp"
0018 
0019 #include <map>
0020 #include <memory>
0021 #include <span>
0022 #include <vector>
0023 
0024 namespace Acts {
0025 
0026 class Surface;
0027 namespace detail {
0028 class WorkerPool;
0029 }  // namespace detail
0030 
0031 /// @brief Interface for the material mapping, this is the accumulation step
0032 /// @ingroup material_mapping
0033 class ISurfaceMaterialAccumulator {
0034  public:
0035   /// The state of the material accumulator, this is used
0036   /// to cache information across tracks/events
0037   class State {
0038    public:
0039     virtual ~State() = default;
0040   };
0041 
0042   /// Virtual destructor
0043   virtual ~ISurfaceMaterialAccumulator() = default;
0044 
0045   /// Factory for creating the state
0046   /// @param gctx the geometry context
0047   /// @return Unique pointer to a new state object for material accumulation
0048   virtual std::unique_ptr<State> createState(
0049       const GeometryContext& gctx) const = 0;
0050 
0051   /// The accumulation input of a single track
0052   struct TrackAccumulation {
0053     /// The material interactions, with assigned surfaces
0054     const std::vector<MaterialInteraction>* interactions = nullptr;
0055     /// The candidate surfaces without assignment
0056     const std::vector<IAssignmentFinder::SurfaceAssignment>*
0057         surfacesWithoutAssignment = nullptr;
0058   };
0059 
0060   /// @brief Accumulate the material of a batch of tracks
0061   ///
0062   /// The tracks are accumulated as if one after the other, in the given
0063   /// order. Implementations may use @p pool to process independent parts of
0064   /// the accumulation concurrently, but the result must not depend on it.
0065   ///
0066   /// Implementations must override this method. The default forwards every
0067   /// track to the deprecated single-track @ref accumulate, to support
0068   /// implementations that only override that one.
0069   ///
0070   /// @param state is the state of the accumulator
0071   /// @param gctx the geometry context
0072   /// @param tracks the per-track accumulation inputs, in mapping order
0073   /// @param pool optional worker pool, nullptr means serial execution
0074   virtual void accumulateTracks(State& state, const GeometryContext& gctx,
0075                                 std::span<const TrackAccumulation> tracks,
0076                                 detail::WorkerPool* pool) const;
0077 
0078   /// @brief Accumulate the material interaction on the surface
0079   ///
0080   /// Only called by the default @ref accumulateTracks, to support
0081   /// implementations that override this method instead. The default throws.
0082   /// @deprecated Use and override @ref accumulateTracks instead.
0083   ///
0084   /// @param state is the state of the accumulator
0085   /// @param gctx the geometry context
0086   /// @param interactions is the material interactions, with assigned surfaces
0087   /// @param surfacesWithoutAssignment are the surfaces without assignment
0088   ///
0089   /// @note this the track average over the binned material
0090   [[deprecated(
0091       "Use and override ISurfaceMaterialAccumulator::accumulateTracks")]]
0092   virtual void accumulate(
0093       State& state, const GeometryContext& gctx,
0094       const std::vector<MaterialInteraction>& interactions,
0095       const std::vector<IAssignmentFinder::SurfaceAssignment>&
0096           surfacesWithoutAssignment) const;
0097 
0098   /// Finalize the surface material maps
0099   ///
0100   /// @param state the state of the accumulator
0101   /// @param gctx the geometry context
0102   ///
0103   /// @note this does the run average over the (binned) material
0104   /// @return Map of geometry IDs to finalized surface material objects
0105   virtual std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>
0106   finalizeMaterial(State& state, const GeometryContext& gctx) const = 0;
0107 
0108   /// Finalize material assignments, including stable keys when supported.
0109   /// The default adapts the existing ID-only finalizeMaterial implementation.
0110   /// @param state State created by this accumulator
0111   /// @param gctx Geometry context
0112   /// @return Finalized material maps
0113   virtual TrackingGeometryMaterial finalizeMaps(
0114       State& state, const GeometryContext& gctx) const {
0115     return {finalizeMaterial(state, gctx), {}};
0116   }
0117 };
0118 
0119 }  // namespace Acts