PandaRoot
FWHM.h
Go to the documentation of this file.
1 /*
2  * FWHM.h
3  *
4  * Created on: 22.11.2023
5  * Author: tstockmanns
6  */
7 
8 #ifndef TOOLS_FWHM_H_
9 #define TOOLS_FWHM_H_
10 
11 #include <TH1.h>
12 
13 static double FWHM(TH1* h1){
14  int bin1 = h1->FindFirstBinAbove(h1->GetMaximum()/2);
15  int bin2 = h1->FindLastBinAbove(h1->GetMaximum()/2);
16  double fwhm = h1->GetBinCenter(bin2) - h1->GetBinCenter(bin1);
17 
18 // std::cout << h1->GetName() << std::endl;
19 // std::cout << "FWHM: max: " << h1->GetMaximum() << " halfMax " << h1->GetMaximum()/2 << " bin1 - bin2 " << bin1 << " - " << bin2 << " fwhm " << fwhm << std::endl;
20  return fwhm;
21 }
22 
23 #endif /* TOOLS_FWHM_H_ */
static double FWHM(TH1 *h1)
Definition: FWHM.h:13