Logo ROOT   6.12/07
Reference Guide
List of all members | Public Member Functions | Private Types | Private Attributes | List of all members
ROOT::Internal::TDF::TColumnValue< T > Class Template Reference

template<typename T>
class ROOT::Internal::TDF::TColumnValue< T >

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

Template Parameters
TThe type of the column

TDataFrame 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.

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

Definition at line 232 of file TDFNodes.hxx.

Public Member Functions

 TColumnValue ()=default
 
template<typename U = T, typename std::enable_if< std::is_same< typename TColumnValue< U >::ProxyParam_t, U >::value, 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 TArrayBranch) More...
 
template<typename U = T, typename std::enable_if<!std::is_same< ProxyParam_t, U >::value, int >::type = 0>
TArrayBranch< ProxyParam_tGet (Long64_t)
 This overload is used to return arrays (i.e. types that are read into a TArrayBranch) More...
 
void MakeProxy (TTreeReader *r, const std::string &bn)
 
void Reset ()
 
void SetTmpColumn (unsigned int slot, TCustomColumnBase *tmpColumn)
 

Private Types

enum  EColumnKind {
  EColumnKind::kTreeValue, EColumnKind::kTreeArray, EColumnKind::kCustomColumn, EColumnKind::kDataSource,
  EColumnKind::kInvalid
}
 TColumnValue has a slightly different behaviour whether the column comes from a TTreeReader, a TDataFrame Define or a TDataSource. More...
 
using ProxyParam_t = typename std::conditional< std::is_same< ReaderValueOrArray_t< T >, TTreeReaderValue< T > >::value, T, TakeFirstParameter_t< T > >::type
 

Private Attributes

bool fArrayHasBeenChecked = false
 Signal whether we ever checked that the branch we are reading with a TTreeReaderArray stores array elements in contiguous memory. More...
 
EColumnKind fColumnKind = EColumnKind::kInvalid
 
std::vector< TCustomColumnBase * > 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...
 
std::vector< std::unique_ptr< TTreeReaderArray< ProxyParam_t > > > fReaderArrays
 Owning ptrs to a TTreeReaderArray. Used for non-temporary columns when T == TArrayBranch<U>. More...
 
std::vector< std::unique_ptr< TTreeReaderValue< T > > > fReaderValues
 Owning ptrs to a TTreeReaderValue. Used for non-temporary columns when T != TArrayBranch<U> 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...
 

#include <ROOT/TDFNodes.hxx>

Member Typedef Documentation

◆ ProxyParam_t

template<typename T >
using ROOT::Internal::TDF::TColumnValue< T >::ProxyParam_t = typename std::conditional<std::is_same<ReaderValueOrArray_t<T>, TTreeReaderValue<T> >::value, T, TakeFirstParameter_t<T> >::type
private

Definition at line 236 of file TDFNodes.hxx.

Member Enumeration Documentation

◆ EColumnKind

template<typename T >
enum ROOT::Internal::TDF::TColumnValue::EColumnKind
strongprivate

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

It stores which it is as an enum.

Enumerator
kTreeValue 
kTreeArray 
kCustomColumn 
kDataSource 
kInvalid 

Definition at line 240 of file TDFNodes.hxx.

Constructor & Destructor Documentation

◆ TColumnValue()

template<typename T >
ROOT::Internal::TDF::TColumnValue< T >::TColumnValue ( )
default

Member Function Documentation

◆ Get() [1/2]

template<typename T >
template<typename U , typename std::enable_if< std::is_same< typename TColumnValue< U >::ProxyParam_t, U >::value, int >::type >
T & ROOT::Internal::TDF::TColumnValue< T >::Get ( Long64_t  entry)

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

Definition at line 835 of file TDFNodes.hxx.

◆ Get() [2/2]

template<typename T >
template<typename U = T, typename std::enable_if<!std::is_same< ProxyParam_t, U >::value, int >::type = 0>
TArrayBranch<ProxyParam_t> ROOT::Internal::TDF::TColumnValue< T >::Get ( Long64_t  )
inline

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

Definition at line 288 of file TDFNodes.hxx.

◆ MakeProxy()

template<typename T >
void ROOT::Internal::TDF::TColumnValue< T >::MakeProxy ( TTreeReader r,
const std::string &  bn 
)
inline

Definition at line 269 of file TDFNodes.hxx.

◆ Reset()

template<typename T >
void ROOT::Internal::TDF::TColumnValue< T >::Reset ( void  )
inline

Definition at line 312 of file TDFNodes.hxx.

◆ SetTmpColumn()

template<typename T >
void ROOT::Internal::TDF::TColumnValue< T >::SetTmpColumn ( unsigned int  slot,
TCustomColumnBase tmpColumn 
)

Definition at line 810 of file TDFNodes.hxx.

Member Data Documentation

◆ fArrayHasBeenChecked

template<typename T >
bool ROOT::Internal::TDF::TColumnValue< T >::fArrayHasBeenChecked = false
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 == TArrayBranch<U>.

Definition at line 262 of file TDFNodes.hxx.

◆ fColumnKind

template<typename T >
EColumnKind ROOT::Internal::TDF::TColumnValue< T >::fColumnKind = EColumnKind::kInvalid
private

Definition at line 242 of file TDFNodes.hxx.

◆ fCustomColumns

template<typename T >
std::vector<TCustomColumnBase *> ROOT::Internal::TDF::TColumnValue< T >::fCustomColumns
private

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

Definition at line 259 of file TDFNodes.hxx.

◆ fCustomValuePtrs

template<typename T >
std::vector<T *> ROOT::Internal::TDF::TColumnValue< T >::fCustomValuePtrs
private

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

Definition at line 255 of file TDFNodes.hxx.

◆ fDSValuePtrs

template<typename T >
std::vector<T **> ROOT::Internal::TDF::TColumnValue< T >::fDSValuePtrs
private

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

Definition at line 257 of file TDFNodes.hxx.

◆ fReaderArrays

template<typename T >
std::vector<std::unique_ptr<TTreeReaderArray<ProxyParam_t> > > ROOT::Internal::TDF::TColumnValue< T >::fReaderArrays
private

Owning ptrs to a TTreeReaderArray. Used for non-temporary columns when T == TArrayBranch<U>.

Definition at line 253 of file TDFNodes.hxx.

◆ fReaderValues

template<typename T >
std::vector<std::unique_ptr<TTreeReaderValue<T> > > ROOT::Internal::TDF::TColumnValue< T >::fReaderValues
private

Owning ptrs to a TTreeReaderValue. Used for non-temporary columns when T != TArrayBranch<U>

Definition at line 251 of file TDFNodes.hxx.

◆ fSlot

template<typename T >
unsigned int ROOT::Internal::TDF::TColumnValue< T >::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 244 of file TDFNodes.hxx.

Libraries for ROOT::Internal::TDF::TColumnValue< T >:
[legend]

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