13#ifndef ROOT_RDF_HELPERS
14#define ROOT_RDF_HELPERS
34template <
typename... ArgTypes,
typename F>
37 return std::function<
bool(ArgTypes...)>([=](ArgTypes... args)
mutable {
return !
f(args...); });
40template <
typename... ArgTypes,
typename Ret,
typename... Args>
43 return std::function<
bool(ArgTypes...)>([=](ArgTypes... args)
mutable {
return !
f(args...); });
46template <
typename I,
typename T,
typename F>
49template <std::size_t...
N,
typename T,
typename F>
51 template <std::
size_t Idx>
53 std::decay_t<F> fFunc;
57 auto operator()(AlwaysT<N>... args) ->
decltype(fFunc({args...})) {
return fFunc({args...}); }
60template <std::
size_t N,
typename T,
typename F>
80 typename Args =
typename ROOT::TypeTraits::CallableTraits<std::decay_t<F>>::arg_types_nodecay,
81 typename Ret =
typename ROOT::TypeTraits::CallableTraits<std::decay_t<F>>::ret_type>
101template <std::
size_t N,
typename T,
typename F>
118template <
typename NodeType>
137template <
typename NodeType>
138void SaveGraph(NodeType node,
const std::string &outputFile)
143 std::ofstream out(outputFile);
144 if (!out.is_open()) {
145 throw std::runtime_error(
"Could not open output file \"" + outputFile +
"\"for reading");
156template <
typename NodeType>
183void RunGraphs(std::vector<RResultHandle> handles);
185namespace Experimental {
224 R__ASSERT(resPtr !=
nullptr &&
"Calling VariationsFor on an empty RResultPtr");
230 std::shared_ptr<RDFInternal::RActionBase> action = resPtr.
fActionPtr;
233 std::vector<std::string> variations = action->GetVariations();
234 variations.insert(variations.begin(),
"nominal");
235 const auto nVariations = variations.size();
236 std::vector<std::shared_ptr<T>> results;
237 results.reserve(nVariations);
238 for (
auto i = 0u; i < nVariations; ++i)
239 results.emplace_back(
new T{*resPtr.fObjPtr});
242 std::vector<void *> typeErasedResults;
243 typeErasedResults.reserve(results.size());
244 for (
auto &res : results)
245 typeErasedResults.emplace_back(&res);
249 std::unique_ptr<RDFInternal::RActionBase> variedAction{
250 resPtr.
fActionPtr->MakeVariedAction(std::move(typeErasedResults))};
253 return RDFInternal::MakeResultMap<T>(std::move(results), std::move(variations), *resPtr.
fLoopManager,
254 std::move(variedAction));
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
TRObject operator()(const T1 &t1) const
void Book(RDFInternal::RActionBase *actionPtr)
void Jit()
Add RDF nodes that require just-in-time compilation to the computation graph.
std::string RepresentGraph(ROOT::RDataFrame &rDataFrame)
Starting from the root node, prints the entire graph.
The public interface to the RDataFrame federation of classes.
Smart pointer for the return type of actions.
RDFDetail::RLoopManager * fLoopManager
Non-owning pointer to the RLoopManager at the root of this computation graph.
std::shared_ptr< RDFInternal::RActionBase > fActionPtr
Owning pointer to the action that will produce this result.
std::function< bool(ArgTypes...)> NotHelper(ROOT::TypeTraits::TypeList< ArgTypes... >, Ret(*f)(Args...))
std::function< bool(ArgTypes...)> NotHelper(ROOT::TypeTraits::TypeList< ArgTypes... >, F &&f)
auto PassAsVec(F &&f) -> PassAsVecHelper< std::make_index_sequence< N >, T, F >
RResultMap< T > VariationsFor(RResultPtr< T > resPtr)
Produce all required systematic variations for the given result.
auto PassAsVec(F &&f) -> RDFInternal::PassAsVecHelper< std::make_index_sequence< N >, T, F >
PassAsVec is a callable generator that allows passing N variables of type T to a function as a single...
void RunGraphs(std::vector< RResultHandle > handles)
Trigger the event loop of multiple RDataFrames concurrently.
auto Not(F &&f) -> decltype(RDFInternal::NotHelper(Args(), std::forward< F >(f)))
Given a callable with signature bool(T1, T2, ...) return a callable with same signature that returns ...
std::string SaveGraph(NodeType node)
Create a graphviz representation of the dataframe computation graph, return it as a string.
RNode AsRNode(NodeType node)
Cast a RDataFrame node to the common type ROOT::RDF::RNode.
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN
Lightweight storage for a collection of types.