#include #include #include #include "Jeep/JPrint.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" #include "JSupport/JMeta.hh" #include "JDetector/JDetector.hh" #include "JDetector/JDetectorToolkit.hh" #include "JDetector/JDetectorAddressMapToolkit.hh" #include "dbclient/KM3NeTDBClient.h" #include "JDB/JDB.hh" #include "JDB/JDBToolkit.hh" #include "JDB/JDBincludes.hh" #include "JDB/JProductRouter.hh" /** * \file * * Auxiliary program to print module identifier for a given module location. * \author bjung, mjg */ int main(int argc, char **argv) { using namespace std; using namespace JPP; JServer server; string usr; string pwd; string cookie; JLocation location; int detid; int debug; try { JParser<> zap("Auxiliary program to print module identifier for a given module location." "\nInteractive mode in absence of option -L ."); zap['s'] = make_field(server) = getServernames(); zap['u'] = make_field(usr) = ""; zap['!'] = make_field(pwd) = ""; zap['C'] = make_field(cookie) = ""; zap['D'] = make_field(detid, "Detector identifier") = -1; zap['L'] = make_field(location, "Module location") = JLocation(); zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } while (location == JLocation()) { cin >> location; } if (hasDetectorAddressMap(detid)) { JDetectorIntegration_t detector; try { JDB::reset(usr, pwd, cookie); ResultSet& rs = getResultSet(getTable()); if (! (rs >> detector)) { THROW(JDatabaseException, "Error reading " << getTable()); } } catch (const exception& error) { FATAL(error.what() << endl); } detector.configure(getDetector(detid)); const JProductRouter router(detector, PBS::CLB_SEQUENCES); for (map::const_iterator CLB = router.cbegin(); CLB != router.cend(); ++CLB) { if (location.getString() == CLB->second.string && location.getFloor() == CLB->second.floor) { cout << getCLBID(CLB->first) << endl; break; } } } else { ERROR("No detector found corresponding to user specifications."); } }