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 (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 >
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.
 
voidGet ()
 Get the pointer to the encapsulated result.
 

Private Attributes

std::shared_ptr< ROOT::Internal::RDF::RActionBasefActionPtr
 Owning pointer to the action that will produce this result.
 
ROOT::Detail::RDF::RLoopManagerfLoopManager
 
std::shared_ptr< voidfObjPtr
 Type erased shared pointer encapsulating the wrapped result.
 
const std::type_info & fType
 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/3]

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

Definition at line 62 of file RResultHandle.hxx.

◆ RResultHandle() [2/3]

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

◆ RResultHandle() [3/3]

ROOT::RDF::RResultHandle::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 71 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 81 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 96 of file RResultHandle.hxx.

◆ operator!=()

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

Definition at line 105 of file RResultHandle.hxx.

◆ operator==()

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

Definition at line 100 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 high level interface for analyses of data stored in TTrees,...
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
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
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: