Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::RDF::RResultHandle Class Reference

Definition at line 27 of file RResultHandle.hxx.

Public Member Functions

 RResultHandle ()=default
 
 RResultHandle (const RResultHandle &)=default
 
template<class T >
 RResultHandle (const RResultPtr< T > &resultPtr)
 
 RResultHandle (RResultHandle &&)=default
 
template<class T >
T * GetPtr ()
 Get the pointer to the encapsulated object.
 
template<class T >
RResultPtr< T > GetResultPtr ()
 Get an RResultPtr to the encapsulated object.
 
template<class T >
const T & GetValue ()
 Get a const reference to the encapsulated object.
 
bool IsReady () const
 Check whether the result has already been computed.
 
bool operator!= (const RResultHandle &rhs) const
 
bool operator== (const RResultHandle &rhs) const
 

Private Member Functions

void CheckType (const std::type_info &type)
 Compare given type to the type of the wrapped result and throw if the types don't match.
 
void * Get ()
 Get the pointer to the encapsulated result.
 
void ThrowIfNull ()
 

Private Attributes

std::shared_ptr< ROOT::Internal::RDF::RActionBasefActionPtr
 Owning pointer to the action that will produce this result.
 
ROOT::Detail::RDF::RLoopManagerfLoopManager = nullptr
 
std::shared_ptr< void > fObjPtr
 Type erased shared pointer encapsulating the wrapped result.
 
const std::type_info * fType = nullptr
 Type of the wrapped result.
 

Friends

void RunGraphs (std::vector< RResultHandle >)
 Trigger the event loop of multiple RDataFrames concurrently.
 

#include <ROOT/RResultHandle.hxx>

Constructor & Destructor Documentation

◆ RResultHandle() [1/4]

template<class T >
ROOT::RDF::RResultHandle::RResultHandle ( const RResultPtr< T > &  resultPtr)
inline

Definition at line 68 of file RResultHandle.hxx.

◆ RResultHandle() [2/4]

ROOT::RDF::RResultHandle::RResultHandle ( const RResultHandle )
default

◆ RResultHandle() [3/4]

ROOT::RDF::RResultHandle::RResultHandle ( RResultHandle &&  )
default

◆ RResultHandle() [4/4]

ROOT::RDF::RResultHandle::RResultHandle ( )
default

Member Function Documentation

◆ CheckType()

void ROOT::RDF::RResultHandle::CheckType ( const std::type_info &  type)
inlineprivate

Compare given type to the type of the wrapped result and throw if the types don't match.

Definition at line 49 of file RResultHandle.hxx.

◆ Get()

void * ROOT::RDF::RResultHandle::Get ( )
inlineprivate

Get the pointer to the encapsulated result.

Ownership is not transferred to the caller. Triggers event loop and execution of all actions booked in the associated RLoopManager.

Definition at line 41 of file RResultHandle.hxx.

◆ GetPtr()

template<class T >
T * ROOT::RDF::RResultHandle::GetPtr ( )
inline

Get the pointer to the encapsulated object.

Triggers event loop and execution of all actions booked in the associated RLoopManager.

Template Parameters
TType of the action result

Definition at line 78 of file RResultHandle.hxx.

◆ GetResultPtr()

template<class T >
RResultPtr< T > ROOT::RDF::RResultHandle::GetResultPtr ( )
inline

Get an RResultPtr to the encapsulated object.

Template Parameters
TType of the action result

Definition at line 99 of file RResultHandle.hxx.

◆ GetValue()

template<class T >
const T & ROOT::RDF::RResultHandle::GetValue ( )
inline

Get a const reference to the encapsulated object.

Triggers event loop and execution of all actions booked in the associated RLoopManager.

Template Parameters
TType of the action result

Definition at line 89 of file RResultHandle.hxx.

◆ IsReady()

bool ROOT::RDF::RResultHandle::IsReady ( ) const
inline

Check whether the result has already been computed.

std::vector<RResultHandle> results;
results.emplace_back(df.Mean<double>("var"));
res.IsReady(); // false, access will trigger event loop
std::cout << res.GetValue<double>() << std::endl; // triggers event loop
res.IsReady(); // true

Definition at line 114 of file RResultHandle.hxx.

◆ operator!=()

bool ROOT::RDF::RResultHandle::operator!= ( const RResultHandle rhs) const
inline

Definition at line 125 of file RResultHandle.hxx.

◆ operator==()

bool ROOT::RDF::RResultHandle::operator== ( const RResultHandle rhs) const
inline

Definition at line 120 of file RResultHandle.hxx.

◆ ThrowIfNull()

void ROOT::RDF::RResultHandle::ThrowIfNull ( )
inlineprivate

Definition at line 60 of file RResultHandle.hxx.

Friends And Related Symbol Documentation

◆ RunGraphs

void RunGraphs ( std::vector< RResultHandle )
friend

Trigger the event loop of multiple RDataFrames concurrently.

Parameters
[in]handlesA vector of RResultHandles

This function triggers the event loop of all computation graphs which relate to the given RResultHandles. The advantage compared to running the event loop implicitly by accessing the RResultPtr is that the event loops will run concurrently. Therefore, the overall computation of all results is generally more efficient. It should be noted that user-defined operations (e.g., Filters and Defines) of the different RDataFrame graphs are assumed to be safe to call concurrently.

ROOT::RDataFrame df1("tree1", "file1.root");
auto r1 = df1.Histo1D("var1");
ROOT::RDataFrame df2("tree2", "file2.root");
auto r2 = df2.Sum("var2");
// RResultPtr -> RResultHandle conversion is automatic
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
void RunGraphs(std::vector< RResultHandle > handles)
Trigger the event loop of multiple RDataFrames concurrently.

Member Data Documentation

◆ fActionPtr

std::shared_ptr<ROOT::Internal::RDF::RActionBase> ROOT::RDF::RResultHandle::fActionPtr
private

Owning pointer to the action that will produce this result.

Ownership is shared with RResultPtrs and RResultHandles that refer to the same result.

Definition at line 31 of file RResultHandle.hxx.

◆ fLoopManager

ROOT::Detail::RDF::RLoopManager* ROOT::RDF::RResultHandle::fLoopManager = nullptr
private

Definition at line 28 of file RResultHandle.hxx.

◆ fObjPtr

std::shared_ptr<void> ROOT::RDF::RResultHandle::fObjPtr
private

Type erased shared pointer encapsulating the wrapped result.

Definition at line 32 of file RResultHandle.hxx.

◆ fType

const std::type_info* ROOT::RDF::RResultHandle::fType = nullptr
private

Type of the wrapped result.

Definition at line 33 of file RResultHandle.hxx.

Libraries for ROOT::RDF::RResultHandle:

The documentation for this class was generated from the following file: