92 inline bool operator()(
const JEvent& first,
const JEvent& second)
const
98 if (first.size() == second.size()) {
100 for (JEvent::const_iterator
102 p1 = second.begin(); p0 != first.end() &&
p1 != second.end(); ++p0, ++
p1) {
104 if ((*
this)(*p0, *
p1)) {
113 return first.size() < second.size();
148 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
154 out << prefix << (prefix ==
"" ?
"" :
" ")
155 <<
setw(width) << left << filename << right <<
' '
156 <<
"[" <<
FILL(6,
'0') << index <<
"]" <<
FILL() <<
' '
160 <<
FIXED(12,6) << evt. begin()->getToA() <<
' '
161 <<
FIXED(12,6) << evt.rbegin()->getToA()
178 std::ostream& operator()(std::ostream& out,
const JTransmission&
object,
const std::string& prefix,
const std::string&
postfix)
const
184 out << prefix << (prefix ==
"" ?
"" :
" ")
185 <<
setw(8) <<
object.getID() <<
' '
186 <<
setw(8) <<
object.getRunNumber() <<
' '
187 <<
FIXED(13,7) <<
object.getToA() <<
' '
188 <<
FIXED(13,7) <<
object.getToE() <<
' '
189 <<
FIXED(8,0) <<
object.getQ()
205 static inline bool toa(
const JEvent& first,
const JEvent& second)
207 return first.begin()->getToA() < second.begin()->getToA();
218 static inline bool toe(
const JEvent& first,
const JEvent& second)
220 return first.begin()->getToE() < second.begin()->getToE();
251 JParser<> zap(
"Program to compare acoustics event data.");
253 zap[
'f'] =
make_field(inputFile,
"two outputs of JAcousticsEventBuilder[.sh]");
261 catch(
const exception &error) {
265 if (inputFile.size() != 2u) {
266 FATAL(
"Wrong number of input files " << inputFile.size() <<
endl);
269 const size_t width = max(inputFile[0].size(), inputFile[1].size());
274 for (
int i = 0; i != 2; ++i) {
277 buffer[i].push_back(*in.next());
283 for (
int i = 0; i != 2; ++i) {
285 for (
JEvent& evt : buffer[i]) {
286 sort(evt.begin(), evt.end(), compare);
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); }
293 sort(p->begin(), p->end(), compare);
298 int count[] = { 0, 0 };
301 p0 = buffer[0].begin(),
302 p1 = buffer[1].begin(); p0 != buffer[0].end() &&
p1 != buffer[1].end(); ) {
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]) {
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]) {
312 if (p0 != buffer[0].end() &&
p1 != buffer[1].end()) {
314 if (!compare(*p0,*
p1) && !compare(*
p1,*p0)) {
328 if (p0->getDetectorID() ==
p1->getDetectorID() &&
329 p0->getCounter() ==
p1->getCounter() &&
330 p0->getID() ==
p1->getID()) {
332 JEvent::const_iterator
i0 = p0->begin();
333 JEvent::const_iterator
i1 =
p1->begin();
335 while (
i0 != p0->end() &&
i1 !=
p1->end()) {
337 for ( ;
i0 != p0->end() &&
i1 !=
p1->end() && compare(*
i0,*
i1); ++
i0) {
341 for ( ;
i0 != p0->end() &&
i1 !=
p1->end() && compare(*
i1,*
i0); ++
i1) {
345 if (
i0 != p0->end() &&
i1 !=
p1->end()) {
346 if (!compare(*
i0, *
i1) && !compare(*
i1,*
i0)) {
353 for ( ;
i0 != p0->end(); ++
i0) {
357 for ( ;
i1 !=
p1->end(); ++
i1) {
368 if (toa(*p0,*
p1) || toa(*
p1,*p0)) {
378 STATUS(
"Number of differences / events: " << count[1] <<
" / " << count[0] <<
endl);
380 if (buffer[0].size() != buffer[1].size()) {
381 FATAL(
"Different size " << buffer[0].size() <<
' ' << buffer[1].size() <<
endl);
385 FATAL(
"Number of differences " << count[1] <<
endl);
ROOT TTree parameter settings.
int main(int argc, char **argv)
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
General purpose messaging.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Scanning of objects from a single file according a format that follows from the extension of each fil...
Exception for accessing a value in a collection that is outside of its range.
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 data structure for sequence of same character.
Auxiliary data structure for floating point format specification.
int getCounter() const
Get counter.
int getID() const
Get emitter identifier.
const int getDetectorID() const
Get detector identifier.
double getToA() const
Get calibrated time of arrival.
double getToE() const
Get estimated time of emission.
double getW() const
Get normalisation.
double getQ() const
Get quality.
int getRunNumber() const
Get run number.
int getID() const
Get identifier.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.