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
typedef void((*Func_t)())
The public interface to the RDataFrame federation of classes.
RResultPtr< COLL > Take(std::string_view column="")
Return a collection of values of a column (lazy action, returns a std::vector by default)
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 high level interface for analyses of data stored in TTrees,...
A TTree represents a columnar dataset.
basic_string_view< char > string_view
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)