62 int main(
int argc,
char **argv)
78 tripods_container tripods;
79 hydrophones_container hydrophones;
85 JParser<> zap(
"Main program to trigger acoustic data.");
87 zap[
'f'] =
make_field(inputFile,
"output of JConvertDB -q toashort");
88 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
92 zap[
'a'] =
make_field(detectorFile,
"detector file");
96 zap[
'p'] =
make_field(precision,
"precision time-of-arrival") = 1.0e-6;
101 catch(
const exception &error) {
102 FATAL(error.what() << endl);
120 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
127 if (i->getFloor() == 0) {
134 catch(
const exception&) {
139 receivers[i->getID()] =
JReceiver(i->getID(),
140 i->getPosition() + pos,
141 i->getT0() * 1.0e-9);
145 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
146 emitters[i->getID()] =
JEmitter(i->getID(),
147 i->getUTMPosition() -
detector.getUTMPosition());
163 public map<int, JQuantile>
165 long long int sum()
const
167 long long int count = 0;
169 for (const_iterator i = this->begin(); i != this->end(); ++i) {
170 count += i->second.getCount();
177 map_type number_of_entries;
178 map_type number_of_triggers;
179 map_type number_of_events;
189 while (inputFile.hasNext()) {
191 if (inputFile.getCounter()%1000 == 0) {
192 STATUS(
"counter: " << setw(8) << inputFile.getCounter() <<
'\r' << flush);
DEBUG(endl);
198 oid = parameters->
DETID;
201 if (oid != parameters->
DETID) {
202 FATAL(
"Invalid detector identifier " << parameters->
DETID <<
" != " << oid << endl);
207 number_of_entries[parameters->
EMITTERID].put(1);
209 if (emitters.has(
id) && receivers.has(parameters->
DOMID)) {
218 for (map_type::const_iterator i = number_of_entries.begin(); i != number_of_entries.end(); ++i) {
219 STATUS(
"number of entries: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() << endl);
229 buffer_type& buffer = receiver->second;
248 buffer_type& f2 = receiver->second;
261 copy(f2.begin(), __end, back_inserter(buffer));
265 sort(buffer.begin(), buffer.end());
267 STATUS(
"number of toes: " << setw(3) << i->first <<
' ' << setw(8) << buffer.size() << endl);
271 for (buffer_type::const_iterator p = buffer.begin(); p != buffer.end(); ++p) {
273 buffer_type::const_iterator q = p;
277 while (++q != buffer.end() && q->getToE() - p->getToE() <=
parameters.TMax_s) {}
281 STATUS(
"trigger: " << setw(8) << number_of_triggers.sum() <<
'\r' << flush);
DEBUG(endl);
283 JEvent event(oid, number_of_triggers.sum(), i->first, p, q);
285 number_of_triggers[i->first].put(event.size());
287 DEBUG(
"trigger: " << endl << event);
289 data.push_back(event);
295 for (JTriggerOutput::const_iterator event = data.begin();
event != data.end(); ++event) {
297 number_of_events[
event->getID()].put(event->size());
304 for (map_type::const_iterator i = number_of_triggers.begin(); i != number_of_triggers.end(); ++i) {
305 STATUS(
"number of triggers: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() << endl);
308 for (map_type::const_iterator i = number_of_events.begin(); i != number_of_events.end(); ++i) {
309 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.
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 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);.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
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