55{
58
60 JLimit_t& numberOfEvents = inputFile.getLimit();
61 double Tmax_s;
63
64 try {
65
66 JParser<> zap(
"Example program to monitor acoustic events.");
67
68 zap[
'f'] =
make_field(inputFile,
"output of JAcousticEventBuilder[.sh]");
70 zap[
'p'] =
make_field(compare.waveform_s,
"wavefrom duration [s]") = 5.0e-3;
71 zap[
'D'] =
make_field(Tmax_s,
"time difference between events [s]") = 20.0e-3;
73
74 zap(argc, argv);
75 }
76 catch(const exception &error) {
77 FATAL(error.what() << endl);
78 }
79
80
82
84
86
88
90
92
93 for (JTreeScanner_t::iterator
p1 = in.begin();
p1 != in.end() && events != inputFile.getLimit(); ++
p1, ++events) {
94
95 STATUS(
"event " << setw(8) << events <<
'\r');
DEBUG(endl);
96
97 if (!
p1->empty() && !p0->empty()) {
98
99 if (
p1->begin()->getToE() < p0->rbegin()->getToE() + Tmax_s) {
100
102
103 cout << endl;
104
106 <<
FIXED(20,6) << p0-> begin()->getToE() <<
' '
107 <<
FIXED(20,6) << p0->rbegin()->getToE() << endl
108 <<
FIXED(20,6) <<
p1-> begin()->getToE() <<
' '
109 <<
FIXED(20,6) <<
p1->rbegin()->getToE() << endl;
110 }
111
113
114 for (int i = 0; i != 2; ++i) {
115 sort(evt[i].begin(), evt[i].end(), compare);
116 }
117
119
120 for (JEvent::const_iterator
121 i0 = evt[0].begin(),
122 i1 = evt[1].begin(); i0 != evt[0].end() && i1 != evt[1].end(); ) {
123
124 if (compare(*i0, *i1))
125 ++i0;
126 else if (compare(*i1, *i0))
127 ++i1;
128
129 else {
130
132
134
135 cout << setw(2) << p0->
getID() <<
' '
136 << setw(10) << i0->getID() << ' '
137 <<
FIXED(20,6) << i0->getToA() <<
' '
138 <<
FIXED( 8,0) << i0->getQ() <<
' ';
139
140 cout << setw(2) <<
p1->getID() <<
' '
141 << setw(10) << i1->getID() << ' '
142 <<
FIXED(20,6) << i1->getToA() <<
' '
143 <<
FIXED( 8,0) << i1->getQ() <<
' ';
144
145 cout <<
FIXED( 9,6) << (i1->getToA() - i0->getToA()) << endl;
146 }
147
148 if (i0->getToA() < i1->getToA())
149 ++i0;
150 else if (i1->getToA() < i0->getToA())
151 ++i1;
152 else {
153 ++i0;
154 ++i1;
155 }
156 }
157 }
158
161 }
162 }
163 }
164
166 }
167 }
169
170 delete p0;
171
172 cout <<
"Number of errors / events: " << Q.
getCount() <<
" / " << events << endl;
173
176 }
177}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
Base class for JTreeScanner.
Template definition for direct access of elements in ROOT TChain.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Long64_t counter_type
Type definition for counter.
Auxiliary data structure for floating point format specification.
int getID() const
Get emitter identifier.
const int getDetectorID() const
Get detector identifier.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.