Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:07

0001 
0002 #ifndef TRACKBASE_ACTSABORTER_H
0003 #define TRACKBASE_ACTSABORTER_H
0004 
0005 #include <Acts/Definitions/Algebra.hpp>
0006 #include <Acts/Surfaces/Surface.hpp>
0007 #include <Acts/Utilities/Logger.hpp>
0008 
0009 struct ActsAborter
0010 {
0011   unsigned int abortlayer = std::numeric_limits<unsigned int>::max();
0012   unsigned int abortvolume = std::numeric_limits<unsigned int>::max();
0013 
0014   template <typename propagator_state_t, typename stepper_t,
0015             typename navigator_t>
0016   bool operator()(propagator_state_t& state, const stepper_t& /*stepper*/,
0017                   const navigator_t& navigator, const Acts::Logger& /*logger*/) const
0018   {
0019     if (navigator.targetReached(state.navigation))
0020     {
0021       return true;
0022     }
0023 
0024     // if (!state.navigation.currentSurface)
0025     if (!navigator.currentSurface(state.navigation))
0026     {
0027       return false;
0028     }
0029 
0030     auto volumeno = state.navigation.currentSurface->geometryId().volume();
0031     auto layerno = state.navigation.currentSurface->geometryId().layer();
0032     auto sensitive = state.navigation.currentSurface->geometryId().sensitive();
0033 
0034     /// Check that we are in the proper layer and that we've also reached
0035     /// a sensitive surface
0036     if (layerno == abortlayer and volumeno == abortvolume and sensitive != 0)
0037     {
0038       navigator.targetReached(state.navigation, true);
0039       return true;
0040     }
0041 
0042     return false;
0043   }
0044 };
0045 
0046 #endif