void read_TH2D() { TFile *f = TFile::Open("TH2D.root"); if (!f || f->IsZombie()) { delete f; return; } // just a precaution TCanvas *c; f->GetObject("PDM", c); if (!c) { delete f; return; } // just a precaution c->Draw(); TH2D *h2 = (TH2D *)c->GetPrimitive("Simulated PDM"); if (!h2) { delete f; return; } // just a precaution Int_t x, y; Double_t photons; for (x = 1; x <= h2->GetNbinsX(); x++) { cout<<"----------" <GetNbinsY(); y++) { cout<<"new y" <GetBinContent(x,y); cout<<"bin("<