Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 08:10: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/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/Geometry/TrackingVolume.hpp"
0014 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0015 #include "Acts/Material/interface/IAssignmentFinder.hpp"
0016 
0017 #include <utility>
0018 #include <vector>
0019 
0020 namespace Acts {
0021 
0022 /// @class IntersectionMaterialAssigner
0023 ///
0024 /// A purely intersection based material assigner on a trial and error basis.
0025 /// This is to be used if the navigation of the propagator is not available
0026 /// or not reliable, or simply for cross-checking the results.
0027 ///
0028 /// @note that differently to the PropagatorMaterialAssigner, this assigner
0029 /// needs to be preconditioned with the surfaces and volumes that are tested
0030 /// for candidate inclusion.
0031 ///
0032 /// In a large-n material interaction scenario, this is not the most efficient
0033 ///
0034 /// @ingroup material_mapping
0035 class IntersectionMaterialAssigner final : public IAssignmentFinder {
0036  public:
0037   /// @brief Nested configuration struct
0038   struct Config {
0039     /// @brief  The surfaces to be tested
0040     std::vector<const Surface*> surfaces;
0041     /// @brief  The volumes to be tested: TrackingVolume
0042     std::vector<const TrackingVolume*> trackingVolumes;
0043   };
0044 
0045   /// @brief Construct with the configuration
0046   ///
0047   /// @param cfg is the configuration struct
0048   /// @param mlogger is the logger
0049   explicit IntersectionMaterialAssigner(
0050       const Config& cfg,
0051       std::unique_ptr<const Logger> mlogger =
0052           getDefaultLogger("IntersectionMaterialAssigner", Logging::INFO))
0053       : m_cfg(cfg), m_logger(std::move(mlogger)) {}
0054 
0055   /// @brief Method for generating assignment candidates for the
0056   /// material interaction assignment to surfaces or volumes
0057   ///
0058   /// @param gctx is the geometry context
0059   /// @param mctx is the magnetic field context
0060   /// @param position is the position of the initial ray
0061   /// @param direction is the direction of initial ray
0062   ///
0063   /// @return a vector of Surface Assignments and Volume Assignments
0064   std::pair<std::vector<IAssignmentFinder::SurfaceAssignment>,
0065             std::vector<IAssignmentFinder::VolumeAssignment>>
0066   assignmentCandidates(const GeometryContext& gctx,
0067                        const MagneticFieldContext& mctx,
0068                        const Vector3& position,
0069                        const Vector3& direction) const final;
0070 
0071  private:
0072   /// Access method to the logger
0073   const Logger& logger() const { return *m_logger; }
0074 
0075   /// The configuration
0076   Config m_cfg;
0077 
0078   /// The logger
0079   std::unique_ptr<const Logger> m_logger;
0080 };
0081 
0082 }  // namespace Acts