Logo ROOT   6.14/05
Reference Guide
List of all members | Public Member Functions | Static Public Attributes | Private Types | Private Attributes | List of all members
ROOT::Internal::RDF::TColumnValue< T, MustUseRVec > Class Template Reference

template<typename T, bool MustUseRVec = IsRVec_t<T>::value>
class ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >

Helper class that updates and returns TTree branches as well as RDataFrame temporary columns.

Template Parameters
TThe type of the column

RDataFrame nodes must access two different types of values during the event loop: values of real branches, for which TTreeReader{Values,Arrays} act as proxies, or temporary columns whose values are generated on the fly. While the type of the value is known at compile time (or just-in-time), it is only at runtime that nodes can check whether a certain value is generated on the fly or not.

TColumnValue abstracts this difference by providing the same interface for both cases and handling the reading or generation of new values transparently. Only one of the two data members fReaderProxy or fValuePtr will be non-null for a given TColumnValue, depending on whether the value comes from a real TTree branch or from a temporary column respectively.

RDataFrame nodes can store tuples of TColumnValues and retrieve an updated value for the column via the Get method.

Definition at line 243 of file RDFNodes.hxx.

Public Member Functions

 TColumnValue ()=default
 
template<typename U = T, typename std::enable_if<!TColumnValue< U >::fgMustUseRVec, int >::type = 0>
T & Get (Long64_t entry)
 This overload is used to return scalar quantities (i.e. types that are not read into a RVec) More...
 
template<typename U = T, typename std::enable_if< TColumnValue< U >::fgMustUseRVec, int >::type = 0>
T & Get (Long64_t entry)
 This overload is used to return arrays (i.e. More...
 
void MakeProxy (TTreeReader *r, const std::string &bn)
 
void Reset ()
 
void SetTmpColumn (unsigned int slot, RCustomColumnBase *tmpColumn)
 

Static Public Attributes

static constexpr bool fgMustUseRVec = MustUseRVec
 

Private Types

using ColumnValue_t = typename std::conditional< MustUseRVec, TakeFirstParameter_t< T >, T >::type
 
enum  EColumnKind { EColumnKind::kTree, EColumnKind::kCustomColumn, EColumnKind::kDataSource, EColumnKind::kInvalid }
 TColumnValue has a slightly different behaviour whether the column comes from a TTreeReader, a RDataFrame Define or a RDataSource. More...
 
enum  EStorageType : char { EStorageType::kContiguous, EStorageType::kUnknown, EStorageType::kSparse }
 Enumerator for the different properties of the branch storage in memory. More...
 
using TreeReader_t = typename std::conditional< MustUseRVec, TTreeReaderArray< ColumnValue_t >, TTreeReaderValue< ColumnValue_t > >::type
 

Private Attributes

EColumnKind fColumnKind = EColumnKind::kInvalid
 
bool fCopyWarningPrinted = false
 
std::vector< RCustomColumnBase * > fCustomColumns
 Non-owning ptrs to the node responsible for the custom column. Needed when querying custom values. More...
 
std::vector< T * > fCustomValuePtrs
 Non-owning ptrs to the value of a custom column. More...
 
std::vector< T ** > fDSValuePtrs
 Non-owning ptrs to the value of a data-source column. More...
 
RVec< ColumnValue_tfRVec
 If MustUseRVec, i.e. we are reading an array, we return a reference to this RVec to clients. More...
 
unsigned int fSlot = std::numeric_limits<unsigned int>::max()
 The slot this value belongs to. Only needed when querying custom column values, it is set in SetTmpColumn. More...
 
EStorageType fStorageType = EStorageType::kUnknown
 Signal whether we ever checked that the branch we are reading with a TTreeReaderArray stores array elements in contiguous memory. More...
 
std::vector< std::unique_ptr< TreeReader_t > > fTreeReaders
 Owning ptrs to a TTreeReaderValue or TTreeReaderArray. Only used for Tree columns. More...
 

#include <ROOT/RDFNodes.hxx>

Member Typedef Documentation

◆ ColumnValue_t

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
using ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::ColumnValue_t = typename std::conditional<MustUseRVec, TakeFirstParameter_t<T>, T>::type
private

Definition at line 245 of file RDFNodes.hxx.

◆ TreeReader_t

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
using ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::TreeReader_t = typename std::conditional<MustUseRVec, TTreeReaderArray<ColumnValue_t>, TTreeReaderValue<ColumnValue_t> >::type
private

Definition at line 247 of file RDFNodes.hxx.

Member Enumeration Documentation

◆ EColumnKind

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
enum ROOT::Internal::RDF::TColumnValue::EColumnKind
strongprivate

TColumnValue has a slightly different behaviour whether the column comes from a TTreeReader, a RDataFrame Define or a RDataSource.

It stores which it is as an enum.

Enumerator
kTree 
kCustomColumn 
kDataSource 
kInvalid 

Definition at line 251 of file RDFNodes.hxx.

◆ EStorageType

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
enum ROOT::Internal::RDF::TColumnValue::EStorageType : char
strongprivate

Enumerator for the different properties of the branch storage in memory.

Enumerator
kContiguous 
kUnknown 
kSparse 

Definition at line 270 of file RDFNodes.hxx.

Constructor & Destructor Documentation

◆ TColumnValue()

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::TColumnValue ( )
default

Member Function Documentation

◆ Get() [1/2]

template<typename T , bool B>
template<typename U , typename std::enable_if< TColumnValue< U >::fgMustUseRVec, int >::type >
T & ROOT::Internal::RDF::TColumnValue< T, B >::Get ( Long64_t  entry)

This overload is used to return scalar quantities (i.e. types that are not read into a RVec)

This overload is used to return arrays (i.e. types that are read into a RVec)

Definition at line 852 of file RDFNodes.hxx.

◆ Get() [2/2]

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
template<typename U = T, typename std::enable_if< TColumnValue< U >::fgMustUseRVec, int >::type = 0>
T& ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::Get ( Long64_t  entry)

This overload is used to return arrays (i.e.

types that are read into a RVec). In this case the returned T is always a RVec<ColumnValue_t>.

◆ MakeProxy()

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
void ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::MakeProxy ( TTreeReader r,
const std::string &  bn 
)
inline

Definition at line 285 of file RDFNodes.hxx.

◆ Reset()

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
void ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::Reset ( void  )
inline

Definition at line 300 of file RDFNodes.hxx.

◆ SetTmpColumn()

template<typename T , bool B>
void ROOT::Internal::RDF::TColumnValue< T, B >::SetTmpColumn ( unsigned int  slot,
RCustomColumnBase tmpColumn 
)

Definition at line 829 of file RDFNodes.hxx.

Member Data Documentation

◆ fColumnKind

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
EColumnKind ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::fColumnKind = EColumnKind::kInvalid
private

Definition at line 253 of file RDFNodes.hxx.

◆ fCopyWarningPrinted

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
bool ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::fCopyWarningPrinted = false
private

Definition at line 276 of file RDFNodes.hxx.

◆ fCustomColumns

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
std::vector<RCustomColumnBase *> ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::fCustomColumns
private

Non-owning ptrs to the node responsible for the custom column. Needed when querying custom values.

Definition at line 268 of file RDFNodes.hxx.

◆ fCustomValuePtrs

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
std::vector<T *> ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::fCustomValuePtrs
private

Non-owning ptrs to the value of a custom column.

Definition at line 264 of file RDFNodes.hxx.

◆ fDSValuePtrs

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
std::vector<T **> ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::fDSValuePtrs
private

Non-owning ptrs to the value of a data-source column.

Definition at line 266 of file RDFNodes.hxx.

◆ fgMustUseRVec

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
constexpr bool ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::fgMustUseRVec = MustUseRVec
static

Definition at line 279 of file RDFNodes.hxx.

◆ fRVec

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
RVec<ColumnValue_t> ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::fRVec
private

If MustUseRVec, i.e. we are reading an array, we return a reference to this RVec to clients.

Definition at line 275 of file RDFNodes.hxx.

◆ fSlot

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
unsigned int ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::fSlot = std::numeric_limits<unsigned int>::max()
private

The slot this value belongs to. Only needed when querying custom column values, it is set in SetTmpColumn.

Definition at line 255 of file RDFNodes.hxx.

◆ fStorageType

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
EStorageType ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::fStorageType = EStorageType::kUnknown
private

Signal whether we ever checked that the branch we are reading with a TTreeReaderArray stores array elements in contiguous memory.

Only used when T == RVec<U>.

Definition at line 273 of file RDFNodes.hxx.

◆ fTreeReaders

template<typename T , bool MustUseRVec = IsRVec_t<T>::value>
std::vector<std::unique_ptr<TreeReader_t> > ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >::fTreeReaders
private

Owning ptrs to a TTreeReaderValue or TTreeReaderArray. Only used for Tree columns.

Definition at line 262 of file RDFNodes.hxx.

Libraries for ROOT::Internal::RDF::TColumnValue< T, MustUseRVec >:
[legend]

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