#include #include #include #include "JDetector/JDetector.hh" #include "JDetector/JDetectorToolkit.hh" #include "JDetector/JPMTChannel.hh" #include "JDetector/JPMTIdentifier.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Auxiliary program to print PMT data for a given PMT channel or identifier. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; string detectorFile; JPMTChannel channel; JObjectID id; int debug; try { JParser<> zap("Auxiliary program to print PMT data for a given PMT channel."); zap['a'] = make_field(detectorFile); zap['P'] = make_field(channel, "PMT channel: ") = JPMTChannel(); zap['p'] = make_field(id, "PMT identifier") = JObjectID(); 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); } if (channel != JPMTChannel()) { for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) { if (module->getLocation() == channel.getLocation()) { cout << module->getPMT(channel.getTDC()) << endl; break; } } } else if (id != JObjectID()) { for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) { for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) { if (pmt->getID() == id.getID()) { cout << *pmt << endl; break; } } } } else { while (cin >> channel && channel != JPMTChannel()) { for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) { if (module->getLocation() == channel.getLocation()) { cout << module->getPMT(channel.getTDC()) << endl; break; } } } } }