63 int main(
int argc,
char **argv)
81 transmitters_container transmitters;
82 hydrophones_container hydrophones;
88 JParser<> zap(
"Main program to trigger events in acoustic data.");
90 zap[
'f'] =
make_field(inputFile,
"output of JConvertDB -q toashort");
91 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
95 zap[
'a'] =
make_field(detectorFile,
"detector file");
100 zap[
'p'] =
make_field(precision,
"precision time-of-arrival") = 1.0e-6;
105 catch(
const exception &error) {
106 FATAL(error.what() << endl);
124 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
131 if (i->getFloor() == 0) {
138 catch(
const exception&) {
143 receivers[i->getID()] =
JReceiver(i->getID(),
144 i->getPosition() + pos,
145 i->getT0() * 1.0e-9);
149 for (tripods_container::const_iterator i =
tripods.begin(); i !=
tripods.end(); ++i) {
150 emitters[i->getID()] =
JEmitter(i->getID(),
151 i->getUTMPosition() -
detector.getUTMPosition());
154 for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
156 emitters[i->getID()] =
JEmitter(i->getID(),
159 catch(
const exception&) {
177 public map<int, JQuantile>
179 long long int sum()
const
181 long long int count = 0;
183 for (const_iterator i = this->begin(); i != this->end(); ++i) {
184 count += i->second.getCount();
191 map_type number_of_entries;
192 map_type number_of_aliens;
193 map_type number_of_triggers;
194 map_type number_of_events;
204 while (inputFile.hasNext()) {
206 if (inputFile.getCounter()%1000 == 0) {
207 STATUS(
"counter: " << setw(8) << inputFile.getCounter() <<
'\r' << flush);
DEBUG(endl);
213 oid = parameters->
DETID;
216 if (oid != parameters->
DETID) {
217 FATAL(
"Invalid detector identifier " << parameters->
DETID <<
" != " << oid << endl);
224 number_of_entries[parameters->
EMITTERID].put(1);
226 if (emitters.has(
id) && receivers.has(parameters->
DOMID)) {
233 catch(
const exception&) {
234 number_of_aliens[parameters->
EMITTERID].put(1);
239 for (map_type::const_iterator i = number_of_entries.begin(); i != number_of_entries.end(); ++i) {
240 STATUS(
"number of entries: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() << endl);
243 for (map_type::const_iterator i = number_of_aliens.begin(); i != number_of_aliens.end(); ++i) {
244 STATUS(
"number of aliens: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() << endl);
254 buffer_type& buffer = receiver->second;
273 buffer_type& f2 = receiver->second;
286 copy(f2.begin(), __end, back_inserter(buffer));
290 sort(buffer.begin(), buffer.end());
296 for (buffer_type::const_iterator p = buffer.begin(); p != buffer.end(); ++p) {
298 buffer_type::const_iterator q = p;
302 while (++q != buffer.end() && q->getToE() - p->getToE() <=
parameters.TMax_s) {}
308 STATUS(
"trigger: " << setw(8) << number_of_triggers.sum() <<
'\r' << flush);
DEBUG(endl);
310 JEvent event(oid, number_of_triggers.sum(), i->first, p, q);
312 number_of_triggers[i->first].put(event.size());
314 DEBUG(
"trigger: " << endl << event);
316 data.push_back(event);
320 STATUS(
"number of toes: " << setw(3) << i->first <<
' ' << setw(8) << buffer.size());
321 if (Q.getCount() > 0) {
323 ' ' <<
FIXED(6,1) << Q.getXmin() <<
324 ' ' <<
FIXED(6,1) << Q.getXmax());
330 for (JTriggerOutput::const_iterator event = data.begin();
event != data.end(); ++event) {
332 number_of_events[
event->getID()].put(event->size());
339 for (map_type::const_iterator i = number_of_triggers.begin(); i != number_of_triggers.end(); ++i) {
340 STATUS(
"number of triggers: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() << endl);
343 for (map_type::const_iterator i = number_of_events.begin(); i != number_of_events.end(); ++i) {
344 STATUS(
"number of events: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() <<
' ' <<
FIXED(7,3) << i->second.getMean() << endl);
Utility class to parse command line options.
Q(UTCMax_s-UTCMin_s)-livetime_s
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
int main(int argc, char *argv[])
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
General purpose class for hash map of unique elements.
ROOT TTree parameter settings.
Recording of objects on file according a format that follows from the file name extension.
std::string DETID
constraint
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for floating point format specification.
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
Data structure for detector geometry and calibration.
Data structure for hydrophone.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
Auxiliary class for defining the range of iterations of objects.
static const JSoundVelocity getSoundVelocity(1541.0,-17.0e-3,-2000.0)
Function object for velocity of sound.
I/O formatting auxiliaries.
Data structure for transmitter.
void merge(const JMatch_t &match)
Merge events.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
int getID() const
Get identifier.
JPosition3D getPosition(const Vec &pos)
Get position.
JTransmission getTransmission(const JToAshort &data, const JAbstractSoundVelocity &V) const
Get transmission.
ROOT TTree parameter settings.
double getQ(const double D_m, const double f_kHz, const double d_m)
Get relative quality for given frequency at given distance.
General purpose messaging.
Implementation for depth dependend velocity of sound.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Acoustic trigger parameters.
Auxiliary class to define a range between two values.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
static const int PIEZO_DISABLE
Enable (disable) use of piezo if this status bit is 0 (1);.
Auxiliary class to compare transmissions.
void copy(const Head &from, JHead &to)
Copy header from from to to.
static const int HYDROPHONE_DISABLE
Enable (disable) use of hydrophone if this status bit is 0 (1);.
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
bool equals(const JFirst_t &first, const JSecond_t &second, const double precision=std::numeric_limits< double >::min())
Check equality.
static JEmitterID getEmitterID
Function object for emitter identification.
do set_variable DETECTOR_TXT $WORKDIR detector
Data structure for tripod.
Match of two events considering overlap in time.
int EMITTERID
waveform identifier
#define DEBUG(A)
Message macros.