Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:22:17

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