#include #include #include #include #include "JTrigger/JTriggerParameters.hh" #include "JDB/JDB.hh" #include "JDB/JDBToolkit.hh" #include "JDB/JSelector.hh" #include "JDB/JSelectorSupportkit.hh" #include "JDB/JRuns.hh" #include "JDB/JAllParams.hh" #include "JDB/JRunsetupParams.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * Auxiliary program to print trigger parameters. * \author lnauta */ int main(const int argc, const char * const argv[]) { using namespace std; using namespace JPP; using namespace KM3NETDAQ; JServer server; string usr; string pwd; string cookie; string detid; int run; int debug; try { JParser<> zap("Auxiliary program to print trigger parameters."); 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); } const double Dmax_m = 9999.0; JTriggerParameters parameters; try { JDB::reset(usr, pwd, cookie); } catch(const exception& error) { FATAL(error.what() << endl); } const int ID = getDetector (detid); detid = getDetector(detid); string rs_oid; try { JRuns buffer; ResultSet& rs = getResultSet(getTable(), getSelector(ID, run)); if (rs >> buffer) { rs_oid = buffer.RUNSETUPID; } rs.Close(); } catch(const exception& error) { FATAL(error.what() << endl); } map zmap; try { JAllParams buffer; ResultSet& rs = getResultSet(getTable(), getSelector("DATAACQUISITION")); while (rs >> buffer) { string::size_type pos = buffer.NAME.find(PREFIX_DATAFILTER); if (pos != string::npos) { pos = buffer.NAME.find('=', pos + PREFIX_DATAFILTER.length()); zmap[buffer.OID] = buffer.NAME.erase(0, pos + 1); } } rs.Close(); } catch(const exception& error) { FATAL(error.what() << endl); } stringstream data; try { JRunsetupParams buffer; ResultSet& rs = getResultSet(getTable(), getSelector(detid, rs_oid)); while (rs >> buffer) { map::const_iterator i = zmap.find(buffer.PAR_OID); if (i != zmap.end()) { data << i->second << "=" << buffer.VALUE << ";\n"; } } rs.Close(); } catch(const exception& error) { FATAL(error.what() << endl); } data >> parameters; parameters.set(Dmax_m); parameters.actionAtFileRead(); cout << parameters; }