161 JParser<> zap(
"Auxiliary program to apply test criteria to 2D histograms monitoring acoustic rate per emitter.");
163 zap[
'i'] =
make_field(inputFile,
"output root file from JAcousticsMonitorRateSummary");
165 zap[
'F'] =
make_field(facet,
"Color facet") = get_keys(color_facets);
173 catch(
const exception &error) {
180 out_summary <<
"\n(Note: red highlights are the reason for the warning)" <<
endl;
184 out_status <<
"INFORMATION ABOUT RECEIVER STATUS \nRun: " << run <<
endl;
197 JParameters_t parameters;
199 for (
string buffer; getline(in, buffer); ) {
201 if (!buffer.empty() && buffer[0] != JParameters_t::SKIPLINE) {
205 if (is >> key >> parameters) { zmap[key] = parameters; }
228 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
230 receivers[i->getID()] = i->getLocation();
236 JManager<int, TH2D>
H3(
new TH2D(
"H[%].rate-test",
NULL,
238 floor1.getUpperLimit() + 1, - 0.5,
floor1.getUpperLimit() + 0.5));
250 TFile* f = TFile::Open(inputFile.c_str());
267 for (map_type::const_iterator i = zmap.begin(); i != zmap.end(); ++i) {
269 if (i->first[0] ==
'0') {
continue; }
280 out_status <<
"expected rate: " << i->second.expected_rate <<
endl;
281 out_status <<
"min rate fraction: " << i->second.range.getLowerLimit() <<
endl;
282 out_status <<
"max rate fraction: " << i->second.range.getUpperLimit() <<
endl;
283 out_status <<
"max allowed outliers: " << i->second.number_of_outliers <<
endl;
284 out_status <<
"\nDU\tFloor\tOutOfRange\tSupposedToWork\tRate" <<
endl;
287 string du = to_string(
h3->GetXaxis()->GetBinLabel(
ix));
288 string floor = to_string(
h3->GetYaxis()->GetBinLabel(
iy));
289 h3->Fill(
ix-1,
iy-1, 1.0);
290 out_status <<
du <<
"\t" << floor <<
"\t" << 1 <<
"\t" << i->second.working <<
"\t" << 0 <<
endl;
303 if (!i->second.working) {
304 out_summary << (i->second.working != 0 ? RED : GREEN);
311 if (i->second.working) {
315 int number_of_bins = 0;
316 int number_of_outliers = 0;
318 double min_rate = i->second.expected_rate * i->second.range.getLowerLimit();
319 double max_rate = i->second.expected_rate * i->second.range.getUpperLimit();
320 int outliers = i->second.number_of_outliers;
322 if (h2 ==
NULL &&
dynamic_cast<TH2*
>(p) !=
NULL) { h2 =
dynamic_cast<TH2*
>(p); };
326 out_status <<
"expected rate: " << i->second.expected_rate <<
endl;
327 out_status <<
"min rate fraction: " << i->second.range.getLowerLimit() <<
endl;
328 out_status <<
"max rate fraction: " << i->second.range.getUpperLimit() <<
endl;
329 out_status <<
"max allowed outliers: " << i->second.number_of_outliers <<
endl;
330 out_status <<
"\nDU\tFloor\tOutOfRange\tSupposedToWork\tRate" <<
endl;
332 for (
Int_t ix = 1;
ix <= h2->GetXaxis()->GetNbins(); ++
ix) {
333 for (
Int_t iy = 1;
iy <= h2->GetYaxis()->GetNbins(); ++
iy) {
336 string du = to_string(h2->GetXaxis()->GetBinLabel(
ix));
337 string floor = to_string(h2->GetYaxis()->GetBinLabel(
iy));
340 floor.insert(floor.begin(), 3 - floor.length(),
'0');
341 const string id =
du +
'.' + floor;
345 if (zmap.find(
id)!=zmap.end()) { working = zmap.find(
id)->second.working; }
352 h3->Fill(
ix-1,
iy-1, 1.0);
355 ++number_of_outliers;
359 if (floor ==
"000" && z == 0) {
360 out_summary <<
"DU " <<
du <<
", floor " << floor <<
" : Acoustic rate out of range -> " << z <<
" Hz." << RED <<
" Hydrophone stopped working." <<
endl;
364 out_summary <<
"DU " <<
du <<
", floor " << floor <<
" : Acoustic rate out of range -> " << z <<
" Hz." <<
endl;
367 }
else if (!working) {
368 out_summary <<
"DU " <<
du <<
", floor " << floor <<
" : Working again -> " << z <<
" Hz." <<
endl;
370 out_status <<
du <<
"\t" << floor <<
"\t" << status <<
"\t" << working <<
"\t" << z <<
endl;
375 out_summary << (number_of_outliers >
outliers ? RED : GREEN) <<
"Number of outliers = " << number_of_outliers <<
"/" << number_of_bins <<
endl;
378 if (number_of_outliers >
outliers) {
394 out_status <<
"expected rate: " << i->second.expected_rate <<
endl;
395 out_status <<
"min rate fraction: " << i->second.range.getLowerLimit() <<
endl;
396 out_status <<
"max rate fraction: " << i->second.range.getUpperLimit() <<
endl;
397 out_status <<
"max allowed outliers: " << i->second.number_of_outliers <<
endl;
398 out_status <<
"\nDU\tFloor\tOutOfRange\tSupposedToWork\tRate" <<
endl;
402 string du = to_string(
h3->GetXaxis()->GetBinLabel(
ix));
403 string floor = to_string(
h3->GetYaxis()->GetBinLabel(
iy));
404 h3->Fill(
ix-1,
iy-1, 1.0);
405 out_status <<
du <<
"\t" << floor <<
"\t" << 1 <<
"\t" << i->second.working <<
"\t" << 0 <<
endl;
410 if (i->second.working) {
412 out_summary << (i->second.working != 0 ? RED : GREEN) <<
"Emitter stopped working." <<
endl;