240{
243
246 int option;
248
249 try {
250
251 JParser<> zap(
"Program to compare acoustics event data.");
252
253 zap[
'f'] =
make_field(inputFile,
"two outputs of JAcousticsEventBuilder[.sh]");
258
260 }
261 catch(const exception &error) {
263 }
264
265 if (inputFile.size() != 2u) {
266 FATAL(
"Wrong number of input files " << inputFile.size() <<
endl);
267 }
268
269 const size_t width = max(inputFile[0].size(), inputFile[1].size());
271
273
274 for (int i = 0; i != 2; ++i) {
275
277 buffer[i].push_back(*in.next());
278 }
279 }
280
282
283 for (int i = 0; i != 2; ++i) {
284
285 for (
JEvent& evt : buffer[i]) {
286 sort(evt.begin(), evt.end(), compare);
287 }
288
289 if (
cta ==
ToA_t) { sort(buffer[i].begin(), buffer[i].end(), toa); }
290 if (
cta ==
ToE_t) { sort(buffer[i].begin(), buffer[i].end(), toe); }
291
293 sort(p->begin(), p->end(), compare);
294 }
295 }
296 }
297
298 int count[] = { 0, 0 };
299
301 p0 = buffer[0].begin(),
302 p1 = buffer[1].begin(); p0 != buffer[0].end() &&
p1 != buffer[1].end(); ) {
303
304 for ( ; p0 != buffer[0].end() &&
p1 != buffer[1].end() && ((
cta ==
ToA_t && toa(*p0,*
p1)) || (
cta ==
ToE_t && toe(*p0,*
p1))); ++p0, ++count[1]) {
306 }
307
308 for ( ; p0 != buffer[0].end() &&
p1 != buffer[1].end() && ((
cta ==
ToA_t && toa(*
p1,*p0)) || (
cta ==
ToE_t && toe(*
p1,*p0))); ++
p1, ++count[1]) {
310 }
311
312 if (p0 != buffer[0].end() &&
p1 != buffer[1].end()) {
313
314 if (!compare(*p0,*
p1) && !compare(*
p1,*p0)) {
315
316 ++count[0];
317
320
321 } else {
322
323 ++count[1];
324
327
328 if (p0->getDetectorID() ==
p1->getDetectorID() &&
329 p0->getCounter() ==
p1->getCounter() &&
330 p0->getID() ==
p1->getID()) {
331
332 JEvent::const_iterator
i0 = p0->begin();
333 JEvent::const_iterator
i1 =
p1->begin();
334
335 while (
i0 != p0->end() &&
i1 !=
p1->end()) {
336
337 for ( ;
i0 != p0->end() &&
i1 !=
p1->end() && compare(*
i0,*
i1); ++
i0) {
339 }
340
341 for ( ;
i0 != p0->end() &&
i1 !=
p1->end() && compare(*
i1,*
i0); ++
i1) {
343 }
344
345 if (
i0 != p0->end() &&
i1 !=
p1->end()) {
346 if (!compare(*
i0, *
i1) && !compare(*
i1,*
i0)) {
349 }
350 }
351 }
352
353 for ( ;
i0 != p0->end(); ++
i0) {
355 }
356
357 for ( ;
i1 !=
p1->end(); ++
i1) {
359 }
360
361 } else {
362
365 }
366 }
367
368 if (toa(*p0,*
p1) || toa(*
p1,*p0)) {
369
370 } else {
371
372 ++p0;
374 }
375 }
376 }
377
378 STATUS(
"Number of differences / events: " << count[1] <<
" / " << count[0] <<
endl);
379
380 if (buffer[0].size() != buffer[1].size()) {
381 FATAL(
"Different size " << buffer[0].size() <<
' ' << buffer[1].size() <<
endl);
382 }
383
384 if (count[1] != 0) {
385 FATAL(
"Number of differences " << count[1] <<
endl);
386 }
387}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Template definition of a multi-dimensional oscillation probability interpolation table.
std::ostream & print(std::ostream &out, const JTestSummary &summary, T __begin, T __end, const bool useColors=true, const JFormat_t &formatting=JFormat_t(18, 3, std::ios::fixed))
Print test summary.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.