Home | News | Documentation | Download

How to extract histogram entries bin by bin from Tree leaves in to an array

Hello, I am a beginner on root, I would like to extract entries from a histogram obtained by geant4 and contained in a tree and bin by bin arrange them into an array.

Would you please have an idea of how I could proceed? I already know how to open a tree.

Thank you in advance for your answers

May be something like that:

int n = G4_histogram->GetNbinsX();
double bins[n];
for (int i=0; i<n; i++) bin[i] = G4_histogram->GetbinContent(i+1);