14 void smooth_hist(
const char * fname,
double xmin,
double xmax,
int n1,
int n2) {
16 std::cout <<
"smoothing a " << fname <<
" histogram" << std::endl;
19 TH1D * h2 =
new TH1D(
"h2",
"h2",100,xmin,xmax);
30 if (p2 < p1)
Error(
"testSmooth",
"TH1::Smooth is not working correctly - a worst chi2 is obtained");
32 std::cout <<
" chi2 test non-smoothed histo " << p1 << std::endl;
33 std::cout <<
" chi2 test smoothed histo " << p2 << std::endl;
38 std::cout <<
" AD test non-smoothed histo " << a1 << std::endl;
39 std::cout <<
" AD test smoothed histo " << a2 << std::endl;
44 std::cout <<
" KS test non-smoothed histo " << k1 << std::endl;
45 std::cout <<
" KS test smoothed histo " << k2 << std::endl;
51 h2->
Scale(
double(n1)/n2);
56 void testSmooth(
int n1 = 1000,
int n2 = 1000000) {
64 smooth_hist(
"gaus",-5,5,n1,n2);
65 smooth_hist(
"landau",-5,15,n1,n2);
66 smooth_hist(
"expo",-5,0,n1,n2);
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
virtual void Smooth(Int_t ntimes=1, Option_t *option="")
Smooth bin contents of this histogram.
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
virtual Double_t Chi2Test(const TH1 *h2, Option_t *option="UU", Double_t *res=0) const
test for comparing weighted and unweighted histograms
static double p2(double t, double a, double b, double c)
void Error(const char *location, const char *msgfmt,...)
virtual Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const
Statistical test of compatibility in shape between this histogram and h2, using Kolmogorov test...
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual Double_t AndersonDarlingTest(const TH1 *h2, Option_t *option="") const
Statistical test of compatibility in shape between this histogram and h2, using the Anderson-Darling ...
static double p1(double t, double a, double b)
tomato 1-D histogram with a double per channel (see TH1 documentation)}
virtual void SetName(const char *name)
Change the name of this histogram.
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D