11#ifndef ROOT_RDF_RDefaultValueFor
12#define ROOT_RDF_RDefaultValueFor
34using namespace ROOT::TypeTraits;
47 using TypeInd_t = std::make_index_sequence<ColumnTypes_t::list_size>;
49 using ValuesPerSlot_t = std::conditional_t<std::is_same<T, bool>::value, std::deque<T>, std::vector<T>>;
58 std::unordered_map<std::string, std::unique_ptr<RDefineBase>>
fVariedDefines;
62 if (
auto *value =
fValues[slot]->
template TryGet<T>(entry))
71 RLoopManager &lm,
const std::string &variationName =
"nominal")
118 const std::type_info &
GetTypeId() const final {
return typeid(T); }
126 e.second->FinalizeSlot(slot);
132 for (
const auto &variation : variations) {
142 auto variedDefine = std::unique_ptr<RDefineBase>(
159 return *(it->second);
Basic types used by ROOT and required by TInterpreter.
long long Long64_t
Portable signed long integer 8 bytes.
void * GetValuePtr(unsigned int slot) final
Return the (type-erased) address of the Define'd value for the given processing slot.
std::unordered_map< std::string, std::unique_ptr< RDefineBase > > fVariedDefines
Define objects corresponding to systematic variations other than nominal for this defined column.
RDefaultValueFor(RDefaultValueFor &&)=delete
std::vector< RColumnReaderBase * > fValues
RDefineBase & GetVariedDefine(const std::string &variationName) final
Return a clone of this Define that works with values in the variationName "universe".
void InitSlot(TTreeReader *r, unsigned int slot) final
void FinalizeSlot(unsigned int slot) final
Clean-up operations to be performed at the end of a task.
std::make_index_sequence< ColumnTypes_t::list_size > TypeInd_t
RDefaultValueFor & operator=(const RDefaultValueFor &)=delete
const std::type_info & GetTypeId() const final
ValuesPerSlot_t fLastResults
RDefaultValueFor(const RDefaultValueFor &)=delete
RDefaultValueFor & operator=(RDefaultValueFor &&)=delete
void Update(unsigned int, const ROOT::RDF::RSampleInfo &) final
Update function to be called once per sample, used if the derived type is a RDefinePerSample.
T & GetValueOrDefault(unsigned int slot, Long64_t entry)
RDefaultValueFor(std::string_view name, std::string_view type, const T &defaultValue, const ROOT::RDF::ColumnNames_t &columns, const RDFInternal::RColumnRegister &colRegister, RLoopManager &lm, const std::string &variationName="nominal")
void Update(unsigned int slot, Long64_t entry) final
Update the value at the address returned by GetValuePtr with the content corresponding to the given e...
std::conditional_t< std::is_same< T, bool >::value, std::deque< T >, std::vector< T > > ValuesPerSlot_t
ROOT::TypeTraits::TypeList< T > ColumnTypes_t
void MakeVariations(const std::vector< std::string > &variations) final
Create clones of this Define that work with values in varied "universes".
RLoopManager * fLoopManager
std::string fVariation
This indicates for what variation this define evaluates values.
const std::string fType
The type of the custom column as a text string.
std::vector< std::string > fVariationDeps
List of systematic variations that affect the value of this define.
RDefineBase(std::string_view name, std::string_view type, const RDFInternal::RColumnRegister &colRegister, RLoopManager &lm, const ColumnNames_t &columnNames, const std::string &variationName="nominal")
RDFInternal::RColumnRegister fColRegister
const ROOT::RDF::ColumnNames_t fColumnNames
std::vector< Long64_t > fLastCheckedEntry
const std::string fName
The name of the custom column.
The head node of a RDF computation graph.
A binder for user-defined columns, variations and aliases.
This type represents a sample identifier, to be used in conjunction with RDataFrame features such as ...
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
Special implementation of ROOT::RRangeCast for TCollection, including a check that the cast target ty...
RDFDetail::RColumnReaderBase * GetColumnReader(unsigned int slot, RColumnReaderBase *defineOrVariationReader, RLoopManager &lm, TTreeReader *treeReader, std::string_view colName, const std::type_info &ti)
constexpr std::size_t CacheLineStep()
Stepping through CacheLineStep<T> values in a vector<T> brings you to a new cache line.
std::vector< std::string > ColumnNames_t
Lightweight storage for a collection of types.