FWHM calculation problem

Hi, this is my first post, and im just staring with root, im trying to calculate the FWHM from my curve, but i notice that if i change the range of ploting the FWHM also changes :frowning: , what can i do to avoid that?
Thanks

Hi Maria,

Can you be more specific about what you do - what do you set a range on, how do you determine the FWHM?

Axel.

Hi Axel, when i declare my TH1D y wrote

TH1D * ResolutionPlot1 = new TH1D(“ResolutionPlot1”, “ResolutionPlot1”,100,0,8000);
so i understand that 100 is the bin number, and 0 and 8000 the min and max in my graph. I have 3 like this because i have 3 matrix, afeter taht i make an average of the 3, and i plot the result, after that i calculate the FWHM

int bin1 = ResolutionPlotSum->FindFirstBinAbove(ResolutionPlotSum->GetMaximum()/2);
int bin2 = ResolutionPlotSum->FindLastBinAbove(ResolutionPlotSum->GetMaximum()/2);
double fwhm = ResolutionPlotSum->GetBinCenter(bin2) - ResolutionPlotSum->GetBinCenter(bin1);
cout << endl << "FWHM = " << fwhm << endl;

my question is why if i change that 8000 for any other number the FWHM changes?

Sorry if i not more specific this is my first program.

Hi,

Let’s suppose for a second that you keep 8000 but you change the number of bins, say to 10. Of course now the value for the bin center are the half max will change, right?

When you change the 8000 to a different value, keeping the number of bins fixed, the same happens: the bin width changes, and so do the center values.

If you double the range and at the same time you double the number of bins, then you should get the same values. Try it - I’d be curious to hear the result!

Axel

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.