Getting List of histogram name from Flat Ntuple or simply a root file

Hello Experts,

I need to know the way to get the list of Histogram names in the Flat N-tuple, likewise we get from Tree -> MakeClass(“anyname”). Can anyone please tell me ?

Thanks in advance for positive and quick responses.


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

you can use TTree::Print to print out available branches or you can loop over the list of branches, something like:

for (auto b : *t.GetListOfBranches()) { std::cout << b->GetName() << std::endl; }

Alternatively, you can construct a RDataFrame from the NTuple and then call dataframe.GetColumnNames(), which also returns non-top-level branches (but in the case of a flat NTuple it should not make a difference).


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.