Dear ROOT users,
I have come across several problems with histograms. I use TH1 class.
Firstly, I would like to obtain the number of overflow and underflow bins. This property can be listed in the statistics box (TPaveStats). I can get all the other variables such as RMS:
rms = histogram1->GetRMS();
Secondly, I have problems to change properties of each statistics box individually. I defined:
For instance, I Would like to change the position of the statistics box at the TPad number 3 without affecting the others.
Finally, is it possible to plot grid on a specific pad?
This does not seem working:
TCanvas *c1 = new TCanvas("c1","Analysis");
Thank you for your help.
For each histogram, there is only one underflow and one overflow bin. They may or may not be empty. If you want the number in the stat box, you can do something like
printf("Underflow: %f, overflow: %f\n", h1->GetBinContent(0), h1->GetBinContent(h1->GetNbinsX() + 1));
See the example below.
Sure, here is the example, which incorporates all the features:
c1 = new TCanvas("c1");
printf("Underflow: %f, overflow: %f\n", h2->GetBinContent(0), h2->GetBinContent(h2->GetNbinsX() + 1));
TPaveStats *stats = (TPaveStats*)c1_2->GetPrimitive("stats");//obtaining the stat box from the second pad
stats->SetX1NDC(0.5);//shifting the stat box to the left
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.