Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-16 08:02:13

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/Direction.hpp"
0012 #include "Acts/Propagator/ConstrainedStep.hpp"
0013 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0014 #include "Acts/Surfaces/Surface.hpp"
0015 #include "Acts/Utilities/Intersection.hpp"
0016 #include "Acts/Utilities/Logger.hpp"
0017 
0018 #include <limits>
0019 
0020 namespace Acts::detail {
0021 
0022 /// Update surface status - Single component
0023 ///
0024 /// This method intersect the provided surface and update the navigation
0025 /// step estimation accordingly (hence it changes the state). It also
0026 /// returns the status of the intersection to trigger onSurface in case
0027 /// the surface is reached.
0028 ///
0029 /// @tparam stepper_t The type of stepper used for the propagation
0030 ///
0031 /// @param stepper [in] The stepper in use
0032 /// @param state [in,out] The stepping state (thread-local cache)
0033 /// @param surface [in] The surface provided
0034 /// @param index [in] The surface intersection index
0035 /// @param direction [in] The propagation direction
0036 /// @param boundaryTolerance [in] The boundary check for this status update
0037 /// @param surfaceTolerance [in] Surface tolerance used for intersection
0038 /// @param stype [in] The step size type to be set
0039 /// @param logger [in] A @c Logger instance
0040 template <typename stepper_t>
0041 IntersectionStatus updateSingleSurfaceStatus(
0042     const stepper_t& stepper, typename stepper_t::State& state,
0043     const Surface& surface, std::uint8_t index, Direction direction,
0044     const BoundaryTolerance& boundaryTolerance, double surfaceTolerance,
0045     ConstrainedStep::Type stype, const Logger& logger) {
0046   ACTS_VERBOSE("Update single surface status for surface: "
0047                << surface.geometryId() << " index " << static_cast<int>(index));
0048 
0049   auto sIntersection =
0050       surface
0051           .intersect(state.options.geoContext, stepper.position(state),
0052                      direction * stepper.direction(state), boundaryTolerance,
0053                      surfaceTolerance)
0054           .at(index);
0055 
0056   // The intersection is on surface already
0057   if (sIntersection.status() == IntersectionStatus::onSurface) {
0058     ACTS_VERBOSE("Intersection: state is ON SURFACE");
0059     state.stepSize.release(stype);
0060     stepper.updateStepSize(state, sIntersection.pathLength(), stype);
0061     return IntersectionStatus::onSurface;
0062   }
0063 
0064   const double nearLimit = std::numeric_limits<double>::lowest();
0065   const double farLimit = std::numeric_limits<double>::max();
0066 
0067   if (sIntersection.isValid() &&
0068       detail::checkPathLength(sIntersection.pathLength(), nearLimit, farLimit,
0069                               logger)) {
0070     ACTS_VERBOSE("Surface is reachable");
0071     stepper.releaseStepSize(state, stype);
0072     stepper.updateStepSize(state, sIntersection.pathLength(), stype);
0073     return IntersectionStatus::reachable;
0074   }
0075 
0076   ACTS_VERBOSE("Surface is NOT reachable");
0077   return IntersectionStatus::unreachable;
0078 }
0079 
0080 }  // namespace Acts::detail