Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:55

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.intersect(state.options.geoContext, stepper.position(state),
0051                         direction * stepper.direction(state), boundaryTolerance,
0052                         surfaceTolerance)[index];
0053 
0054   // The intersection is on surface already
0055   if (sIntersection.status() == IntersectionStatus::onSurface) {
0056     ACTS_VERBOSE("Intersection: state is ON SURFACE");
0057     state.stepSize.release(stype);
0058     stepper.updateStepSize(state, sIntersection.pathLength(), stype);
0059     return IntersectionStatus::onSurface;
0060   }
0061 
0062   const double nearLimit = std::numeric_limits<double>::lowest();
0063   const double farLimit = std::numeric_limits<double>::max();
0064 
0065   if (sIntersection.isValid() &&
0066       detail::checkPathLength(sIntersection.pathLength(), nearLimit, farLimit,
0067                               logger)) {
0068     ACTS_VERBOSE("Surface is reachable");
0069     stepper.releaseStepSize(state, stype);
0070     stepper.updateStepSize(state, sIntersection.pathLength(), stype);
0071     return IntersectionStatus::reachable;
0072   }
0073 
0074   ACTS_VERBOSE("Surface is NOT reachable");
0075   return IntersectionStatus::unreachable;
0076 }
0077 
0078 }  // namespace Acts::detail