11#ifndef ROOT_RLAZYDSIMPL
12#define ROOT_RLAZYDSIMPL
40template <
typename... ColumnTypes>
44 std::tuple<RResultPtr<std::vector<ColumnTypes>>...>
fColumns;
58 auto colNameStr = std::string(colName);
63 std::string err =
"The specified column name, \"" + colNameStr +
"\" is not known to the data source.";
64 throw std::runtime_error(err);
67 const auto colIdName = it->second;
68 if (colIdName != idName) {
69 std::string err =
"Column " + colNameStr +
" has type " + colIdName +
70 " while the id specified is associated to type " + idName;
71 throw std::runtime_error(err);
76 const auto namesIt = std::find(colBegin, colEnd, colName);
77 const auto index = std::distance(colBegin, namesIt);
87 template <std::size_t...
S>
90 std::initializer_list<int> expander{
95 template <std::size_t...
S>
101 const std::vector<size_t> colLengths{std::get<S>(
fColumns)->size()...};
102 const auto expectedLen = colLengths[0];
104 for (
auto i :
TSeqI(1, colLengths.size())) {
105 if (expectedLen != colLengths[i]) {
107 "\" have different lengths: " + std::to_string(expectedLen) +
" and " +
108 std::to_string(colLengths[i]);
112 throw std::runtime_error(err);
117 std::string
AsString() {
return "lazy data source"; };
131 for (
auto &&ptrHolder : ptrHolderv) {
147 const auto key = std::string(colName);
153 const auto key = std::string(colName);
160 SetEntryHelper(slot, entry, std::index_sequence_for<ColumnTypes...>());
173 ptrHolderv.emplace_back(ptrHolder);
186 const auto nEntriesInRange = nEntries /
fNSlots;
192 end =
init + nEntriesInRange;
unsigned long long ULong64_t
typedef void((*Func_t)())
Class to wrap a pointer and delete the memory associated to it correctly.
RDataSource defines an API that RDataFrame can use to read arbitrary data formats.
std::vector< void * > Record_t
A RDataSource implementation which is built on top of result proxies.
const std::vector< std::string > fColNames
std::vector< PointerHolderPtrs_t > fPointerHolders
std::vector< std::pair< ULong64_t, ULong64_t > > GetEntryRanges()
Return ranges of entries to distribute to tasks.
bool SetEntry(unsigned int slot, ULong64_t entry)
Advance the "cursors" returned by GetColumnReaders to the selected entry for a particular slot.
void SetNSlots(unsigned int nSlots)
Inform RDataSource of the number of processing slots (i.e.
std::vector< ROOT::Internal::TDS::TPointerHolder * > PointerHolderPtrs_t
std::string GetLabel()
Return a string representation of the datasource type.
void SetEntryHelper(unsigned int slot, ULong64_t entry, std::index_sequence< S... >)
const PointerHolderPtrs_t fPointerHoldersModels
const std::map< std::string, std::string > fColTypesMap
Record_t GetColumnReadersImpl(std::string_view colName, const std::type_info &id)
type-erased vector of pointers to pointers to column values - one per slot
const std::vector< std::string > & GetColumnNames() const
Returns a reference to the collection of the dataset's column names.
void Initialise()
Convenience method called before starting an event-loop.
std::string GetTypeName(std::string_view colName) const
Type of a column as a string, e.g.
size_t GetEntriesNumber()
bool HasColumn(std::string_view colName) const
Checks if the dataset has a certain column.
RLazyDS(std::pair< std::string, RResultPtr< std::vector< ColumnTypes > > >... colsNameVals)
std::tuple< RResultPtr< std::vector< ColumnTypes > >... > fColumns
void ColLenghtChecker(std::index_sequence< S... >)
std::vector< std::pair< ULong64_t, ULong64_t > > fEntryRanges
Smart pointer for the return type of actions.
A pseudo container class which is a generator of indices.
basic_string_view< char > string_view
EvaluateInfo init(std::vector< RooRealProxy > parameters, std::vector< ArrayWrapper * > wrappers, std::vector< double * > arrays, size_t begin, size_t batchSize)
std::string TypeID2TypeName(const std::type_info &id)
Returns the name of a type starting from its type_info An empty string is returned in case of failure...
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
RooArgSet S(const RooAbsArg &v1)
static constexpr double second