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>
189unsigned int RunGraphs(std::vector<RResultHandle>
handles);
191namespace Experimental {
226 static_assert(!std::is_same_v<T, SnapshotResult_t>,
227 "Snapshot with variations can only be enabled via RSnapshotOptions.");
229 R__ASSERT(
resPtr !=
nullptr &&
"Calling VariationsFor on an empty RResultPtr");
233 resPtr.fLoopManager->Jit();
239 std::vector<std::string> variations =
nominalAction->GetVariations();
251 if constexpr (std::is_base_of<TNamed, T>::value) {
273 return RDFInternal::MakeResultMap<T>(
resPtr.fObjPtr, std::move(
variedResults), std::move(variations),
353 std::chrono::time_point<std::chrono::system_clock>
const fBeginTime = std::chrono::system_clock::now();
384 template <
typename T>
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
TRObject operator()(const T1 &t1) const
unsigned int const fTotalFiles
std::size_t ComputeTotalEvents() const
Compute total events in all open files.
void PrintStatsFinal() const
~ProgressHelper()=default
ProgressHelper(std::size_t increment, unsigned int totalFiles, unsigned int printInterval=0, bool useColors=true)
Create a progress helper.
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.
unsigned int const fNColumns
unsigned int fEventsPerSecondStatisticsCounter
std::chrono::time_point< std::chrono::system_clock > const fBeginTime
void Update()
Record number of events processed and update progress bar.
std::map< std::string, ULong64_t > fSampleNameToEventEntries
ProgressHelper(ProgressHelper const &)=delete
ProgressHelper & operator=(ProgressHelper &&)=delete
std::size_t fLastProcessedEvents
ProgressHelper(ProgressHelper &&)=delete
std::mutex fSampleNameToEventEntriesMutex
std::chrono::seconds const fPrintInterval
double EvtPerSec() const
Compute a running mean of events/s.
std::atomic< std::size_t > fProcessedEvents
std::array< double, 10 > fEventsPerSecondStatistics
std::chrono::time_point< std::chrono::system_clock > fLastPrintTime
void operator()(unsigned int, T &)
Thread-safe callback for RDataFrame.
std::size_t const fIncrement
bool const fUseShellColours
void PrintProgressAndStats(std::ostream &stream, std::size_t currentEventCount, std::chrono::seconds totalElapsedSeconds) const
Print event and time statistics.
ProgressHelper & operator=(ProgressHelper const &)=delete
The public interface to the RDataFrame federation of classes.
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 >
void ThreadsPerTH3(unsigned int nThread=1)
Set the number of threads sharing one TH3 in RDataFrame.
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.
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.
Lightweight storage for a collection of types.