I would like to get help for filling 1 D histogram with variable binning & irregular bin size from another 1D histogram’s bin contents with regular binning.
More specifically,
I have 2D scattering plot and get 1 D histogram with FitSlicesY. Now this 1 D histogram with regular bin size has to be converted into another histogram with desired variable (irregular) bin size within the range.
// -case 2 xbins!=0
// a new histogram is created (you should specify newname).
// The parameter is the number of variable size bins in the created histogram.
// The array xbins must contain ngroup+1 elements that represent the low-edge
// of the bins.
// If the original histogram has errors stored (via Sumw2), the resulting
// histograms has new errors correctly calculated.
//
// examples: if h1 is an existing TH1F histogram with 100 bins
// Double_t xbins[25] = {...} array of low-edges (xbins[25] is the upper edge of last bin
// h1->Rebin(24,"hnew",xbins); //creates a new variable bin size histogram hnew
New histogram gives greater value than the original value in the range (even from the highest bin) for a modified bin size.
eg.
Original histo has 4% -4.5% for 200-360 in 4 bins
Modified histo has 10.5 % for 200-350 in 1 bin
That’s where I see the problem when I simply do rebin. Could you please clarify it?
Thanks
Here is my root files attached.
Please have a look.
test.root has 2D scattering plot of name LeptonInvPtResVPtGen_Scatter4
Then I FitSlicesY and get 1D LeptonInvPtResVPtGen_Scatter4_2 (saved as test_sigma.root)
It has to be rebinned (irregular bin size).
I do not understand your rebinning!
The slice “LeptonInvPtResVPtGen_Scatter4_2” has a bin-width of 40, the first bin is from 20->60 and the second from 60->100.
Now you try to rebin into a new histogram where the 1st bin is from 20->30 and the second from 30->40. The rebinning makes sense only when the bin edges are identical. For example you could define the 1st bin going from 20->100 and the 2nd from 100->400.
In your comparison you should also take into account the normalization, ie divide by the bin-width.
Thanks.
Finally, I defined the required binning in the original script so that my original root file has the histogram filled accordingly.
No rebinning …
Thanks again