13#ifndef ROOT_RDF_HELPERS
14#define ROOT_RDF_HELPERS
36template <
typename...
ArgTypes,
typename F>
42template <
typename...
ArgTypes,
typename Ret,
typename... Args>
48template <
typename I,
typename T,
typename F>
51template <std::size_t...
N,
typename T,
typename F>
53 template <std::
size_t Idx>
55 std::decay_t<F> fFunc;
62template <std::
size_t N,
typename T,
typename F>
81 typename Args =
typename ROOT::TypeTraits::CallableTraits<std::decay_t<F>>::arg_types_nodecay,
82 typename Ret =
typename ROOT::TypeTraits::CallableTraits<std::decay_t<F>>::ret_type>
85 static_assert(std::is_same<Ret, bool>::value,
"RDF::Not requires a callable that returns a bool.");
102template <std::
size_t N,
typename T,
typename F>
119template <
typename NodeType>
123 return helper.RepresentGraph(node);
138template <
typename NodeType>
145 if (!out.is_open()) {
146 throw std::runtime_error(
"Could not open output file \"" +
outputFile +
"\"for reading");
157template <
typename NodeType>
185unsigned int RunGraphs(std::vector<RResultHandle> handles);
187namespace Experimental {
221 R__ASSERT(
resPtr !=
nullptr &&
"Calling VariationsFor on an empty RResultPtr");
225 resPtr.fLoopManager->Jit();
231 std::vector<std::string> variations =
nominalAction->GetVariations();
243 if constexpr (std::is_base_of<TNamed, T>::value) {
265 return RDFInternal::MakeResultMap<T>(
resPtr.fObjPtr, std::move(
variedResults), std::move(variations),
329 std::chrono::time_point<std::chrono::system_clock>
fBeginTime = std::chrono::system_clock::now();
350 std::shared_ptr<TTree>
fTree{
nullptr};
388 template <
typename T>
398 template <
typename T>
401 using namespace std::chrono;
430 std::cout << std::flush;
432 std::cout << std::endl;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
TRObject operator()(const T1 &t1) const
~ProgressHelper()=default
std::pair< std::size_t, std::chrono::seconds > RecordEvtCountAndTime()
Record current event counts and time stamp, populate evts/s statistics array.
void registerNewSample(unsigned int, const ROOT::RDF::RSampleInfo &id)
Register a new sample for completion statistics.
void PrintProgressBar(std::ostream &stream, std::size_t currentEventCount) const
Print a progress bar of width ProgressHelper::fBarWidth if fGetNEventsOfCurrentFile is known.
void operator()(unsigned int, T &value)
Thread-safe callback for RDataFrame.
void PrintStats(std::ostream &stream, std::size_t currentEventCount, std::chrono::seconds totalElapsedSeconds) const
Print event and time statistics.
std::map< std::string, ULong64_t > fSampleNameToEventEntries
std::shared_ptr< TTree > fTree
std::size_t fLastProcessedEvents
std::mutex fSampleNameToEventEntriesMutex
std::array< double, 20 > fEventsPerSecondStatistics
double EvtPerSec() const
Compute a running mean of events/s.
std::atomic< std::size_t > fProcessedEvents
unsigned int ComputeCurrentFileIdx() const
ProgressHelper(std::size_t increment, unsigned int totalFiles=1, unsigned int progressBarWidth=40, unsigned int printInterval=1, bool useColors=true)
Create a progress helper.
std::chrono::time_point< std::chrono::system_clock > fLastPrintTime
std::chrono::time_point< std::chrono::system_clock > fBeginTime
void PrintStatsFinal(std::ostream &stream, std::chrono::seconds totalElapsedSeconds) const
std::chrono::seconds fPrintInterval
void operator()(T &)
Thread-safe callback for RDataFrame.
std::size_t fEventsPerSecondStatisticsIndex
std::size_t ComputeNEventsSoFar() const
The public interface to the RDataFrame federation of classes.
Smart pointer for the return type of actions.
This type represents a sample identifier, to be used in conjunction with RDataFrame features such as ...
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
const_iterator begin() const
const_iterator end() const
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.
void AddProgressBar(ROOT::RDF::RNode df)
Add ProgressBar to a ROOT::RDF::RNode.
unsigned int 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.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Lightweight storage for a collection of types.