Back to home page

EIC code displayed by LXR

 
 

    


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

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