kshaw
February 11, 2008, 10:50am
1
Hi there
I am wanting to find the value for x on my histogram for which y = largest value.
So to find the maximum value for y (the peak of the histogram) I have
const Double_t MaxY = myHisto->GetMaximum();
but how do I then determine what the corresponding value on the x-axis is?
Many thanks
kate
tpochep
February 11, 2008, 11:11am
2
[quote]Hi there
I am wanting to find the value for x on my histogram for which y = largest value.
So to find the maximum value for y (the peak of the histogram) I have
const Double_t MaxY = myHisto->GetMaximum();
but how do I then determine what the corresponding value on the x-axis is?
Many thanks
kate[/quote]
What about int maxBin = hist->GetMaximumBin()? And hist->GetXaxis()->GetBinCenter(maxBin) ?
Or hist->GetBinCenter(maxBin)?
kshaw
February 11, 2008, 11:52am
3
Great
maxBin = hist->GetMaximumBin()
gets the bin I want (which correspondes to maximum Y value), then I multiply it by the bin size and got the value for x.
Thanks very much!
Kate