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");
93 zap[
'p'] =
make_field(precision,
"precision time-of-arrival") = 1.0e-6;
98 catch(
const exception &error) {
99 FATAL(error.what() << endl);
119 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
123 if (i->getFloor() == 0) {
130 catch(
const exception&) {
135 receivers[i->getID()] =
JReceiver(i->getID(),
136 i->getPosition() + pos,
137 i->getT0() * 1.0e-9);
140 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
141 emitters[i->getID()] =
JEmitter(i->getID(),
142 i->getUTMPosition() -
detector.getUTMPosition());
158 public map<int, JQuantile>
160 long long int sum()
const
162 long long int count = 0;
164 for (const_iterator i = this->begin(); i != this->end(); ++i) {
165 count += i->second.getCount();
172 map_type number_of_entries;
173 map_type number_of_triggers;
174 map_type number_of_events;
184 while (inputFile.hasNext()) {
186 if (inputFile.getCounter()%1000 == 0) {
187 STATUS(
"counter: " << setw(8) << inputFile.getCounter() <<
'\r' << flush);
DEBUG(endl);
193 oid = parameters->
DETID;
196 if (oid != parameters->
DETID) {
197 FATAL(
"Invalid detector identifier " << parameters->
DETID <<
" != " << oid << endl);
202 number_of_entries[parameters->
EMITTERID].put(1);
204 if (emitters.has(
id) && receivers.has(parameters->
DOMID)) {
220 buffer_type& buffer = receiver->second;
239 buffer_type& f2 = receiver->second;
244 const JQuantile Q1(
"quality",
make_array(f2.begin(), f2.end(), &JTransmission::getQ),
true);
251 copy(f2.begin(), __end, back_inserter(buffer));
255 sort(buffer.begin(), buffer.end());
260 for (buffer_type::const_iterator p = buffer.begin(); p != buffer.end(); ++p) {
262 buffer_type::const_iterator q = p;
266 while (++q != buffer.end() && q->getToE() - p->getToE() <=
parameters.TMax_s) {}
270 STATUS(
"trigger: " << setw(8) << number_of_triggers.sum() <<
'\r' << flush);
DEBUG(endl);
272 JEvent event(oid, number_of_triggers.sum(), i->first, p, q);
274 number_of_triggers[i->first].put(event.size());
276 DEBUG(
"trigger: " << endl << event);
278 data.push_back(event);
284 for (JTriggerOutput::const_iterator event = data.begin();
event != data.end(); ++event) {
286 number_of_events[
event->getID()].put(event->size());
293 for (map_type::const_iterator i = number_of_entries.begin(); i != number_of_entries.end(); ++i) {
294 STATUS(
"number of entries: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() << endl);
297 for (map_type::const_iterator i = number_of_triggers.begin(); i != number_of_triggers.end(); ++i) {
298 STATUS(
"number of triggers: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() << endl);
301 for (map_type::const_iterator i = number_of_events.begin(); i != number_of_events.end(); ++i) {
302 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.
static JEmitterID & getEmitterID
Function object for emitter identification.
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.
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.