Dear all,
I’m interested in getting the bin width of the histogram I’m currently fitting in my fit function. The way I usually do this is:
// Find Bin Width
TVirtualFitter *fitter = TVirtualFitter::GetFitter(); //the current fitter
TH1 *hist = (TH1*)fitter->GetObjectFit(); //the histogram being fitted
Double_t bin_width = hist->GetBinWidth(1);
However, this does not always work, unfortunately. I’ve found a similar topic already discussed in this forum. Please see the attachment for the example macro which can be used to test. This macro works for ROOT version 5.17.00, but it fails in ROOT version 5.26.00, because the pointer to the TVirtualFitter is NULL.
Did I miss something in the latest ROOT developments?
Can you tell me which is the correct way to get the bin width of the histogram being fitted, in the fitting function?
Thank you in advance for your help,
Angela
Fits.C (1.42 KB)