29 int main(
int argc,
char **argv)
34 typedef JContainer< set<JTransmission_t> > disable_container;
44 JParser<> zap(
"Auxiliary program to set disable status of transmission based on time-of-arrival histograms.");
46 zap[
'f'] =
make_field(inputFile,
"input file (output from JCanberra).");
47 zap[
'N'] =
make_field(Nmin,
"minimum number of entries") = 1;
48 zap[
'T'] =
make_field(Tmax_us,
"maximal time [us]") = 60.0;
49 zap[
'!'] =
make_field(disableFile,
"disable transmission file") =
"";
54 catch(
const exception &error) {
55 FATAL(error.what() << endl);
59 disable_container disable;
61 if (disableFile !=
"") {
63 ifstream
in(disableFile.c_str());
70 disable.comment.add(JMeta(argc, argv));
77 DEBUG(
"Processing " << *i << endl) ;
79 TFile
in(i->c_str(),
"read");
81 TIter iter(
in.GetListOfKeys());
83 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
85 if (TString(key->GetName()).EndsWith(
".toa")) {
87 TH1*
h1 =
dynamic_cast<TH1*
>(key->ReadObj());
91 TString buffer(h1->GetName());
93 const char* regexp =
"[^0-9][0-9]* [0-9]*[^0-9]";
95 buffer = buffer(TRegexp(regexp));
96 buffer = buffer(1, buffer.Length() - 2);
98 if (buffer.Length() > 0 && buffer.IsDigit()) {
102 istringstream(buffer.Data()) >>
id;
104 int N = h1->GetEntries();
105 double T_us = numeric_limits<double>::max();
111 h1->GetQuantiles(
Q.size(),
R.data(),
Q.data());
113 T_us = (*
R.rbegin() - *
R.begin()) * 1.0e6;
116 if (N < Nmin || T_us > Tmax_us) {
118 NOTICE(
"disable: " <<
id <<
' '
119 << setw(6) << N << (N < Nmin ?
"*" :
"") <<
" "
120 <<
FIXED(5,1) << T_us << (T_us > Tmax_us ?
"*" :
"") <<
" [us]" << endl);
127 ERROR(
"Histogram name " << h1->GetName() <<
" not compatible with regular expression " << regexp <<
"." << endl);
136 if (disableFile !=
"") {
138 ofstream out(disableFile.c_str());
Utility class to parse command line options.
Q(UTCMax_s-UTCMin_s)-livetime_s
int main(int argc, char *argv[])
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
then for HISTOGRAM in h0 h1
Auxiliary data structure for floating point format specification.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
then usage $script[distance] fi case set_variable R
General purpose messaging.
Utility class to parse command line options.
Acoustic transmission identifier.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
#define DEBUG(A)
Message macros.