I was trying to get histogram information in a source code. where I’m getting bin content up to 3 decimal places. Some what like,
I need bin content with precision of at least 5-6 decimal places.
For histogram I’m using,
TH1D *hist_PT = new TH1D(“PT”, “PT”, 30, 0, 500);
in your example you do not “Get” but you “Set”.
The 6 digits are there:
root  TH1D *hist_PT = new TH1D("PT", "PT", 30, 0, 500);
root  hist_PT->SetBinContent(1,999.123456);
root  printf("%10.6f\n",hist_PT->GetBinContent(1));
Thank you for answer. I think, I didn’t explain question more precisely. Let me explain,
I’m generating a histogram in main macro and I’m saving details (like bin contents etc.) in some other .C file by command,
In this “his.C” file, I see that bin content is up to 3 decimal places as I have shown in starting of main question. I want those bin contents up to some desired decimals. Do I have control on that using main macro?
canvas->SaveAs(“hist.C”); you cannot specify the precision. To save the bins contants with the precision you require, you will need to write a small method looping over the bins and using a format similar to the one I showed in the previous post.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.