File indexing completed on 2025-12-16 09:23:15
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Navigation/TryAllNavigationPolicy.hpp"
0010
0011 #include "Acts/Geometry/TrackingVolume.hpp"
0012 #include "Acts/Navigation/NavigationStream.hpp"
0013
0014 namespace Acts {
0015
0016 TryAllNavigationPolicy::TryAllNavigationPolicy(const GeometryContext& ,
0017 const TrackingVolume& volume,
0018 const Logger& logger,
0019 const Config& config)
0020 : m_cfg{config}, m_volume(&volume) {
0021 assert(m_volume != nullptr);
0022 ACTS_VERBOSE("TryAllNavigationPolicy created for volume "
0023 << m_volume->volumeName() << " with config: "
0024 << " portals=" << m_cfg.portals << " sensitives="
0025 << m_cfg.sensitives << " passives=" << m_cfg.passives);
0026 }
0027
0028 TryAllNavigationPolicy::TryAllNavigationPolicy(const GeometryContext& gctx,
0029 const TrackingVolume& volume,
0030 const Logger& logger)
0031 : TryAllNavigationPolicy(gctx, volume, logger, {}) {}
0032
0033 void TryAllNavigationPolicy::initializeCandidates(
0034 [[maybe_unused]] const GeometryContext& gctx,
0035 const NavigationArguments& args, AppendOnlyNavigationStream& stream,
0036 const Logger& logger) const {
0037 ACTS_VERBOSE("TryAllNavigationPolicy");
0038 assert(m_volume != nullptr);
0039
0040 if (m_cfg.portals) {
0041 for (const auto& portal : m_volume->portals()) {
0042 stream.addPortalCandidate(portal);
0043 }
0044 }
0045
0046 if (!(m_cfg.sensitives || m_cfg.passives)) {
0047 return;
0048 }
0049
0050 for (const auto& surface : m_volume->surfaces()) {
0051 bool isSensitive = surface.associatedDetectorElement() != nullptr;
0052 if ((m_cfg.passives && !isSensitive) || (m_cfg.sensitives && isSensitive)) {
0053 stream.addSurfaceCandidate(surface, args.tolerance);
0054 }
0055 }
0056 }
0057
0058 void TryAllNavigationPolicy::connect(NavigationDelegate& delegate) const {
0059 connectDefault<TryAllNavigationPolicy>(delegate);
0060 }
0061
0062 }