22 int main(
int argc,
char **argv)
33 JParser<> zap(
"Auxiliary program to compare PDF tables of the arrival time of the Cherenkov light from a muon.");
42 catch(
const exception &error) {
43 FATAL(error.what() << endl);
49 typedef JSplineFunction1D_t JFunction1D_t;
50 typedef JMAPLIST<JPolint1FunctionalMap,
51 JPolint1FunctionalGridMap,
52 JPolint1FunctionalGridMap>::maplist JMapList_t;
53 typedef JPDFTable<JFunction1D_t, JMapList_t> JPDF_t;
56 typedef JArray<3, argument_type> JArray_t;
63 const JFunction1D_t::JSupervisor supervisor(
new JFunction1D_t::JDefaultResult(0.0));
68 const char* file_name;
72 { inputFileA.c_str(), pdfA },
73 { inputFileB.c_str(), pdfB }
77 for (JEntry_t* p = buffer; p != buffer +
sizeof(buffer)/
sizeof(buffer[0]); ++p) {
81 NOTICE(
"loading input from file " << p->file_name <<
"... " << flush);
83 p->pdf.load(p->file_name);
85 p->pdf.setExceptionHandler(supervisor);
89 catch(
const JException& error) {
90 FATAL(error.what() << endl);
96 JPDF_t::super_const_iterator i = pdfA.super_begin();
97 JPDF_t::super_const_iterator
j = pdfB.super_begin();
99 for ( ; i != pdfA.super_end() &&
100 j != pdfB.super_end(); ++i, ++
j) {
102 const double Wa = pdfA.transformer->getWeight(JArray_t((*i).getKey()));
103 const double Wb = pdfB.transformer->getWeight(JArray_t((*j).getKey()));
105 if (fabs(i->first -
j->first) > precision ||
106 fabs(i->second->first -
j->second->first) > precision ||
107 fabs(i->second->second->first -
j->second->second->first) > precision ||
108 fabs(Wa - Wb) > precision) {
112 << i->second->first <<
' '
113 << i->second->second->first <<
' '
118 <<
j->second->first <<
' '
119 <<
j->second->second->first <<
' '
126 const JFunction1D_t& fa = (*i).getValue();
127 const JFunction1D_t& fb = (*j).getValue();
129 JFunction1D_t::const_iterator p = fa.begin();
130 JFunction1D_t::const_iterator q = fb.begin();
132 while (p != fa.end() &&
135 if (fabs(p->getX() - q->getX()) > precision) {
137 DEBUG(
"a.f[] " << p->getX() << endl);
138 DEBUG(
"b.f[] " << q->getX() << endl);
143 if (fabs(p->getY() - q->getY()) > precision) {
145 DEBUG(
"a.f() " << p->getX() <<
' ' << p->getY() << endl);
146 DEBUG(
"b.f() " << q->getX() <<
' ' << q->getY() << endl);
151 if (p->getX() < q->getX())
153 else if (q->getX() < p->getX())
161 for ( ; p != fa.end(); ++p) {
163 DEBUG(
"a.f() " << p->getX() << endl);
168 for ( ; q != fb.end(); ++q) {
170 DEBUG(
"b.f() " << q->getX() << endl);
176 for ( ; i != pdfA.super_end(); ++i) {
180 << i->second->first <<
' '
181 << i->second->second->first << endl);
186 for ( ;
j != pdfB.super_end(); ++
j) {
190 <<
j->second->first <<
' '
191 <<
j->second->second->first << endl);
197 ERROR(inputFileA <<
" and " << inputFileB <<
" differ." << endl);