11 #ifndef ROOT_TTreeAsFlatMatrix 12 #define ROOT_TTreeAsFlatMatrix 22 template <
typename dtype>
28 template <
typename BufType,
typename... ColTypes, std::size_t... Idx>
32 auto buffer = matrix.data();
34 auto fillMatrix = [buffer](ColTypes... cols,
ULong64_t entry) {
35 int expander[] = { (buffer[entry *
sizeof...(Idx) + Idx] = cols, 0)... };
39 auto columnsWithEntry = columns;
40 columnsWithEntry.emplace_back(
"tdfentry_");
43 dataframe.
Foreach(fillMatrix, columnsWithEntry);
46 template <
typename BufType,
typename... ColTypes>
ULong64_t GetVectorAddress(std::vector< dtype > &p)
void Foreach(F f, const ColumnNames_t &columns={})
Execute a user-defined function on each entry (instant action)
ULong64_t GetAddress(std::vector< std::string > &p)
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees, CSV's and other data formats.
unsigned long long ULong64_t
make_index_sequence< sizeof...(_Tp)> index_sequence_for
typedef void((*Func_t)())
A TTree object has a header with a name and a title.
void TTreeAsFlatMatrix(std::index_sequence< Idx... >, TTree &tree, std::vector< BufType > &matrix, std::vector< std::string > &columns)
void TTreeAsFlatMatrixHelper(TTree &tree, std::vector< BufType > &matrix, std::vector< std::string > &columns)