30 int main(
int argc,
char **argv)
39 bool overwriteDetector;
44 JParser<> zap(
"Auxiliary program to disable acoustic sensors based on acoustic events.");
46 zap[
'f'] =
make_field(inputFile,
"output of JAcousticEventBuilder[.sh]");
47 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
49 zap[
'N'] =
make_field(Nmin,
"minimum number of transmissions");
50 zap[
'A'] =
make_field(overwriteDetector,
"overwrite detector file provided through '-a' with status of acoustic sensor.");
55 catch(
const exception &error) {
56 FATAL(error.what() << endl);
70 while (inputFile.hasNext()) {
72 if (inputFile.getCounter()%1000 == 0) {
73 STATUS(
"event " << setw(8) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
76 const JEvent* evt = inputFile.next();
78 for (JEvent::const_iterator
i = evt->begin();
i != evt->end(); ++
i) {
79 buffer[
i->getID()] += 1;
84 if (inputFile.getCounter() == 0) {
85 FATAL(
"No events in input." << endl);
88 for (JDetector::iterator module =
detector.begin(); module !=
detector.end(); ++module) {
90 if (buffer[module->getID()] < Nmin) {
92 if (module->getFloor() == 0) {
96 NOTICE(
"Module " << setw(10) << module->getID() <<
' ' <<
getLabel(module->getLocation()) <<
" disable hydrophone." << endl);
105 NOTICE(
"Module " << setw(10) << module->getID() <<
' ' <<
getLabel(module->getLocation()) <<
" disable piezo." << endl);
113 if (overwriteDetector) {
115 NOTICE(
"Store calibration data on file " << detectorFile << endl);
Utility class to parse command line options.
int main(int argc, char *argv[])
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications.
ROOT TTree parameter settings.
Data structure for detector geometry and calibration.
Auxiliary class for defining the range of iterations of objects.
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
General purpose messaging.
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.
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);.
static const int HYDROPHONE_DISABLE
Enable (disable) use of hydrophone if this status bit is 0 (1);.
const JLimit & getLimit() const
Get limit.
do set_variable DETECTOR_TXT $WORKDIR detector
#define DEBUG(A)
Message macros.