#include #include #include #include #include #include "JLang/JComparator.hh" #include "JDetector/JDetectorCalibration.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Auxiliary program to print PMT thresholds. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; string inputFile; int threshold; int debug; try { JParser<> zap("Auxiliary program to print PMT thresholds."); zap['f'] = make_field(inputFile, "PMT threshold file (json format)"); zap['T'] = make_field(threshold) = 0; zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } json js; istream* in = open(inputFile.c_str()); *in >> js; close(in); try { JPMTThresholdCalibration calibration = js.at(Tests_t).get(); sort(calibration.begin(), calibration.end(), make_comparator(&JPMTThresholdCalibration_t::getUPI)); for (JPMTThresholdCalibration::const_iterator i = calibration.begin(); i != calibration.end(); ++i) { if (i->threshold >= threshold) { cout << "PMT " << left << setw(32) << static_cast(*i) << " -> " << right << setw(3) << i->threshold << endl; } } } catch(const exception& error) { FATAL(error.what() << endl); } }