#include #include #include #include #include "JDB/JDB.hh" #include "JDB/JSelector.hh" #include "JDB/JSelectorSupportkit.hh" #include "JDB/JDBToolkit.hh" #include "JDB/JDetectorIntegration.hh" #include "JDB/JDetectorIntegration_t.hh" #include "JDB/JProductRouter.hh" #include "JDB/JLocation_t.hh" #include "Jeep/JPrint.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Auxiliary program to check detector integration. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; JServer server; string usr; string pwd; string cookie; string outputFile; string detid; int debug; try { JParser<> zap("Auxiliary program to check detector integration."); 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"); zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } try { JDB::reset(usr, pwd, cookie); const int ID = getDetector (detid); detid = getDetector(detid); typedef map detector_type; detector_type detectorA; { ResultSet& rs = getResultSet(getTable(), getSelector(ID)); for (JDetectorIntegration parameters; rs >> parameters; ) { if (parameters.PMTUPI.getPBS() == PBS::PMT) { detectorA[parameters.PMTUPI] = JLocation_t(parameters.DUID, parameters.FLOORID, parameters.CABLEPOS); } } rs.Close(); } JDetectorIntegration_t detectorB; { ResultSet& rs = getResultSet(getTable()); if (! (rs >> detectorB)) { THROW(JDatabaseException, "Error reading " << getTable()); } } detectorB.configure(detid); const JProductRouter router(detectorB, PBS::PMT_SEQUENCES); for (detector_type::const_iterator i = detectorA.begin(); i != detectorA.end(); ++i) { const JLocation_t locationA = i->second; const JLocation_t locationB = router.getLocation(i->first); cout << locationA << ' ' << locationB << ' ' << (locationA != locationB ? "*" : "") << endl; } } catch(const exception& error) { FATAL(error.what() << endl); } }