56 std::tuple<ROOT::RVec<ColumnTypes>...>
fColumns;
65 std::vector<std::pair<ULong64_t, ULong64_t>> fEntryRanges{};
71 template <std::size_t... S>
75 (*
static_cast<ColumnTypes *
>(fPointerHolders[S][
slot]->GetPointer()) = std::get<S>(fColumns)[
entry], 0)...};
79 template <std::size_t... S>
85 const std::vector<size_t>
colLengths{std::get<S>(fColumns).size()...};
90 err +=
"Column \"" + fColNames[i] +
"\" and column \"" + fColNames[0] +
91 "\" have different lengths: " + std::to_string(
expectedLen) +
" and " +
96 throw std::runtime_error(err);
101 std::string
AsString() {
return "Numpy data source"; };
129 std::unique_ptr<ROOT::Detail::RDF::RColumnReaderBase>
135 if (fColTypesMap.end() == it) {
136 std::string err =
"The specified column name, \"" +
colNameStr +
"\" is not known to the data source.";
137 throw std::runtime_error(err);
144 " while the id specified is associated to type " +
idName;
145 throw std::runtime_error(err);
150 return std::make_unique<ROOT::Internal::RDF::RVecDSColumnReader>(fPointerHolders[
index][
slot]);
153 throw std::runtime_error(
"Could not find column name \"" +
colNameStr +
"\" in available column names.");
166 const auto key = std::string(
colName);
167 return fColTypesMap.at(key);
172 const auto key = std::string(
colName);
173 const auto endIt = fColTypesMap.end();
174 return endIt != fColTypesMap.find(key);
179 SetEntryHelper(
slot,
entry, std::index_sequence_for<ColumnTypes...>());
186 const auto nCols = fColNames.size();
187 fPointerHolders.resize(
nCols);
197 for (
auto &&
ptrHolder : fPointerHoldersModels)
203 ColLengthChecker(std::index_sequence_for<ColumnTypes...>());
204 const auto nEntries = GetEntriesNumber();
207 fEntryRanges.resize(fNSlots);
210 for (
auto &&
range : fEntryRanges) {
230std::unique_ptr<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::function< void()> fDeleteRVecs
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
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.
void SetNSlots(unsigned int nSlots) final
Inform RDataSource of the number of processing slots (i.e.
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::function< void()> deleteRVecs, std::pair< std::string, ROOT::RVec< ColumnTypes > > const &...colNameProxyPairs)