Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:42:10

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/Material/AccumulatedSurfaceMaterial.hpp"
0013 #include "Acts/Material/interface/ISurfaceMaterialAccumulater.hpp"
0014 #include "Acts/Utilities/Logger.hpp"
0015 
0016 namespace Acts {
0017 
0018 /// @brief The binned surface material accumulater
0019 ///
0020 /// It consumes the assigned material interactions and then accumulates
0021 /// the material on the surfaces in prepared binned containers for averaging
0022 
0023 class BinnedSurfaceMaterialAccumulater final
0024     : public ISurfaceMaterialAccumulater {
0025  public:
0026   /// @brief Nested config struct
0027   struct Config {
0028     /// Geometry context for coordinate transformations
0029     GeometryContext geoContext;
0030 
0031     /// Correct for empty bins (recommended)
0032     bool emptyBinCorrection = true;
0033 
0034     /// The surfaces to be used for the accummulation
0035     std::vector<const Surface*> materialSurfaces = {};
0036   };
0037 
0038   /// @brief Nested state struct
0039   struct State final : public ISurfaceMaterialAccumulater::State {
0040     /// The accumulated material per geometry ID
0041     std::map<GeometryIdentifier, AccumulatedSurfaceMaterial>
0042         accumulatedMaterial;
0043   };
0044 
0045   /// Constructor
0046   ///
0047   /// @param cfg the configuration struct
0048   /// @param mlogger the logger
0049   explicit BinnedSurfaceMaterialAccumulater(
0050       const Config& cfg,
0051       std::unique_ptr<const Logger> mlogger =
0052           getDefaultLogger("BinnedSurfaceMaterialAccumulater", Logging::INFO));
0053 
0054   /// Factory for creating the state
0055   /// @return Unique pointer to newly created accumulator state
0056   std::unique_ptr<ISurfaceMaterialAccumulater::State> createState()
0057       const override;
0058 
0059   /// @brief Accumulate the material interaction on the surface
0060   ///
0061   /// @param state is the state of the accumulater
0062   /// @param interactions is the material interactions, with assigned surfaces
0063   /// @param surfacesWithoutAssignment are the surfaces without assignment
0064   ///
0065   /// @note this the track average over the binned material
0066   void accumulate(ISurfaceMaterialAccumulater::State& state,
0067                   const std::vector<MaterialInteraction>& interactions,
0068                   const std::vector<IAssignmentFinder::SurfaceAssignment>&
0069                       surfacesWithoutAssignment) const override;
0070 
0071   /// Finalize the surface material maps
0072   ///
0073   /// @param state the state of the accumulator
0074   ///
0075   /// @note this does the run average over the (binned) material
0076   /// @return Map of surface materials indexed by geometry identifiers
0077   std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>
0078   finalizeMaterial(ISurfaceMaterialAccumulater::State& state) const override;
0079 
0080  private:
0081   /// Access method to the logger
0082   const Logger& logger() const { return *m_logger; }
0083 
0084   /// The configuration
0085   Config m_cfg;
0086 
0087   /// The logger
0088   std::unique_ptr<const Logger> m_logger;
0089 };
0090 
0091 }  // namespace Acts