27double landau(
double x) {
40 TF1 *
f1 =
new TF1(
"logNormal",
"ROOT::Math::lognormal_pdf(x,[0],[1])",0,500);
48 TH1D* h1smp =
new TH1D(
"h1smp",
"LogNormal distribution histogram", 100, 0, 500);
51 for (
UInt_t i = 0; i < nEvents1; ++i) {
79 Double_t A2_1 = goftest_1-> AndersonDarlingTest(
"t");
84 Double_t pvalueAD_1 = goftest_1-> AndersonDarlingTest();
85 Double_t pvalueAD_2 = (*goftest_1)();
86 assert(pvalueAD_1 == pvalueAD_2);
96 Double_t Dn_1 = goftest_1-> KolmogorovSmirnovTest(
"t");
101 Double_t pvalueKS_1 = goftest_1-> KolmogorovSmirnovTest();
103 assert(pvalueKS_1 == pvalueKS_2);
106#ifdef TEST_ERROR_MESSAGE
109 assert(A2 == pvalueKS);
114 sprintf(str1,
"p-value for A-D 1-smp test: %f", pvalueAD_1);
120 sprintf(str2,
"p-value for K-S 1-smp test: %f", pvalueKS_1);
131 TH1D* h2smps_1 =
new TH1D(
"h2smps_1",
"Gaussian distribution histograms", 100, 0, 500);
134 TH1D* h2smps_2 =
new TH1D(
"h2smps_2",
"Gaussian distribution histograms", 100, 0, 500);
138 for (
UInt_t i = 0; i < nEvents1; ++i) {
141 h2smps_1->
Fill(data);
143 h2smps_1->
Scale(1. / nEvents1,
"width");
148 for (
UInt_t i = 0; i < nEvents2; ++i) {
151 h2smps_2->
Fill(data);
153 h2smps_2->
Scale(1. / nEvents2,
"width");
154 h2smps_2->
Draw(
"SAME");
167 assert(A2_1 == A2_2);
170 pvalueAD_1 = goftest_2-> AndersonDarling2SamplesTest();
172 assert(pvalueAD_1 == pvalueAD_2);
177 Dn_1 = goftest_2-> KolmogorovSmirnov2SamplesTest(
"t");
179 assert(Dn_1 == Dn_2);
182 pvalueKS_1 = goftest_2-> KolmogorovSmirnov2SamplesTest();
184 assert(pvalueKS_1 == pvalueKS_2);
186#ifdef TEST_ERROR_MESSAGE
190 assert(A2 == pvalueKS);
194 sprintf(str1,
"p-value for A-D 2-smps test: %f", pvalueAD_1);
199 sprintf(str2,
"p-value for K-S 2-smps test: %f", pvalueKS_1);
209 for (
UInt_t i = 0; i < nEvents3; ++i) {
230 pvalueAD_1 = goftest_3a-> AndersonDarlingTest();
232 pvalueAD_2 = (*goftest_3b)();
235 std::cout <<
" \n\nTEST with LANDAU distribution:\t";
236 if (
TMath::Abs(pvalueAD_1 - pvalueAD_2) > 1.E-1 * pvalueAD_2) {
237 std::cout <<
"FAILED " << std::endl;
238 Error(
"goftest",
"Error in comparing testing using Landau and Landau CDF");
239 std::cerr <<
" pvalues are " << pvalueAD_1 <<
" " << pvalueAD_2 << std::endl;
242 std::cout <<
"OK ( pvalues = " << pvalueAD_2 <<
" )" << std::endl;
void Error(const char *location, const char *msgfmt,...)
R__EXTERN TRandom * gRandom
Functor1D class for one-dimensional functions.
void SetDistribution(EDistribution dist)
void AndersonDarling2SamplesTest(Double_t &pvalue, Double_t &testStat) const
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
virtual void SetParameters(const Double_t *params)
1-D histogram with a double per channel (see TH1 documentation)}
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
The most important graphics class in the ROOT system.
virtual void SetLogy(Int_t value=1)
Set Lin/Log scale for Y.
A Pave (see TPave) with text, lines or/and boxes inside.
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
Random number generator class based on M.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
double landau_pdf(double x, double xi=1, double x0=0)
Probability density function of the Landau distribution:
double lognormal_cdf(double x, double m, double s, double x0=0)
Cumulative distribution function of the lognormal distribution (lower tail).
T MinElement(Long64_t n, const T *a)
Return minimum of array a of length n.
T MaxElement(Long64_t n, const T *a)
Return maximum of array a of length n.
Double_t LandauI(Double_t x)
Returns the value of the Landau distribution function at point x.