Helper class that updates and returns TTree branches as well as RDataFrame temporary columns.
T | The 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.
RColumnValue 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 RColumnValue, depending on whether the value comes from a real TTree branch or from a temporary column respectively.
RDataFrame nodes can store tuples of RColumnValues and retrieve an updated value for the column via the Get
method.
Definition at line 62 of file RColumnValue.hxx.
Public Member Functions | |
RColumnValue () | |
template<typename U = T, typename std::enable_if<!RColumnValue< U >::MustUseRVec_t::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 RVec) More... | |
template<typename U = T, typename std::enable_if< RColumnValue< U >::MustUseRVec_t::value &&!std::is_same< U, RVec< bool > >::value, int >::type = 0> | |
T & | Get (Long64_t entry) |
This overload is used to return arrays (i.e. More... | |
template<typename U = T, typename std::enable_if< RColumnValue< U >::MustUseRVec_t::value &&std::is_same< U, RVec< bool > >::value, int >::type = 0> | |
T & | Get (Long64_t entry) |
This overload covers the RVec<bool> case. More... | |
void | MakeProxy (TTreeReader *r, const std::string &bn) |
void | Reset () |
void | SetTmpColumn (unsigned int slot, RCustomColumnBase *customColumn) |
Private Types | |
using | ColumnValue_t = typename std::conditional< MustUseRVec_t::value, TakeFirstParameter_t< T >, T >::type |
enum class | EColumnKind { kTree , kCustomColumn , kDataSource , kInvalid } |
RColumnValue has a slightly different behaviour whether the column comes from a TTreeReader, a RDataFrame Define or a RDataSource. More... | |
enum class | EStorageType : char { kContiguous , kUnknown , kSparse } |
Enumerator for the different properties of the branch storage in memory. More... | |
using | MustUseRVec_t = IsRVec_t< T > |
using | TreeReader_t = typename std::conditional< MustUseRVec_t::value, TTreeReaderArray< ColumnValue_t >, TTreeReaderValue< ColumnValue_t > >::type |
Private Attributes | |
EColumnKind | fColumnKind = EColumnKind::kInvalid |
bool | fCopyWarningPrinted = false |
RCustomColumnBase * | fCustomColumn |
Non-owning ptrs to the node responsible for the custom column. Needed when querying custom values. More... | |
T * | fCustomValuePtr |
Non-owning ptrs to the value of a custom column. More... | |
T ** | fDSValuePtr |
Non-owning ptrs to the value of a data-source column. More... | |
RVec< ColumnValue_t > | fRVec |
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::unique_ptr< TreeReader_t > | fTreeReader |
Owning ptrs to a TTreeReaderValue or TTreeReaderArray. Only used for Tree columns. More... | |
#include <ROOT/RDF/RColumnValue.hxx>
|
private |
Definition at line 68 of file RColumnValue.hxx.
|
private |
Definition at line 65 of file RColumnValue.hxx.
|
private |
Definition at line 69 of file RColumnValue.hxx.
|
strongprivate |
RColumnValue 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 74 of file RColumnValue.hxx.
|
strongprivate |
Enumerator for the different properties of the branch storage in memory.
Enumerator | |
---|---|
kContiguous | |
kUnknown | |
kSparse |
Definition at line 94 of file RColumnValue.hxx.
|
inline |
Definition at line 103 of file RColumnValue.hxx.
|
inline |
This overload is used to return scalar quantities (i.e. types that are not read into a RVec)
Definition at line 159 of file RColumnValue.hxx.
|
inline |
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>. RVec<bool> is treated differently, in a separate overload.
Definition at line 175 of file RColumnValue.hxx.
|
inline |
This overload covers the RVec<bool> case.
In this case we always copy the contents of TTreeReaderArray<bool> into RVec<bool> (never take a view into the memory buffer) because the underlying memory buffer might be the one of a std::vector<bool>, which is not a contiguous slab of bool values. Note that this also penalizes the case in which the column type is actually bool[], but the possible performance gains in this edge case is probably not worth the extra complication required to differentiate the two cases.
Definition at line 248 of file RColumnValue.hxx.
|
inline |
Definition at line 148 of file RColumnValue.hxx.
|
inline |
Definition at line 269 of file RColumnValue.hxx.
|
inline |
Definition at line 105 of file RColumnValue.hxx.
|
private |
Definition at line 76 of file RColumnValue.hxx.
|
private |
Definition at line 100 of file RColumnValue.hxx.
|
private |
Non-owning ptrs to the node responsible for the custom column. Needed when querying custom values.
Definition at line 92 of file RColumnValue.hxx.
|
private |
Non-owning ptrs to the value of a custom column.
Definition at line 88 of file RColumnValue.hxx.
|
private |
Non-owning ptrs to the value of a data-source column.
Definition at line 90 of file RColumnValue.hxx.
|
private |
If MustUseRVec, i.e. we are reading an array, we return a reference to this RVec to clients.
Definition at line 99 of file RColumnValue.hxx.
|
private |
The slot this value belongs to. Only needed when querying custom column values, it is set in SetTmpColumn
.
Definition at line 78 of file RColumnValue.hxx.
|
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.
Definition at line 97 of file RColumnValue.hxx.
|
private |
Owning ptrs to a TTreeReaderValue or TTreeReaderArray. Only used for Tree columns.
Definition at line 86 of file RColumnValue.hxx.