Read y axis of a histogram

hello experts
i have a histogram that only has one bin centered at x=0.5, now i want to read the precise value of y coordinate of this bin, how can I do it with root?
i tried to change the draw option as “text”, but it can only read the coordinate to 6 digit, i want it more precisely to like 12 digit, is it possible to do that?
thanks a lot

Search and read about GetBinContent in the TH1 documentation.

something like that:

  TH1D *h = new TH1D("h", "", 100, 0, 1);
  h->Fill(0.5, 3.14159265358979);

  double binContent = h->GetBinContent(h->FindBin(0.5));
  std::cout << std::setprecision(12) << binContent << std::endl;
1 Like

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