128 JParser<> zap(
"Program to compare toa data.");
130 zap[
'f'] =
make_field(inputFile,
"two outputs of JToA");
131 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
136 catch(
const exception &error) {
137 FATAL(error.what() << endl);
140 if (inputFile.size() != 2u) {
141 FATAL(
"Wrong number of input files " << inputFile.size() << endl);
144 const size_t width = max(inputFile[0].size(), inputFile[1].size());
148 for (
int i = 0; i != 2; ++i) {
151 buffer[i].push_back(*in.next());
154 sort(buffer[i].begin(), buffer[i].end(), compare);
157 int count[] = { 0, 0 };
160 p0 = buffer[0].begin(),
161 p1 = buffer[1].begin(); p0 != buffer[0].end() &&
p1 != buffer[1].end(); ) {
163 for ( ; p0 != buffer[0].end() &&
p1 != buffer[1].end() && compare(*p0,*
p1); ++p0, ++count[1]) {
164 DEBUG(
">> " << setw(width) << left << inputFile[0] << right <<
' ' << *p0 << endl);
167 for ( ; p0 != buffer[0].end() &&
p1 != buffer[1].end() && compare(*
p1,*p0); ++
p1, ++count[1]) {
168 DEBUG(
"<< " << setw(width) << left << inputFile[1] << right <<
' ' << *
p1 << endl);
171 if (p0 != buffer[0].end() &&
p1 != buffer[1].end() && !compare(*p0,*
p1) && !compare(*
p1,*p0)) {
175 DEBUG(setw(width) << left << inputFile[0] << right <<
' ' << *p0 <<
" \\" << endl);
176 DEBUG(setw(width) << left << inputFile[1] << right <<
' ' << *
p1 <<
" / " << endl);
183 STATUS(
"Number of differences / events: " << count[1] <<
" / " << count[0] << endl);
185 if (buffer[0].size() != buffer[1].size()) {
186 FATAL(
"Different size " << buffer[0].size() <<
' ' << buffer[1].size() << endl);
190 FATAL(
"Number of differences " << count[1] << endl);
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
Object reading from a list of files.
virtual bool hasNext() override
Check availability of next element.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class for defining the range of iterations of objects.