11#ifndef ROOT_PyROOTHelpers
12#define ROOT_PyROOTHelpers
24template <
typename dtype>
39template <
typename BufType,
typename... ColTypes, std::size_t... Idx>
41 std::vector<std::string> &columns)
43 auto buffer = matrix.data();
45 auto fillMatrix = [buffer](ColTypes... cols,
ULong64_t entry) {
46 int expander[] = {(buffer[entry *
sizeof...(Idx) + Idx] = cols, 0)...};
50 auto columnsWithEntry = columns;
51 columnsWithEntry.emplace_back(
"tdfentry_");
54 dataframe.
Foreach(fillMatrix, columnsWithEntry);
57template <
typename BufType,
typename... ColTypes>
60 TTreeAsFlatMatrix<BufType, ColTypes...>(std::index_sequence_for<ColTypes...>(), tree, matrix, columns);
69 return df.Take<T>(column);
unsigned long long ULong64_t
Portable unsigned long integer 8 bytes.
void Foreach(F f, const ColumnNames_t &columns={})
Execute a user-defined function on each entry (instant action).
Smart pointer for the return type of actions.
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
A TTree represents a columnar dataset.
void TTreeAsFlatMatrixHelper(TTree &tree, std::vector< BufType > &matrix, std::vector< std::string > &columns)
ROOT::RDF::RResultPtr< std::vector< T > > RDataFrameTake(ROOT::RDF::RNode df, std::string_view column)
void TTreeAsFlatMatrix(std::index_sequence< Idx... >, TTree &tree, std::vector< BufType > &matrix, std::vector< std::string > &columns)
ULong64_t GetVectorAddress(std::vector< dtype > &p)
ULong64_t GetAddress(std::vector< std::string > &p)
RInterface<::ROOT::Detail::RDF::RNodeBase > RNode