Histogram smoothing.
int ipad = 1;
void smooth_hist(const char * fname, double xmin, double xmax, int n1, int n2) {
std::cout << "smoothing a " << fname << " histogram" << std::endl;
TH1D * h1 =
new TH1D(
"h1",
"h1",100,xmin,xmax);
TH1D * h2 =
new TH1D(
"h2",
"h2",100,xmin,xmax);
if (p2 < p1)
Error(
"testSmooth",
"TH1::Smooth is not working correctly - a worst chi2 is obtained");
std::cout << " chi2 test non-smoothed histo " << p1 << std::endl;
std::cout << " chi2 test smoothed histo " << p2 << std::endl;
std::cout << " AD test non-smoothed histo " << a1 << std::endl;
std::cout << " AD test smoothed histo " << a2 << std::endl;
std::cout << " KS test non-smoothed histo " << k1 << std::endl;
std::cout << " KS test smoothed histo " << k2 << std::endl;
h2->
Scale(
double(n1)/n2);
}
void testSmooth(int n1 = 1000, int n2 = 1000000) {
smooth_hist("gaus",-5,5,n1,n2);
smooth_hist("landau",-5,15,n1,n2);
smooth_hist("expo",-5,0,n1,n2);
}
- Author
- Rene Brun
Definition in file testSmooth.C.