68 inline bool operator()(
const JEvent& first,
const JEvent& second)
const
76 if (first.size() == second.size()) {
78 for (JEvent::const_iterator
80 p1 = second.begin(); p0 != first.end() &&
p1 != second.end(); ++p0, ++
p1) {
82 if ((*
this)(*p0, *
p1)) {
91 return first.size() < second.size();
131 std::ostream& operator()(std::ostream& out,
const std::string& filename,
const int index,
const JEvent& evt,
const std::string& prefix,
const std::string& postfix)
const
137 out << prefix << (prefix ==
"" ?
"" :
" ")
138 << setw(width) << left << filename << right <<
' '
139 <<
"[" <<
FILL(6,
'0') << index <<
"]" <<
FILL() <<
' '
142 << setw(2) << evt.
getID() <<
' '
143 <<
FIXED(12,6) << evt.begin()->getToE()
144 << (postfix ==
"" ?
"" :
" ") << postfix << endl;
160 std::ostream& operator()(std::ostream& out,
const JTransmission&
object,
const std::string& prefix,
const std::string& postfix)
const
166 out << prefix << (prefix ==
"" ?
"" :
" ")
167 << setw(8) <<
object.
getID() <<
' '
168 << setw(8) <<
object.getRunNumber() <<
' '
169 <<
FIXED(13,7) <<
object.getToA() <<
' '
171 <<
FIXED(8,0) <<
object.getQ()
172 << (postfix ==
"" ?
"" :
" ") << postfix << endl;
186 int main(
int argc,
char **argv)
197 JParser<> zap(
"Program to compare acoustics event data.");
199 zap[
'f'] =
make_field(inputFile,
"two outputs of JAcousticsEventBuilder[.sh]");
200 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
205 catch(
const exception &error) {
206 FATAL(error.what() << endl);
209 if (inputFile.size() != 2
u) {
210 FATAL(
"Wrong number of input files " << inputFile.size() << endl);
213 const size_t width = max(inputFile[0].size(), inputFile[1].size());
218 for (
int i = 0; i != 2; ++i) {
221 buffer[i].push_back(*
in.next());
224 sort(buffer[i].begin(), buffer[i].end());
228 for (
int i = 0; i != 2; ++i) {
235 int count[] = { 0, 0 };
238 p0 = buffer[0].begin(),
239 p1 = buffer[1].begin(); p0 != buffer[0].end() &&
p1 != buffer[1].end(); ) {
241 for ( ; p0 != buffer[0].end() &&
p1 != buffer[1].end() && *p0 < *
p1; ++p0, ++
count[1]) {
242 print(cout, inputFile[0],
distance(buffer[0].cbegin(),p0), *p0,
">>",
"");
245 for ( ; p0 != buffer[0].end() && p1 != buffer[1].end() && *p1 < *p0; ++
p1, ++
count[1]) {
246 print(cout, inputFile[1],
distance(buffer[1].cbegin(),p1), *p1,
"<<",
"");
249 if (p0 != buffer[0].end() && p1 != buffer[1].end()) {
251 if (!compare(*p0,*p1) && !compare(*p1,*p0)) {
255 print(cout, inputFile[0],
distance(buffer[0].cbegin(),p0), *p0,
"",
"\\");
256 print(cout, inputFile[1],
distance(buffer[1].cbegin(),p1), *p1,
"",
"/ ");
262 if (p0->getOID() == p1->getOID() &&
263 p0->getCounter() == p1->getCounter() &&
264 p0->getID() == p1->getID()) {
266 print(cout, inputFile[0],
distance(buffer[0].cbegin(),p0), *p0,
"",
"");
267 print(cout, inputFile[1],
distance(buffer[1].cbegin(),p1), *p1,
"",
"");
269 JEvent::const_iterator i0 = p0->begin();
270 JEvent::const_iterator i1 = p1->begin();
272 for ( ; i0 != p0->end() && i1 != p1->end(); ++i0, ++i1) {
273 if (compare(*i0, *i1) || compare(*i1,*i0)) {
274 print(cout, *i0,
">>",
"");
275 print(cout, *i1,
"<<",
"");
279 for ( ; i0 != p0->end(); ++i0) {
280 print(cout, *i0,
">>",
"");
283 for ( ; i1 != p1->end(); ++i1) {
284 print(cout, *i1,
"<<",
"");
289 print(cout, inputFile[0],
distance(buffer[0].cbegin(),p0), *p0,
">>",
"");
290 print(cout, inputFile[1],
distance(buffer[1].cbegin(),p1), *p1,
"<<",
"");
294 if (*p0 < *p1 || *p1 < *p0) {
304 STATUS(
"Number of differences / events: " <<
count[1] <<
" / " <<
count[0] << endl);
307 FATAL(
"Number of differences " <<
count[1] << endl);
Utility class to parse command line options.
int main(int argc, char *argv[])
double getQ() const
Get quality.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
int getRunNumber() const
Get run number.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
ROOT TTree parameter settings.
Auxiliary data structure for floating point format specification.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
Scanning of objects from a single file according a format that follows from the extension of each fil...
Auxiliary class for defining the range of iterations of objects.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
const std::string & getOID() const
Get detector identifier.
General purpose messaging.
Auxiliary data structure for sequence of same character.
Utility class to parse command line options.
int getCounter() const
Get counter.
double getToA() const
Get calibrated time of arrival.
int getID() const
Get identifier.
Object reading from a list of files.
int getID() const
Get identifier.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in