Calculation of FWHM?

Hello ROOTers,

How can I calculate FWHM for the attached file?

thanks
t1.root (44.6 KB)

This post was moved to the forum.

Hi ,

Given an histogram pointer h1 , you can use these lines of code to compute the FWHM:

   int bin1 = h1->FindFirstBinAbove(h1->GetMaximum()/2);
   int bin2 = h1->FindLastBinAbove(h1->GetMaximum()/2);
   double fwhm = h1->GetBinCenter(bin2) - h1->GetBinCenter(bin1);

This will give a FWHM in within a 1 bin. If you want a more precise estimation you might want to use some interpolation of the bin histogram content

Lorenzo

1 Like