Read the data in TH2F plots


ROOT Version: Not Provided
Platform: Centos 7.1
Compiler: Not Provided


Hi, I want to read the data in a TH2F, 2-D histogram.
QCD.root (20.3 KB)
For example, I want to read the shapeB in this root file.
What I want to get is that: there are about 84478 entries. I want to get the x and y in each entry (or event). like get the position of each point in the 2-D plots.
Could you please help me?

You cannot get it for histograms.

All you can get is:

{
  TFile *f = TFile::Open("QCD.root");
  f->ls();
  TH2F *h;
  f->GetObject("shapeB", h);
  h->Print("all");
  h->Print("base");
}

Hi Wile:
Thanks a lot for the help. I also realise that it is reasonable to NOT get the exact position (x,y) for each event. Like electron in the detector, there is no exact position. On the contrary, we only have the bins and the number of events in each bin. Cheers!

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