28{
31
34
36 string fcn;
39
40 try {
41
42 JParser<> zap(
"Auxiliary program to test ROOT fit results.");
43
44 zap[
'f'] =
make_field(inputFile,
"histogram, e.g: <file name>:<object name>");
45 zap[
'='] =
make_field(fcn,
"function name") =
".*";
46 zap[
'@'] =
make_field(test,
"<parameter> <min> <max>");
48
49 zap(argc, argv);
50 }
51 catch(const exception &error) {
52 FATAL(error.what() << endl);
53 }
54
55
57
58 if (p == NULL) {
59 FATAL(
"No object at " << inputFile << endl);
60 };
61
62 TF1* f1 = NULL;
63
64 if (f1 == NULL && dynamic_cast<TF1*> (p) != NULL) { f1 = dynamic_cast<TF1*>(p); }
65 if (f1 == NULL &&
dynamic_cast<TH1*
> (p) != NULL) { f1 =
getFunction(
dynamic_cast<TH1*
> (p), fcn.c_str()); };
66 if (f1 == NULL &&
dynamic_cast<TGraph*
> (p) != NULL) { f1 =
getFunction(
dynamic_cast<TGraph*
> (p), fcn.c_str()); };
67 if (f1 == NULL &&
dynamic_cast<TGraph2D*
>(p) != NULL) { f1 =
getFunction(
dynamic_cast<TGraph2D*
>(p), fcn.c_str()); };
68
69 if (f1 == NULL) {
70 FATAL(
"No function at " << inputFile <<
" " << fcn << endl);
71 };
72
73
74 for (int i = 0; i != f1->GetNpar(); ++i) {
75
76 DEBUG(left << setw(12) << f1->GetParName(i) <<
' ');
78
79 JTest_t::const_iterator p = test.find(f1->GetParName(i));
80
81 if (p != test.end()) {
82
83 DEBUG(
" [" <<
SCIENTIFIC(12,5) << p->second.getLowerLimit() <<
"," <<
SCIENTIFIC(12,5) << p->second.getLowerLimit() <<
"] ");
84 DEBUG((p->second(f1->GetParameter(i)) ?
"passed" :
"failed"));
85
86 } else {
87
89 }
90
92 }
93
94
95 for (int i = 0; i != f1->GetNpar(); ++i) {
96
97 JTest_t::const_iterator p = test.find(f1->GetParName(i));
98
99 if (p != test.end()) {
100 ASSERT(p->second(f1->GetParameter(i)), p->first <<
' ' << p->second);
101 }
102 }
103
104 return 0;
105}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Interface to read input and write output for TObject tests.
Auxiliary class to handle file name, ROOT directory and object name.
Utility class to parse command line options.
TF1 * getFunction(TH1 *h1, const char *const fcn)
Get function.
TObject * getObject(const JRootObjectID &id)
Get first TObject with given identifier.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.