|
|
|||
File indexing completed on 2026-11-25 09:02:19
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/Propagator/PropagatorState.hpp" 0012 #include "Acts/Propagator/detail/AbortConditions.hpp" 0013 #include "Acts/Propagator/detail/LoopProtection.hpp" 0014 #include "Acts/Utilities/Logger.hpp" 0015 #include "Acts/Utilities/Result.hpp" 0016 0017 #include <limits> 0018 0019 namespace Acts { 0020 0021 /// @brief Actor that stops the propagation where the configuration says 0022 /// 0023 /// The propagator runs this actor if the options give no other actor. It stops 0024 /// the propagation 0025 /// - at the target surface of the propagation, if there is one, 0026 /// - at the path limit of the options, lowered by the loop protection, 0027 /// - outside the volumes that the options allow, 0028 /// - at the end of the world, unless the options switch this off. 0029 /// 0030 /// An actor of your own replaces this actor. To keep these conditions, put 0031 /// this actor in an @c ActorList with your actor. Put it first, so the loop 0032 /// protection sees the start momentum before other actors change it. 0033 struct DefaultActor { 0034 /// State of the actor 0035 struct State { 0036 /// Signed path limit, set at the start of the propagation 0037 double pathLimit = std::numeric_limits<double>::max(); 0038 }; 0039 0040 /// Set the path limit at the start of the propagation 0041 /// 0042 /// @param [in,out] state The propagation state 0043 /// @param [in] stepper Stepper used for the propagation 0044 /// @param [in] navigator Navigator used for the propagation 0045 /// @param [in,out] actorState The state of this actor, which is 0046 /// @c state.actor only if the actor is not part of an @c ActorList 0047 /// @param [in] logger A logger instance 0048 /// @return Always success 0049 template <typename propagator_state_t, typename stepper_t, 0050 typename navigator_t> 0051 Result<void> act(propagator_state_t& state, const stepper_t& stepper, 0052 const navigator_t& navigator, State& actorState, 0053 const Logger& logger) const { 0054 static_cast<void>(navigator); 0055 if (state.stage == PropagatorStage::prePropagation) { 0056 actorState.pathLimit = state.options.pathLimit; 0057 detail::setupLoopProtection(state, stepper, actorState.pathLimit, false, 0058 logger); 0059 } 0060 return Result<void>::success(); 0061 } 0062 0063 /// Check the abort conditions 0064 /// 0065 /// @param [in,out] state The propagation state 0066 /// @param [in] stepper Stepper used for the propagation 0067 /// @param [in] navigator Navigator used for the propagation 0068 /// @param [in] actorState The state of this actor, which is @c state.actor 0069 /// only if the actor is not part of an @c ActorList 0070 /// @param [in] logger A logger instance 0071 /// @return True if the propagation should stop 0072 template <typename propagator_state_t, typename stepper_t, 0073 typename navigator_t> 0074 bool checkAbort(propagator_state_t& state, const stepper_t& stepper, 0075 const navigator_t& navigator, const State& actorState, 0076 const Logger& logger) const { 0077 return (state.options.stopAtEndOfWorld && 0078 detail::endOfWorldReached(state, navigator)) || 0079 detail::volumeConstraintReached(state, navigator, logger) || 0080 detail::surfaceReached(state, navigator, 0081 navigator.targetSurface(state.navigation), 0082 logger) || 0083 detail::pathLimitReached(state, stepper, actorState.pathLimit, 0084 logger); 0085 } 0086 }; 0087 0088 } // namespace Acts
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|