#include #include #include #include "JDetector/JDetector.hh" #include "JDetector/JDetectorToolkit.hh" #include "JDetector/JModuleRouter.hh" #include "JDetector/JPMTStatus.hh" #include "JLang/JVectorize.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Auxiliary program to print PMT status for a given PMT identifier. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; string detectorFile; JPMTIdentifier id; string key; int debug; try { JParser<> zap("Auxiliary program to print PMT status for a given PMT identifier." "\nInteractive mode in absence of option -P ."); zap['a'] = make_field(detectorFile, "Detector file"); zap['P'] = make_field(id, "PMT identifier") = JPMTIdentifier(); zap['k'] = make_field(key, "key") = "", get_keys(getPMTStatusBit); zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } JDetector detector; try { load(detectorFile, detector); } catch(const JException& error) { FATAL(error); } const JModuleRouter router(detector); if (id != JPMTIdentifier()) { if (router.hasModule(id.getModuleID())) { if (key == "") print(cout, router.getModule(id.getModuleID()).getPMT(id.getPMTAddress()).getStatus(), putPMTStatusBit); else cout << router.getModule(id.getModuleID()).getPMT(id.getPMTAddress()).has(getPMTStatusBit(key)); } } else { while (cin >> id && id != JPMTIdentifier()) { if (router.hasModule(id.getModuleID())) { if (key == "") print(cout, router.getModule(id.getModuleID()).getPMT(id.getPMTAddress()).getStatus(), putPMTStatusBit); else cout << router.getModule(id.getModuleID()).getPMT(id.getPMTAddress()).has(getPMTStatusBit(key)); } } } }