Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:10:00

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2019 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Utilities/AlgebraHelpers.hpp"
0010 #include "Acts/Utilities/TypeTraits.hpp"
0011 
0012 #include <bitset>
0013 #include <cstdint>
0014 #include <type_traits>
0015 #include <vector>
0016 
0017 #include <Eigen/Core>
0018 
0019 namespace Acts {
0020 
0021 template <typename D>
0022 template <typename F>
0023 void MultiTrajectory<D>::visitBackwards(IndexType iendpoint,
0024                                         F&& callable) const {
0025   static_assert(detail_lt::VisitorConcept<F, ConstTrackStateProxy>,
0026                 "Callable needs to satisfy VisitorConcept");
0027 
0028   if (iendpoint == MultiTrajectoryTraits::kInvalid) {
0029     throw std::runtime_error(
0030         "Cannot visit backwards with kInvalid as endpoint");
0031   }
0032 
0033   while (true) {
0034     auto ts = getTrackState(iendpoint);
0035     if constexpr (std::is_same_v<std::invoke_result_t<F, ConstTrackStateProxy>,
0036                                  bool>) {
0037       bool proceed = callable(ts);
0038       // this point has no parent and ends the trajectory, or a break was
0039       // requested
0040       if (!proceed || !ts.hasPrevious()) {
0041         break;
0042       }
0043     } else {
0044       callable(ts);
0045       // this point has no parent and ends the trajectory
0046       if (!ts.hasPrevious()) {
0047         break;
0048       }
0049     }
0050     iendpoint = ts.previous();
0051   }
0052 }
0053 
0054 }  // namespace Acts