Back to home page

EIC code displayed by LXR

 
 

    


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

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