24{
27
30 string option;
31 double P;
33
34 try {
35
36 JParser<> zap(
"Auxiliary program for chi2 test of 1D histograms.");
37
38 zap[
'a'] =
make_field(inputFileA,
"measurement histogram, e.g: <file name>:<object name>");
39 zap[
'b'] =
make_field(inputFileA,
"reference histogram, e.g: <file name>:<object name>");
41 "UU", "UW", "WW",
42 "UUUF", "UWUF", "WWUF",
43 "UUOF", "UWOF", "WWOF",
44 "UUUFOF", "UWUFOF", "WWUFOF";
45 zap[
'P'] =
make_field(P,
"minimal p-value") = 0.0;
47
48 zap(argc, argv);
49 }
50 catch(const exception &error) {
51 FATAL(error.what() << endl);
52 }
53
54
57
58 if (ha == NULL) {
FATAL(
"No object at " << inputFileA << endl); };
59 if (hb == NULL) {
FATAL(
"No object at " << inputFileB << endl); };
60
61 TH1* h1a = NULL;
62 TH1* h1b = NULL;
63
64 if (h1a == NULL && dynamic_cast<TProfile*>(ha) != NULL) { h1a = dynamic_cast<TProfile*>(ha)->ProjectionX(); }
65 if (h1b == NULL && dynamic_cast<TProfile*>(hb) != NULL) { h1b = dynamic_cast<TProfile*>(hb)->ProjectionX(); }
66
67 if (h1a == NULL && dynamic_cast<TH1*>(ha) != NULL) { h1a = dynamic_cast<TH1*>(ha); }
68 if (h1b == NULL && dynamic_cast<TH1*>(hb) != NULL) { h1b = dynamic_cast<TH1*>(hb); }
69
70 if (h1a == NULL) {
FATAL(
"Object at " << inputFileA <<
" is not TH1." << endl); };
71 if (h1b == NULL) {
FATAL(
"Object at " << inputFileB <<
" is not TH1." << endl); };
72
73 const Double_t
result = h1a->Chi2Test(h1b, option.c_str());
74
75 NOTICE(
"Result " << result << endl);
76
77 if (P > 0.0) {
79 }
80
81 return 0;
82}
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary class to handle file name, ROOT directory and object name.
Utility class to parse command line options.
TObject * getObject(const JRootObjectID &id)
Get first TObject with given identifier.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).