Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:23:23

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2024 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 http://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     GeometryContext geoContext;
0029 
0030     /// Correct for empty bins (recommended)
0031     bool emptyBinCorrection = true;
0032 
0033     /// The surfaces to be used for the accummulation
0034     std::vector<const Surface*> materialSurfaces = {};
0035   };
0036 
0037   /// @brief Nested state struct
0038   struct State final : public ISurfaceMaterialAccumulater::State {
0039     /// The accumulated material per geometry ID
0040     std::map<GeometryIdentifier, AccumulatedSurfaceMaterial>
0041         accumulatedMaterial;
0042   };
0043 
0044   /// Constructor
0045   ///
0046   /// @param cfg the configuration struct
0047   /// @param mlogger the logger
0048   BinnedSurfaceMaterialAccumulater(
0049       const Config& cfg,
0050       std::unique_ptr<const Logger> mlogger =
0051           getDefaultLogger("BinnedSurfaceMaterialAccumulater", Logging::INFO));
0052 
0053   /// Factory for creating the state
0054   std::unique_ptr<ISurfaceMaterialAccumulater::State> createState()
0055       const override;
0056 
0057   /// @brief Accumulate the material interaction on the surface
0058   ///
0059   /// @param state is the state of the accumulater
0060   /// @param interactions is the material interactions, with assigned surfaces
0061   /// @param surfacesWithoutAssignment are the surfaces without assignment
0062   ///
0063   /// @note this the track average over the binned material
0064   void accumulate(ISurfaceMaterialAccumulater::State& state,
0065                   const std::vector<MaterialInteraction>& interactions,
0066                   const std::vector<IAssignmentFinder::SurfaceAssignment>&
0067                       surfacesWithoutAssignment) const override;
0068 
0069   /// Finalize the surface material maps
0070   ///
0071   /// @param state the state of the accumulator
0072   ///
0073   /// @note this does the run average over the (binned) material
0074   std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>
0075   finalizeMaterial(ISurfaceMaterialAccumulater::State& state) const override;
0076 
0077  private:
0078   /// Access method to the logger
0079   const Logger& logger() const { return *m_logger; }
0080 
0081   /// The configuration
0082   Config m_cfg;
0083 
0084   /// The logger
0085   std::unique_ptr<const Logger> m_logger;
0086 };
0087 
0088 }  // namespace Acts