11#ifndef ROOT_RDF_COLUMNREADERUTILS
12#define ROOT_RDF_COLUMNREADERUTILS
43std::unique_ptr<RDFDetail::RColumnReaderBase>
45 const std::map<std::string, std::vector<void *>> &DSValuePtrsMap,
TTreeReader *
r,
47 const std::string &variationName)
49 using Ret_t = std::unique_ptr<RDFDetail::RColumnReaderBase>;
53 if (variation !=
nullptr)
54 return Ret_t{
new RVariationReader(slot, colName, variationName, *variation,
typeid(T))};
57 if (define !=
nullptr) {
63 const auto DSValuePtrsIt = DSValuePtrsMap.find(colName);
64 if (DSValuePtrsIt != DSValuePtrsMap.end()) {
66 const std::vector<void *> &DSValuePtrs = DSValuePtrsIt->second;
75 assert(
r !=
nullptr &&
"We could not find a reader for this column, this should never happen at this point.");
98template <
typename... ColTypes>
99std::array<std::unique_ptr<RDFDetail::RColumnReaderBase>,
sizeof...(ColTypes)>
101 const std::string &variationName =
"nominal")
104 const auto &colNames = colInfo.
fColNames;
106 const bool *isDefine = colInfo.
fIsDefine;
112 std::array<
bool,
sizeof...(ColTypes)> doesVariationApply;
113 if (variationName ==
"nominal")
114 doesVariationApply.fill(
false);
116 for (
auto i = 0u; i <
sizeof...(ColTypes); ++i)
117 doesVariationApply[i] =
IsStrInVec(variationName, colRegister.GetVariationsFor(colNames[i]));
121 std::array<std::unique_ptr<RDFDetail::RColumnReaderBase>,
sizeof...(ColTypes)> ret{
122 {{(++i, MakeColumnReader<ColTypes>(
123 slot, isDefine[i] ? defines.at(colNames[i]).get() :
nullptr, DSValuePtrsMap,
r, ds, colNames[i],
124 doesVariationApply[i] ? &colRegister.FindVariation(colNames[i], variationName) :
nullptr,
125 variationName))}...}};
135inline std::array<std::unique_ptr<RDFDetail::RColumnReaderBase>, 0>
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
const std::vector< std::string > & GetVariations() const
virtual RDefineBase & GetVariedDefine(const std::string &variationName)=0
Return a clone of this Define that works with values in the variationName "universe".
A binder for user-defined columns and aliases.
const DefinesMap_t & GetColumns() const
Returns a map of pointers to the defined columns.
Column reader type that deals with values read from RDataSources.
Column reader for defined (aka custom) columns.
RTreeColumnReader specialization for TTree values read via TTreeReaderValues.
This type includes all parts of RVariation that do not depend on the callable signature.
Column reader that reads the value for a specific column, variation and slot.
RDataSource defines an API that RDataFrame can use to read arbitrary data formats.
std::vector< T ** > GetColumnReaders(std::string_view columnName)
Called at most once per column by RDF.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
std::unique_ptr< RDFDetail::RColumnReaderBase > MakeColumnReader(unsigned int slot, RDefineBase *define, const std::map< std::string, std::vector< void * > > &DSValuePtrsMap, TTreeReader *r, ROOT::RDF::RDataSource *ds, const std::string &colName, RVariationBase *variation, const std::string &variationName)
bool IsStrInVec(const std::string &str, const std::vector< std::string > &vec)
std::array< std::unique_ptr< RDFDetail::RColumnReaderBase >, sizeof...(ColTypes)> MakeColumnReaders(unsigned int slot, TTreeReader *r, TypeList< ColTypes... >, const RColumnReadersInfo &colInfo, const std::string &variationName="nominal")
Create a group of column readers, one per type in the parameter pack.
ROOT type_traits extensions.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
This type aggregates some of the arguments passed to MakeColumnReaders.
const RColumnRegister & fCustomCols
const std::map< std::string, std::vector< void * > > & fDSValuePtrsMap
ROOT::RDF::RDataSource * fDataSource
const std::vector< std::string > & fColNames
Lightweight storage for a collection of types.