Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:22:57

0001 #ifndef TMVA_RINFERENCEUTILS
0002 #define TMVA_RINFERENCEUTILS
0003 
0004 #include <utility> // std::forward, std::index_sequence
0005 
0006 namespace TMVA {
0007 namespace Experimental {
0008 
0009 namespace Internal {
0010 
0011 /// Compute helper
0012 template <typename I, typename T, typename F>
0013 class ComputeHelper;
0014 
0015 template <std::size_t... N, typename T, typename F>
0016 class ComputeHelper<std::index_sequence<N...>, T, F> {
0017    template <std::size_t Idx>
0018    using AlwaysT = T;
0019    F fFunc;
0020 
0021 public:
0022    ComputeHelper(F &&f) : fFunc(std::forward<F>(f)) {}
0023    auto operator()(AlwaysT<N>... args) -> decltype(fFunc.Compute({args...})) {
0024       return fFunc.Compute({args...});
0025    }
0026 };
0027 
0028 } // namespace Internal
0029 
0030 /// Helper to pass TMVA model to RDataFrame.Define nodes
0031 template <std::size_t N, typename T, typename F>
0032 auto Compute(F &&f) -> Internal::ComputeHelper<std::make_index_sequence<N>, T, F>
0033 {
0034    return Internal::ComputeHelper<std::make_index_sequence<N>, T, F>(std::forward<F>(f));
0035 }
0036 
0037 } // namespace Experimental
0038 } // namespace TMVA
0039 
0040 #endif // TMVA_RINFERENCEUTILS