44template <
typename... ColumnTypes>
48 std::tuple<ROOT::RVec<ColumnTypes>...>
fColumns;
63 auto colNameStr = std::string(colName);
68 std::string err =
"The specified column name, \"" + colNameStr +
"\" is not known to the data source.";
69 throw std::runtime_error(err);
72 const auto colIdName = it->second;
73 if (colIdName != idName) {
74 std::string err =
"Column " + colNameStr +
" has type " + colIdName +
75 " while the id specified is associated to type " + idName;
76 throw std::runtime_error(err);
81 const auto namesIt = std::find(colBegin, colEnd, colName);
82 const auto index = std::distance(colBegin, namesIt);
92 template <std::size_t... S>
95 std::initializer_list<int> expander{
100 template <std::size_t... S>
103 if (
sizeof...(S) < 2)
106 const std::vector<size_t> colLengths{std::get<S>(
fColumns).size()...};
107 const auto expectedLen = colLengths[0];
109 for (
auto i :
TSeqI(1, colLengths.size())) {
110 if (expectedLen != colLengths[i]) {
112 "\" have different lengths: " + std::to_string(expectedLen) +
" and " +
113 std::to_string(colLengths[i]);
117 throw std::runtime_error(err);
122 std::string
AsString() {
return "Numpy data source"; };
137 for (
auto &&ptrHolder : ptrHolderv) {
155 const auto key = std::string(colName);
161 const auto key = std::string(colName);
168 SetEntryHelper(slot, entry, std::index_sequence_for<ColumnTypes...>());
181 ptrHolderv.emplace_back(ptrHolder);
194 const auto nEntriesInRange = nEntries /
fNSlots;
200 end = init + nEntriesInRange;
218template <
typename... ColumnTypes>
219std::unique_ptr<RDataFrame>
223 return std::make_unique<RDataFrame>(std::make_unique<
RVecDS<ColumnTypes...>>(deleteRVecs, colNameProxyPairs...));
unsigned long long ULong64_t
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
A RDataSource implementation which takes a collection of RVecs, which are able to adopt data from Num...
size_t GetEntriesNumber()
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
std::vector< PointerHolderPtrs_t > fPointerHolders
void Initialize()
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.
const PointerHolderPtrs_t fPointerHoldersModels
const std::vector< std::string > & GetColumnNames() const
Returns a reference to the collection of the dataset's column names.
bool SetEntry(unsigned int slot, ULong64_t entry)
Advance the "cursors" returned by GetColumnReaders to the selected entry for a particular slot.
std::function< void()> fDeleteRVecs
void SetNSlots(unsigned int nSlots)
Inform RDataSource of the number of processing slots (i.e.
std::vector< ROOT::Internal::TDS::TPointerHolder * > PointerHolderPtrs_t
std::tuple< ROOT::RVec< ColumnTypes >... > fColumns
std::string GetLabel()
Return a string representation of the datasource type.
const std::vector< std::string > fColNames
std::vector< std::pair< ULong64_t, ULong64_t > > fEntryRanges
void SetEntryHelper(unsigned int slot, ULong64_t entry, std::index_sequence< S... >)
void ColLengthChecker(std::index_sequence< S... >)
RVecDS(std::function< void()> deleteRVecs, std::pair< std::string, ROOT::RVec< ColumnTypes > > const &...colsNameVals)
bool HasColumn(std::string_view colName) const
Checks if the dataset has a certain column.
std::vector< std::pair< ULong64_t, ULong64_t > > GetEntryRanges()
Return ranges of entries to distribute to tasks.
const std::map< std::string, std::string > fColTypesMap
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 "std::vector"-like collection of values implementing handy operation to analyse them.
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...
std::unique_ptr< RDataFrame > MakeRVecDataFrame(std::function< void()> deleteRVecs, std::pair< std::string, ROOT::RVec< ColumnTypes > > const &...colNameProxyPairs)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
TSeq< unsigned int > TSeqU