Hi, I need to rebin histograms of my macro. Running I would like a bin width =1 …Looking the plot that I got by running the macro I see the range is [-600;600], so I wrote:
But it didn’t work, so I also tried to force the x range writing
but it didn’t work too. In both situations I get this error
and I get plots having the ROOT automatically binning ( bin width =50).
Isn’t possible to set an user binning? Obiuvlsy if it’s possible to get a width=1 without knowing the range it should be better!
calo.cpp (20.6 KB)
ROOT Version: 5.34/38
TH1::Rebin can only increase the bin width.
You need to create your histogram with the fine binning, e.g.:
t->Draw(Form("Calo_Time[%d]-Calo_Time[%d] >> htemp(1200, -600., 600.)", a, b));
Hi @Wile_E_Coyote ,i used your code for the re-binning and it worked, but I had also to cut some data and I need 2 use 2 gaussian fit. Following your reply in this topic Fitting with two gaussian curves , I got a good 2 gaussian fit. Anyway, in the statistical box, I get the mean value of the 2 separated fits, instead I’d like to get also the mean and sigma values of the produced by your code of the total fit.
Should it be possible?
Following @couet reply to this topic Adding text to statistics box I wrote
TPaveStats *statsgdeltatime = (TPaveStats*)htemp->GetListOfFunctions()->FindObject("stats");
statsgdeltatime->AddText("Mean %lf \n #sigma %lf",mean,sigma);
but I get error.
Make sure that, before the line with
FindObject("stats"), you execute:
Hi wile, before that line I had
I also added
but I get the same error (see attachment)
anyway it looks like that the error is due to the variables because if I write for example
statsgdeltatime->AddText(TString::Format("Mean %g \n #sigma %g", mean, sigma));
Thanky you wile. your code works, I had just to modify it to
tatsgdeltatime->AddText(TString::Format("Mean %g", mean));
statsgdeltatime->AddText(TString::Format("Sigma %g", sigma));
command didn’t work and I also tried
but it didn’t work too.
But I’ve 1 more question please currently it center all the text, should it be possible to get “Mean” on the left and the value on the right (similiar to what ROOT does)?
// Note that "=" is a control character
statsgdeltatime->AddText(TString::Format("Mean = %g", mean));
statsgdeltatime->AddText(TString::Format("Sigma = %g", sigma));
Thank you wile! sorry! I didn’t write the “=”
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.