25 inline bool compare(
const double u,
const double v,
const double precision)
29 return fabs(
u -
v) <= precision * max(1.0, 0.5*(
u+
v));
39 int main(
int argc,
char **argv)
51 JParser<> zap(
"Auxiliary program to compare PDF tables of the arrival time of the Cherenkov light from a muon.");
60 catch(
const exception &error) {
61 FATAL(error.what() << endl);
70 typedef JFunction1D_t::argument_type argument_type;
76 const JFunction1D_t::JSupervisor supervisor(
new JFunction1D_t::JDefaultResult(0.0));
79 const string file_name;
90 NOTICE(
"loading input from file " << i.file_name <<
"... " << flush);
92 i.pdf.load(i.file_name.c_str());
94 i.pdf.setExceptionHandler(supervisor);
105 JPDF_t::super_const_iterator i = pdfA.super_begin();
106 JPDF_t::super_const_iterator
j = pdfB.super_begin();
108 for ( ; i != pdfA.super_end() &&
109 j != pdfB.super_end(); ++i, ++
j) {
111 const double Wa = pdfA.transformer->getWeight(JArray_t((*i).getKey()));
112 const double Wb = pdfB.transformer->getWeight(JArray_t((*j).getKey()));
114 if (fabs(i->first -
j->first) > precision ||
115 fabs(i->second->first -
j->second->first) > precision ||
116 fabs(i->second->second->first -
j->second->second->first) > precision ||
117 fabs(Wa - Wb) > precision) {
121 << i->second->first <<
' '
122 << i->second->second->first <<
' '
127 <<
j->second->first <<
' '
128 <<
j->second->second->first <<
' '
134 const JFunction1D_t& fa = (*i).getValue();
135 const JFunction1D_t& fb = (*j).getValue();
137 JFunction1D_t::const_iterator p = fa.begin();
138 JFunction1D_t::const_iterator q = fb.begin();
140 while (p != fa.end() &&
143 if (fabs(p->getX() - q->getX()) > precision) {
145 DEBUG(
"a.x " << p->getX() << endl);
146 DEBUG(
"b.x " << q->getX() << endl);
151 if (!compare(p->getY(), q->getY(), precision)) {
153 DEBUG(
"a.y " << p->getX() <<
' ' << p->getY() << endl);
154 DEBUG(
"b.y " << q->getX() <<
' ' << q->getY() << endl);
159 if (p->getX() < q->getX())
161 else if (q->getX() < p->getX())
169 for ( ; p != fa.end(); ++p) {
171 DEBUG(
"a.x " << p->getX() << endl);
176 for ( ; q != fb.end(); ++q) {
178 DEBUG(
"b.x " << q->getX() << endl);
184 for ( ; i != pdfA.super_end(); ++i) {
188 << i->second->first <<
' '
189 << i->second->second->first << endl);
194 for ( ;
j != pdfB.super_end(); ++
j) {
198 <<
j->second->first <<
' '
199 <<
j->second->second->first << endl);
205 ERROR(inputFileA <<
" and " << inputFileB <<
" differ." << endl);
int main(int argc, char **argv)
Various implementations of functional maps.
General purpose messaging.
#define DEBUG(A)
Message macros.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
virtual const char * what() const override
Get error message.
Utility class to parse command line options.
Multi-dimensional PDF table for arrival time of Cherenkov light.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).