60 int main(
int argc,
char **argv)
76 tripods_container tripods;
77 hydrophones_container hydrophones;
83 JParser<> zap(
"Main program to trigger acoustic data.");
85 zap[
'f'] =
make_field(inputFile,
"output of JConvertDB -q toashort");
86 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
90 zap[
'a'] =
make_field(detectorFile,
"detector file");
94 zap[
'p'] =
make_field(precision,
"precision time-of-arrival") = 1.0e-6;
99 catch(
const exception &error) {
100 FATAL(error.what() << endl);
118 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
122 if (i->getFloor() == 0) {
129 catch(
const exception&) {
134 receivers[i->getID()] =
JReceiver(i->getID(),
135 i->getPosition() + pos,
136 i->getT0() * 1.0e-9);
139 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
140 emitters[i->getID()] =
JEmitter(i->getID(),
141 i->getUTMPosition() -
detector.getUTMPosition());
157 public map<int, JQuantile>
159 long long int sum()
const
161 long long int count = 0;
163 for (const_iterator i = this->begin(); i != this->end(); ++i) {
164 count += i->second.getCount();
171 map_type number_of_entries;
172 map_type number_of_triggers;
173 map_type number_of_events;
183 while (inputFile.hasNext()) {
185 if (inputFile.getCounter()%1000 == 0) {
186 STATUS(
"counter: " << setw(8) << inputFile.getCounter() <<
'\r' << flush);
DEBUG(endl);
192 oid = parameters->
DETID;
195 if (oid != parameters->
DETID) {
196 FATAL(
"Invalid detector identifier " << parameters->
DETID <<
" != " << oid << endl);
201 number_of_entries[parameters->
EMITTERID].put(1);
203 if (emitters.has(
id) && receivers.has(parameters->
DOMID)) {
219 buffer_type& buffer = receiver->second;
238 buffer_type& f2 = receiver->second;
243 const JQuantile Q1(
"quality",
make_array(f2.begin(), f2.end(), &JTransmission::getQ),
true);
250 copy(f2.begin(), __end, back_inserter(buffer));
254 sort(buffer.begin(), buffer.end());
259 for (buffer_type::const_iterator p = buffer.begin(); p != buffer.end(); ++p) {
261 buffer_type::const_iterator q = p;
265 while (++q != buffer.end() && q->getToE() - p->getToE() <=
parameters.TMax_s) {}
269 STATUS(
"trigger: " << setw(8) << number_of_triggers.sum() <<
'\r' << flush);
DEBUG(endl);
271 JEvent event(oid, number_of_triggers.sum(), i->first, p, q);
273 number_of_triggers[i->first].put(event.size());
275 DEBUG(
"trigger: " << endl << event);
277 data.push_back(event);
283 for (JTriggerOutput::const_iterator event = data.begin();
event != data.end(); ++event) {
285 number_of_events[
event->getID()].put(event->size());
292 for (map_type::const_iterator i = number_of_entries.begin(); i != number_of_entries.end(); ++i) {
293 STATUS(
"number of entries: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() << endl);
296 for (map_type::const_iterator i = number_of_triggers.begin(); i != number_of_triggers.end(); ++i) {
297 STATUS(
"number of triggers: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() << endl);
300 for (map_type::const_iterator i = number_of_events.begin(); i != number_of_events.end(); ++i) {
301 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.
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.
Data structure for detector geometry and calibration.
Data structure for hydrophone.
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.
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.
ROOT TTree parameter settings.
General purpose messaging.
Implementation for 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.
JTransmission getTransmission(const JToAshort &data, const JAbstractSoundVelocity &V=getSoundVelocity) const
Get transmission.
Auxiliary class to compare transmissions.
void copy(const Head &from, JHead &to)
Copy header from from to to.
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.