41 std::vector<std::string_view> names;
44 names.push_back(kv.first);
54 [&colName](
const DefinesMap_t::value_type &kv) { return kv.first == colName; });
55 return it ==
fDefines->end() ? nullptr : &it->second->GetDefine();
75 {*colIt, std::make_unique<ROOT::Internal::RDF::RDefinesWithReaders>(define,
fLoopManager->
GetNSlots(),
78 auto newDefines = std::make_shared<DefinesMap_t>(*
fDefines);
81 const auto &colAndDefIt = insertion_defs.first;
83 if (
auto previousDefIt =
84 std::find_if(newDefines->begin(), newDefines->end(),
85 [&colAndDefIt](
const DefinesMap_t::value_type &kv) { return kv.first == colAndDefIt->first; });
86 previousDefIt != newDefines->end()) {
87 previousDefIt->second = colAndDefIt->second.get();
89 newDefines->push_back({colAndDefIt->first, colAndDefIt->second.get()});
98 auto newVariations = std::make_shared<VariationsMap_t>(*
fVariations);
99 const std::vector<std::string> &colNames = variation->GetColumnNames();
102 for (
const auto &colName : colNames) {
105 {*colIt, std::make_unique<ROOT::Internal::RDF::RVariationsWithReaders>(variation,
fLoopManager->
GetNSlots())});
106 newVariations->insert({colAndVariationsIt->first, colAndVariationsIt->second.get()});
116 std::vector<std::string> variations;
118 for (
auto it = range.first; it != range.second; ++it)
119 for (
const auto &variationName : it->second->GetVariation().GetVariationNames())
120 variations.emplace_back(variationName);
143 std::set<std::string> variationNames;
145 for (
const auto &col : columns) {
147 for (
const auto &var : variations)
148 variationNames.insert(var);
152 [&col](
const DefinesMap_t::value_type &kv) { return kv.first == col; });
154 for (
const auto &
v : defineIt->second->GetDefine().GetVariations())
155 variationNames.insert(
v);
159 return {variationNames.begin(), variationNames.end()};
171 for (
auto it = range.first; it != range.second; ++it) {
172 if (
IsStrInVec(variationName, it->second->GetVariation().GetVariationNames()))
181 std::set<const RVariationBase *> uniqueVariations;
183 uniqueVariations.insert(&
e.second->GetVariation());
185 const std::vector<const RVariationBase *> variations(uniqueVariations.begin(), uniqueVariations.end());
199 auto aliasIt = colNamesCache.
Insert(std::string(alias));
200 auto colIt = colNamesCache.Insert(std::string(colName));
202 auto newAliases = std::make_shared<AliasesMap_t>(*
fAliases);
204 if (
auto previousAliasIt =
205 std::find_if(newAliases->begin(), newAliases->end(),
206 [&aliasIt](
const AliasesMap_t::value_type &kv) { return kv.first == *aliasIt; });
207 previousAliasIt != newAliases->end()) {
210 newAliases->push_back({*aliasIt,
ResolveAlias(*colIt)});
221 [&
name](
const AliasesMap_t::value_type &kv) { return kv.first == name; }) !=
fAliases->end();
229 [&
name](
const DefinesMap_t::value_type &kv) { return kv.first == name; }) !=
fDefines->end();
241 if (alias.size() > 1 && alias[0] ==
'#') {
242 std::string sizeof_colname{
"R_rdf_sizeof_"};
243 sizeof_colname.append(alias.substr(1));
249 [&alias](
const AliasesMap_t::value_type &kv) { return kv.first == alias; });
259 const std::string &variationName,
260 const std::type_info &requestedType)
263 if (variationName !=
"nominal") {
265 if (variationAndReaders !=
nullptr) {
266 const auto &actualType = variationAndReaders->GetVariation().GetTypeId();
268 return &variationAndReaders->GetReader(slot, colName, variationName);
274 [&colName](
const DefinesMap_t::value_type &kv) { return kv.first == colName; });
276 const auto &actualType = it->second->GetDefine().GetTypeId();
278 return &it->second->GetReader(slot, variationName);
290 std::vector<std::string_view> ret;
293 ret.push_back(kv.first);
295 ret.push_back(kv.first);
The head node of a RDF computation graph.
std::set< std::pair< std::string_view, std::unique_ptr< ROOT::Internal::RDF::RVariationsWithReaders > > > & GetUniqueVariationsWithReaders()
std::set< std::pair< std::string_view, std::unique_ptr< ROOT::Internal::RDF::RDefinesWithReaders > > > & GetUniqueDefinesWithReaders()
unsigned int GetNSlots() const
ROOT::Internal::RDF::RStringCache & GetColumnNamesCache()
std::vector< std::string_view > GenerateColumnNames() const
Return the list of the names of the defined columns (Defines + Aliases).
bool IsDefineOrAlias(std::string_view name) const
Check if the provided name is tracked in the names list.
bool IsAlias(std::string_view name) const
Return true if the given column name is an existing alias.
std::vector< std::string_view > BuildDefineNames() const
Return the list of the names of defined columns (no aliases).
std::vector< std::pair< std::string_view, std::string_view > > AliasesMap_t
std::vector< std::string > GetVariationsFor(const std::string &column) const
Get the names of the variations that directly provide alternative values for this column.
std::string_view ResolveAlias(std::string_view alias) const
Return the actual column name that the alias resolves to.
std::shared_ptr< const VariationsMap_t > fVariations
Immutable multimap of Variations, can be shared among several nodes.
RDFDetail::RColumnReaderBase * GetReader(unsigned int slot, const std::string &colName, const std::string &variationName, const std::type_info &tid)
Return a RDefineReader or a RVariationReader, or nullptr if not available.
std::shared_ptr< const DefinesMap_t > fDefines
Immutable collection of Defines, can be shared among several nodes.
std::vector< std::pair< std::string_view, ROOT::Internal::RDF::RDefinesWithReaders * > > DefinesMap_t
bool IsDefine(std::string_view name) const
Return true if the given column name is an existing defined column.
void AddVariation(std::shared_ptr< RVariationBase > variation)
Register a new systematic variation.
std::shared_ptr< const AliasesMap_t > fAliases
Immutable map of Aliases, can be shared among several nodes.
void AddDefine(std::shared_ptr< RDFDetail::RDefineBase > column)
Add a new defined column.
RColumnRegister(ROOT::Detail::RDF::RLoopManager *lm)
std::vector< std::string > GetVariationDeps(const std::string &column) const
Get the names of all variations that directly or indirectly affect a given column.
ROOT::RDF::RVariationsDescription BuildVariationsDescription() const
ROOT::Detail::RDF::RLoopManager * fLoopManager
The head node of the computation graph this register belongs to. Never null.
std::unordered_multimap< std::string_view, ROOT::Internal::RDF::RVariationsWithReaders * > VariationsMap_t
void AddAlias(std::string_view alias, std::string_view colName)
Add a new alias to the ledger.
RDFDetail::RDefineBase * GetDefine(std::string_view colName) const
Return the RDefine for the requested column name, or nullptr.
RVariationsWithReaders * FindVariationAndReaders(const std::string &colName, const std::string &variationName)
Return the RVariationsWithReaders object that handles the specified variation of the specified column...
auto Insert(const std::string &string) -> decltype(fStrings)::const_iterator
Inserts the input string in the cache and returns an iterator to the cached string.
A descriptor for the systematic variations known to a given RDataFrame node.
bool IsStrInVec(const std::string &str, const std::vector< std::string > &vec)
void CheckReaderTypeMatches(const std::type_info &colType, const std::type_info &requestedType, const std::string &colName)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...