52 std::tuple<ROOT::RVec<ColumnTypes>...>
fColumns;
61 std::vector<std::pair<ULong64_t, ULong64_t>> fEntryRanges{};
67 template <std::size_t... S>
71 (*
static_cast<ColumnTypes *
>(fPointerHolders[S][
slot]->GetPointer()) = std::get<S>(fColumns)[
entry], 0)...};
75 template <std::size_t... S>
81 const std::vector<size_t>
colLengths{std::get<S>(fColumns).size()...};
86 err +=
"Column \"" + fColNames[i] +
"\" and column \"" + fColNames[0] +
87 "\" have different lengths: " + std::to_string(
expectedLen) +
" and " +
92 throw std::runtime_error(err);
97 std::string
AsString() {
return "Numpy data source"; };
123 std::unique_ptr<ROOT::Detail::RDF::RColumnReaderBase>
129 if (fColTypesMap.end() == it) {
130 std::string err =
"The specified column name, \"" +
colNameStr +
"\" is not known to the data source.";
131 throw std::runtime_error(err);
138 " while the id specified is associated to type " +
idName;
139 throw std::runtime_error(err);
144 return std::make_unique<ROOT::Internal::RDF::RVecDSColumnReader>(fPointerHolders[
index][
slot]);
147 throw std::runtime_error(
"Could not find column name \"" +
colNameStr +
"\" in available column names.");
160 const auto key = std::string(
colName);
161 return fColTypesMap.at(key);
166 const auto key = std::string(
colName);
167 const auto endIt = fColTypesMap.end();
168 return endIt != fColTypesMap.find(key);
173 SetEntryHelper(
slot,
entry, std::index_sequence_for<ColumnTypes...>());
180 const auto nCols = fColNames.size();
181 fPointerHolders.resize(
nCols);
191 for (
auto &&
ptrHolder : fPointerHoldersModels)
197 ColLengthChecker(std::index_sequence_for<ColumnTypes...>());
198 const auto nEntries = GetEntriesNumber();
201 fEntryRanges.resize(fNSlots);
204 for (
auto &&
range : fEntryRanges) {
224std::unique_ptr<RDataFrame>
227 return std::make_unique<RDataFrame>(
long long Long64_t
Portable signed long integer 8 bytes.
unsigned long long ULong64_t
Portable unsigned long integer 8 bytes.
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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
TPointerHolder * fPtrHolder
RVecDSColumnReader(TPointerHolder *ptrHolder)
void * GetImpl(Long64_t) final
A RDataSource implementation which takes a collection of RVecs, which are able to adopt data from Num...
size_t GetEntriesNumber()
std::vector< PointerHolderPtrs_t > fPointerHolders
void Initialize()
Convenience method called before starting an event-loop.
RVecDS & operator=(const RVecDS &)=delete
std::string GetTypeName(std::string_view colName) const
Type of a column as a string, e.g.
std::unordered_map< std::string, std::string > fColTypesMap
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::tuple< ROOT::RVec< ColumnTypes >... > fColumns
std::string GetLabel()
Return a string representation of the datasource type.
RVecDS & operator=(RVecDS &&)=delete
std::vector< std::string > fColNames
RVecDS(const RVecDS &)=delete
void SetEntryHelper(unsigned int slot, ULong64_t entry, std::index_sequence< S... >)
PointerHolderPtrs_t fPointerHoldersModels
void ColLengthChecker(std::index_sequence< S... >)
std::unique_ptr< ROOT::Detail::RDF::RColumnReaderBase > GetColumnReaders(unsigned int slot, std::string_view colName, const std::type_info &id) final
If the other GetColumnReaders overload returns an empty vector, this overload will be called instead.
Record_t GetColumnReadersImpl(std::string_view, const std::type_info &)
type-erased vector of pointers to pointers to column values - one per slot
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.
void SetNSlots(unsigned int nSlots) final
Inform RDataSource of the number of processing slots (i.e.
RVecDS(std::any lifeline, std::pair< std::string, ROOT::RVec< ColumnTypes > > const &...colsNameVals)
std::vector< ROOT::Internal::RDF::TPointerHolder * > PointerHolderPtrs_t
Mother class of TTypedPointerHolder.
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::any lifeline, std::pair< std::string, ROOT::RVec< ColumnTypes > > const &...colNameProxyPairs)