#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/JPMTHVRunSettings.hh" #include "JDB/JPMTHV.hh" #include "JDetector/JPMTIdentifier.hh" #include "Jeep/JPrint.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * Utility program to print PMT HV settings. * \author mdejong */ int main(const int argc, const char * const argv[]) { using namespace std; using namespace JPP; JServer server; string usr; string pwd; string cookie; string detid; int run; int debug; try { JParser<> zap("Utility program to print PMT HV settings."); 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); zap['r'] = make_field(run); 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 vector detector_type; detector_type detector; { DEBUG("Downloading detector integration data... " << flush); ResultSet& rs = getResultSet(getTable(), getSelector(ID)); for (JDetectorIntegration parameters; rs >> parameters; ) { detector.push_back(parameters); } rs.Close(); DEBUG("OK" << endl); } map > > HV; { DEBUG("Downloading HV data... " << flush); ResultSet& rs = getResultSet(getTable(), getSelector(ID, run)); for (JPMTHVRunSettings parameters; rs >> parameters; ) { HV[parameters.DUID][parameters.FLOORID][parameters.CABLEPOS] = parameters; } rs.Close(); DEBUG("OK" << endl); } const JPMTHV pmt_hv(ID, run); for (detector_type::const_iterator i = detector.begin(); i != detector.end(); ++i) { if (i->PMTUPI.getPBS() == PBS::PMT) { { cout << FILL(4,'0') << i->DUID << '.' << FILL(2,'0') << i->FLOORID << "[" << FILL(2,'0') << i->CABLEPOS << "] " << FILL() << setw(4) << HV[i->DUID][i->FLOORID][i->CABLEPOS].HV_INDEX << ' ' << FIXED(7,1) << HV[i->DUID][i->FLOORID][i->CABLEPOS].HV_VALUE << ' '; } try { cout << setw(4) << pmt_hv(i->PMTUPI).value << ' ' << pmt_hv(i->PMTUPI).is_default << (pmt_hv(i->PMTUPI).value != HV[i->DUID][i->FLOORID][i->CABLEPOS].HV_INDEX ? "*" : ""); } catch(const exception& error) { cout << "****"; } cout << endl; } } } catch(const exception& error) { FATAL(error.what() << endl); } }