11#ifndef ROOT_TTreeAsFlatMatrix
12#define ROOT_TTreeAsFlatMatrix
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>
unsigned long long ULong64_t
typedef void((*Func_t)())
void Foreach(F f, const ColumnNames_t &columns={})
Execute a user-defined function on each entry (instant action)
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...
A TTree object has a header with a name and a title.
ULong64_t GetAddress(std::vector< std::string > &p)
void TTreeAsFlatMatrixHelper(TTree &tree, std::vector< BufType > &matrix, std::vector< std::string > &columns)
void TTreeAsFlatMatrix(std::index_sequence< Idx... >, TTree &tree, std::vector< BufType > &matrix, std::vector< std::string > &columns)
ULong64_t GetVectorAddress(std::vector< dtype > &p)
Namespace for new ROOT classes and functions.
make_index_sequence< sizeof...(_Tp)> index_sequence_for