Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:22:27

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 class IntersectionMaterialAssigner final : public IAssignmentFinder {
0034  public:
0035   /// @brief Nested configuration struct
0036   struct Config {
0037     /// @brief  The surfaces to be tested
0038     std::vector<const Surface*> surfaces;
0039     /// @brief  The volumes to be tested: TrackingVolume
0040     std::vector<const TrackingVolume*> trackingVolumes;
0041   };
0042 
0043   /// @brief Construct with the configuration
0044   ///
0045   /// @param cfg is the configuration struct
0046   /// @param mlogger is the logger
0047   explicit IntersectionMaterialAssigner(
0048       const Config& cfg,
0049       std::unique_ptr<const Logger> mlogger =
0050           getDefaultLogger("IntersectionMaterialAssigner", Logging::INFO))
0051       : m_cfg(cfg), m_logger(std::move(mlogger)) {}
0052 
0053   /// @brief Method for generating assignment candidates for the
0054   /// material interaction assignment to surfaces or volumes
0055   ///
0056   /// @param gctx is the geometry context
0057   /// @param mctx is the magnetic field context
0058   /// @param position is the position of the initial ray
0059   /// @param direction is the direction of initial ray
0060   ///
0061   /// @return a vector of Surface Assignments and Volume Assignments
0062   std::pair<std::vector<IAssignmentFinder::SurfaceAssignment>,
0063             std::vector<IAssignmentFinder::VolumeAssignment>>
0064   assignmentCandidates(const GeometryContext& gctx,
0065                        const MagneticFieldContext& mctx,
0066                        const Vector3& position,
0067                        const Vector3& direction) const final;
0068 
0069  private:
0070   /// Access method to the logger
0071   const Logger& logger() const { return *m_logger; }
0072 
0073   /// The configuration
0074   Config m_cfg;
0075 
0076   /// The logger
0077   std::unique_ptr<const Logger> m_logger;
0078 };
0079 
0080 }  // namespace Acts