25 static enum EDebugLevelTypes {
33 result += UnitTest1();
34 result += UnitTest2();
35 result += UnitTest3();
36 result += UnitTest4();
37 result += UnitTest5();
38 result += UnitTest6();
39 result += UnitTest7();
43 void PrintBenchmark() {
44 if (fgDebugLevel == kNoDebug) {
50 printf(
"******************************************************************\n");
54 printf(
"* SYS: %s\n",sp.
Data());
57 printf(
"* SYS: %s\n",sp.
Data());
62 printf(
"* SYS: %s\n",sp.
Data());
67 printf(
"* SYS: Windows 95\n");
69 printf(
"* SYS: %s %s \n",os,
gSystem->
Getenv(
"PROCESSOR_IDENTIFIER"));
73 printf(
"*****************************************************************************************\n");
83 printf(
"*****************************************************************************************\n");
84 printf(
"* ROOTMARKS = %6.1f * Root%-8s %d/%d\n", rootmarks,
gROOT->GetVersion(),
85 gROOT->GetVersionDate(),
gROOT->GetVersionTime());
86 printf(
"*****************************************************************************************\n");
92 std::cout <<
"UNIT TEST 1" << std::endl;
95 const UInt_t smpSize1 = 71;
96 const UInt_t smpSize2 = 135;
102 const Double_t smp1[smpSize1] = {194, 15, 41, 29, 33, 181, 413, 14, 58, 37, 100, 65, 9, 169, 447, 18, 4, 36, 201, 118, 34, 31, 18, 18, 67, 57, 62, 7, 22, 34, 90, 10, 60, 186, 61, 49, 14, 24, 56, 20, 79, 84, 44, 59, 29, 118, 25, 156, 310, 76, 26, 44, 23, 62, 130, 208, 70, 101, 208, 74, 57, 48, 29, 502, 12, 70, 21, 29, 386, 59, 27};
104 const Double_t smp2[smpSize2] = {55, 320, 56, 104, 220, 239, 47, 246, 176, 182, 33, 23, 261, 87, 7, 120, 14, 62, 47, 225, 71, 246, 21, 42, 20, 5, 12, 120, 11, 3, 14, 71, 11, 14, 11, 16, 90, 1, 16, 52, 95, 97, 51, 11, 4, 141, 18, 142, 68, 77, 80, 1, 16, 106, 206, 82, 54, 31, 216, 46, 111, 39, 63, 18, 191, 18, 163, 24, 50, 44, 102, 72, 22, 39, 3, 15, 197, 188, 79, 88, 46, 5, 5, 36, 22, 139, 210, 97, 30, 23, 13, 14, 359, 9, 12, 270, 603, 3, 104, 2, 438, 50, 254, 5, 283, 35, 12, 487, 18, 100, 7, 98, 5, 85, 91, 43, 230, 3, 130, 102, 209, 14, 57, 54, 32, 67, 59, 134, 152, 27, 14, 230, 66, 61, 34};
118 Int_t result = PrintResultAD2Samples(nsmps, A2, expectedA2_akN, sigmaN, zScore, pvalueAD);
126 result += PrintResultKS(nsmps, Dn, expectedDn, pvalueKS);
133 std::cout <<
"UNIT TEST 2" << std::endl;
136 const UInt_t smpSize = 16;
141 const Double_t smp1[smpSize] = {38.7, 41.5, 43.8, 44.5, 45.5, 46.0, 47.7, 58.0, 39.2, 39.3, 39.7, 41.4, 41.8, 42.9, 43.3, 45.8};
142 const Double_t smp2[smpSize] = {34.0, 35.0, 39.0, 40.0, 43.0, 43.0, 44.0, 45.0, 34.0, 34.8, 34.8, 35.4, 37.2, 37.8, 41.2, 42.8};
156 Int_t result = PrintResultAD2Samples(nsmps, A2, expectedA2_akN, sigmaN, zScore, pvalueAD);
164 result += PrintResultKS(nsmps, Dn, expectedDn, pvalueKS);
171 std::cout <<
"UNIT TEST 3" << std::endl;
173 #ifndef R__HAS_MATHMORE 174 std::cout <<
"SKIPPED (Mathmore is not present) " << std::endl;
188 assert(sample[i] == data);
193 if (GoFTStress::fgDebugLevel == GoFTStress::kStandardDebug)
194 std::cout <<
"LogNormal fitting" << std::endl;
202 Int_t result = PrintResultAD1Sample(A2, expectedA2, pvalueAD);
210 result += PrintResultKS(nsmps, Dn, expectedDn, pvalueKS);
218 std::cout <<
"UNIT TEST 4" << std::endl;
230 assert(sample[i] == data);
235 if (GoFTStress::fgDebugLevel == GoFTStress::kStandardDebug)
236 std::cout <<
"**Exponential fitting**" << std::endl;
240 Double_t pvalueAD = goft->operator()();
244 Int_t result = PrintResultAD1Sample(A2, expectedA2, pvalueAD);
252 result += PrintResultKS(nsmps, Dn, expectedDn, pvalueKS);
259 std::cout <<
"UNIT TEST 5" << std::endl;
271 assert(sample[i] == data);
277 if (GoFTStress::fgDebugLevel == GoFTStress::kStandardDebug)
278 std::cout <<
"**Gaussian fitting**" << std::endl;
285 Int_t result = PrintResultAD1Sample(A2, expectedA2, pvalueAD);
292 result += PrintResultKS(nsmps, Dn, expectedDn, pvalueKS);
299 std::cout <<
"UNIT TEST 6" << std::endl;
310 assert(sample[i] == data);
316 if (GoFTStress::fgDebugLevel == GoFTStress::kStandardDebug)
317 std::cout <<
"**Landau fitting**" << std::endl;
324 Int_t result = PrintResultAD1Sample(A2, expectedA2, pvalueAD);
331 result += PrintResultKS(nsmps, Dn, expectedDn, pvalueKS);
338 std::cout <<
"UNIT TEST 7" << std::endl;
361 if (GoFTStress::fgDebugLevel == GoFTStress::kStandardDebug)
362 std::cout <<
"**Landau fitting**" <<
" in [ " << xmin <<
" , " << xmax <<
" ]" << std::endl;
372 Int_t result = PrintResultAD1Sample(A2, expectedA2, pvalueAD,0.002);
379 result += PrintResultKS(nsmps, Dn, expectedDn, pvalueKS,0.001);
387 Double_t A2_akN = A2 * sigmaN + (nsmps - 1);
389 if (GoFTStress::fgDebugLevel == GoFTStress::kStandardDebug) {
390 std::cout <<
"Anderson-Darling 2-Samples Test" << std::endl;
392 std::cout <<
"pvalue = " << pvalue << std::endl;
394 std::cout <<
"zScore = " << zScore << std::endl;
396 std::cout <<
"Expected A2 value = " << A2 << std::endl;
398 std::cout <<
"A2_akN = " << A2_akN << std::endl;
400 std::cout <<
"Expected A2_akN value = " << expectedA2_akN << std::endl;
402 if (
TMath::Abs(A2_akN - expectedA2_akN) < limit * expectedA2_akN ||
TMath::Abs(A2 - zScore) < limit * zScore) {
403 if (GoFTStress::fgDebugLevel >= GoFTStress::kBasicDebug)
404 std::cout <<
"+++++++ TEST OK +++++++ \n" << std::endl;
407 if (GoFTStress::fgDebugLevel >= GoFTStress::kBasicDebug)
408 std::cout <<
"------- TEST FAIL ------- \n" << std::endl;
415 if (GoFTStress::fgDebugLevel == GoFTStress::kStandardDebug) {
416 std::cout <<
"Anderson-Darling 1-Sample Test" << std::endl;
418 std::cout <<
"pvalue = " << pvalue << std::endl;
420 std::cout <<
"A2 value = " << A2 << std::endl;
422 std::cout <<
"Expected A2 value = " << expectedA2 << std::endl;
424 if (
TMath::Abs(A2 - expectedA2) < limit * expectedA2) {
425 if (GoFTStress::fgDebugLevel >= GoFTStress::kBasicDebug)
426 std::cout <<
"+++++++ TEST OK +++++++ \n" << std::endl;
429 if (GoFTStress::fgDebugLevel >= GoFTStress::kBasicDebug)
430 std::cout <<
"------- TEST FAIL ------- \n" << std::endl;
437 if (GoFTStress::fgDebugLevel == GoFTStress::kStandardDebug) {
438 std::cout <<
"Kolmogorov-Smirnov "<< nsmps <<
"-Samples Test" << std::endl;
440 std::cout <<
"pvalue = " << pvalue << std::endl;
442 std::cout <<
"Dn value = " << Dn << std::endl;
444 std::cout <<
"Expected Dn value = " << expectedDn << std::endl;
446 if (
TMath::Abs(Dn - expectedDn) < limit * expectedDn) {
447 if (GoFTStress::fgDebugLevel >= GoFTStress::kBasicDebug)
448 std::cout <<
"+++++++ TEST OK +++++++ \n" << std::endl;
451 if (GoFTStress::fgDebugLevel >= GoFTStress::kBasicDebug)
452 std::cout <<
"------- TEST FAIL ------- \n" << std::endl;
459 #pragma link C++ class GoFTStress-; 462 GoFTStress::EDebugLevelTypes GoFTStress::fgDebugLevel;
469 GoFTStress::fgDebugLevel = GoFTStress::kBasicDebug;
471 }
else if (argc == 3 && strcmp(argv[1],
"--o") == 0) {
472 if (strcmp(argv[2],
"0") == 0 || strcmp(argv[2],
"no-debug") == 0) {
473 GoFTStress::fgDebugLevel = GoFTStress::kNoDebug;
475 }
else if (strcmp(argv[2],
"1") == 0 || strcmp(argv[2],
"basic-debug") == 0) {
476 GoFTStress::fgDebugLevel = GoFTStress::kBasicDebug;
478 std::cout <<
"Debug level: basic." << std::endl;
479 }
else if (strcmp(argv[2],
"2") == 0 || strcmp(argv[2],
"standard-debug") == 0) {
480 GoFTStress::fgDebugLevel = GoFTStress::kStandardDebug;
482 std::cout <<
"Debug level: standard." << std::endl;
483 }
else if (strcmp(argv[2],
"help") == 0) {
484 std::cout <<
"Showing help: " << std::endl;
489 std::cout <<
"Please type just one of the following debug levels in either formats preceded by \"--o\":" << std::endl;
490 std::cout <<
"a) no-debug(0) [no test results printing]" << std::endl;
491 std::cout <<
"b) basic-debug(1) [prints either \"OK\" or \"FAIL\" test results]" << std::endl;
492 std::cout <<
"c) standard-debug(2) [prints summarized test results]" << std::endl;
496 if (GoFTStress::fgDebugLevel >= GoFTStress::kBasicDebug) {
497 std::cout <<
"*****************************************************************************************" << std::endl;
498 std::cout <<
"* Goodness of Fit Test STRESS suite *" <<std::endl;
499 std::cout <<
"*****************************************************************************************" << std::endl;
509 GoFTStress* goftStressTest =
new GoFTStress;
511 result = goftStressTest->RunTests();
515 goftStressTest->PrintBenchmark();
517 delete goftStressTest;
528 #if not defined(__CINT__) && not defined(__MAKECINT__) void SetDistribution(EDistribution dist)
Double_t Landau(Double_t x, Double_t mpv=0, Double_t sigma=1, Bool_t norm=kFALSE)
The LANDAU function.
Random number generator class based on M.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
double LogNormal(double zeta, double sigma)
Log-normal distribution.
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...
virtual TString GetFromPipe(const char *command)
Execute command and return output in TString.
void KolmogorovSmirnovTest(Double_t &pvalue, Double_t &testStat) const
virtual void Stop(const char *name)
Terminates Benchmark with specified name.
const char * Data() const
virtual void Start(const char *name)
Starts Benchmark with the specified name.
virtual const char * Getenv(const char *env)
Get environment variable.
Float_t GetCpuTime(const char *name)
Returns Cpu time used by Benchmark name.
void AndersonDarling2SamplesTest(Double_t &pvalue, Double_t &testStat) const
virtual void Print(Option_t *name="") const
Prints parameters of Benchmark name.
R__EXTERN TSystem * gSystem
virtual const char * GetBuildNode() const
Return the build node name.
R__EXTERN TBenchmark * gBenchmark
Double_t LandauI(Double_t x)
Returns the value of the Landau distribution function at point x.
virtual const char * GetName() const
Returns name of object.
This class is a ROOT utility to help benchmarking applications.
T MaxElement(Long64_t n, const T *a)
Int_t RunTests(Int_t argc, Char_t *argv[])
Functor1D class for one-dimensional functions.
Int_t stressGoFTest(Int_t argc=1, Char_t *argv[]=0)
virtual Double_t Landau(Double_t mean=0, Double_t sigma=1)
Generate a random number following a Landau distribution with location parameter mu and scale paramet...
void AndersonDarlingTest(Double_t &pvalue, Double_t &testStat) const
int main(int argc, char **argv)
void SetUserDistribution(Dist &dist, EUserDistribution userDist=kPDF, Double_t xmin=1, Double_t xmax=0)
void KolmogorovSmirnov2SamplesTest(Double_t &pvalue, Double_t &testStat) const
virtual Double_t Exp(Double_t tau)
Returns an exponential deviate.
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
Documentation for the Random class.
T MinElement(Long64_t n, const T *a)