#include <ODFEDAQConfig.h>
Public Member Functions | |
int | fetchNextId () throw (std::runtime_error) |
int | getBadTTId () const |
int | getBadXtId () const |
std::string | getComment () const |
int | getDelayId () const |
int | getId () const |
int | getPedestalId () const |
std::string | getTable () |
int | getTriggerBadTTId () const |
int | getTriggerBadXtId () const |
int | getVersion () const |
int | getWeightId () const |
ODFEDAQConfig () | |
void | setBadTTId (int x) |
void | setBadXtId (int x) |
void | setComment (std::string x) |
void | setDelayId (int x) |
void | setId (int id) |
void | setParameters (std::map< std::string, std::string > my_keys_map) |
void | setPedestalId (int x) |
void | setTriggerBadTTId (int x) |
void | setTriggerBadXtId (int x) |
void | setVersion (int id) |
void | setWeightId (int x) |
~ODFEDAQConfig () | |
Private Member Functions | |
void | clear () |
void | fetchData (ODFEDAQConfig *result) throw (std::runtime_error) |
int | fetchID () throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeDB () throw (std::runtime_error) |
Private Attributes | |
int | m_btt |
int | m_bxt |
std::string | m_com |
int | m_del |
int | m_ID |
int | m_ped |
int | m_tbtt |
int | m_tbxt |
int | m_version |
int | m_wei |
Friends | |
class | EcalCondDBInterface |
Definition at line 9 of file ODFEDAQConfig.h.
ODFEDAQConfig::ODFEDAQConfig | ( | ) |
Definition at line 21 of file ODFEDAQConfig.cc.
References NULL.
{ m_env = NULL; m_conn = NULL; m_writeStmt = NULL; m_readStmt = NULL; m_config_tag=""; m_ID=0; clear(); }
ODFEDAQConfig::~ODFEDAQConfig | ( | ) |
Definition at line 49 of file ODFEDAQConfig.cc.
{ }
void ODFEDAQConfig::clear | ( | void | ) | [private] |
void ODFEDAQConfig::fetchData | ( | ODFEDAQConfig * | result | ) | throw (std::runtime_error) [private] |
Definition at line 157 of file ODFEDAQConfig.cc.
References gather_cfg::cout, ExpressReco_HICollisions_FallBack::e, getInt(), and query::result.
{ this->checkConnection(); result->clear(); if(result->getId()==0 && (result->getConfigTag()=="") ){ throw(std::runtime_error("ODFEDAQConfig::fetchData(): no Id defined for this ODFEDAQConfig ")); } if(result->getConfigTag()!="" && result->getVersion() ==0 ){ int new_version=0; std::cout<< "using new method : retrieving last version for this tag "<<endl; try { this->checkConnection(); m_readStmt->setSQL("select max(version) from "+getTable()+" where tag=:tag " ); m_readStmt->setString(1, result->getConfigTag()); ResultSet* rset = m_readStmt->executeQuery(); while (rset->next ()){ new_version= rset->getInt(1); } m_conn->terminateStatement(m_readStmt); m_readStmt = m_conn->createStatement(); result->setVersion(new_version); } catch (SQLException &e) { throw(std::runtime_error("ODFEDAQConfig::fetchData(): "+e.getMessage())); } } try { m_readStmt->setSQL("SELECT * FROM " + getTable() + " where ( config_id = :1 or (tag=:2 AND version=:3 ) )" ); m_readStmt->setInt(1, result->getId()); m_readStmt->setString(2, result->getConfigTag()); m_readStmt->setInt(3, result->getVersion()); ResultSet* rset = m_readStmt->executeQuery(); rset->next(); // 1 is the id and 2 is the config tag and 3 is the version result->setId(rset->getInt(1)); result->setConfigTag(rset->getString(2)); result->setVersion(rset->getInt(3)); result->setPedestalId( getInt(rset,4) ); result->setDelayId( getInt(rset,5) ); result->setWeightId( getInt(rset,6) ); result->setBadXtId( getInt(rset,7) ); result->setBadTTId( getInt(rset,8) ); result->setTriggerBadXtId( getInt(rset,9) ); result->setTriggerBadTTId( getInt(rset,10) ); result->setComment( rset->getString(11) ); } catch (SQLException &e) { throw(std::runtime_error("ODFEDAQConfig::fetchData(): "+e.getMessage())); } }
int ODFEDAQConfig::fetchID | ( | ) | throw (std::runtime_error) [private] |
Definition at line 223 of file ODFEDAQConfig.cc.
References ExpressReco_HICollisions_FallBack::e.
{ // Return from memory if available if (m_ID!=0) { return m_ID; } this->checkConnection(); try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT config_id FROM "+ getTable()+ "WHERE tag=:1 and version=:2 " ); stmt->setString(1, getConfigTag() ); stmt->setInt(2, getVersion() ); ResultSet* rset = stmt->executeQuery(); if (rset->next()) { m_ID = rset->getInt(1); } else { m_ID = 0; } m_conn->terminateStatement(stmt); } catch (SQLException &e) { throw(std::runtime_error("ODFEDAQConfig::fetchID: "+e.getMessage())); } return m_ID; }
int ODFEDAQConfig::fetchNextId | ( | ) | throw (std::runtime_error) |
Definition at line 55 of file ODFEDAQConfig.cc.
References ExpressReco_HICollisions_FallBack::e, and query::result.
{ int result=0; try { this->checkConnection(); m_readStmt = m_conn->createStatement(); m_readStmt->setSQL("select fe_daq_conDfig_sq.nextVal from dual"); ResultSet* rset = m_readStmt->executeQuery(); while (rset->next ()){ result= rset->getInt(1); } m_conn->terminateStatement(m_readStmt); return result; } catch (SQLException &e) { throw(std::runtime_error("ODFEDAQConfig::fetchNextId(): "+e.getMessage())); } }
int ODFEDAQConfig::getBadTTId | ( | ) | const [inline] |
Definition at line 36 of file ODFEDAQConfig.h.
References m_btt.
Referenced by popcon::EcalChannelStatusHandler::daqOut(), and popcon::EcalDAQHandler::getNewObjects().
{ return m_btt; }
int ODFEDAQConfig::getBadXtId | ( | ) | const [inline] |
std::string ODFEDAQConfig::getComment | ( | ) | const [inline] |
int ODFEDAQConfig::getDelayId | ( | ) | const [inline] |
int ODFEDAQConfig::getId | ( | ) | const [inline] |
int ODFEDAQConfig::getPedestalId | ( | ) | const [inline] |
std::string ODFEDAQConfig::getTable | ( | ) | [inline, virtual] |
int ODFEDAQConfig::getTriggerBadTTId | ( | ) | const [inline] |
int ODFEDAQConfig::getTriggerBadXtId | ( | ) | const [inline] |
int ODFEDAQConfig::getVersion | ( | ) | const [inline] |
int ODFEDAQConfig::getWeightId | ( | ) | const [inline] |
void ODFEDAQConfig::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IODConfig.
Definition at line 76 of file ODFEDAQConfig.cc.
References ExpressReco_HICollisions_FallBack::e.
{ this->checkConnection(); int next_id=fetchNextId(); try { m_writeStmt = m_conn->createStatement(); m_writeStmt->setSQL("INSERT INTO FE_DAQ_CONFIG ( config_id, tag, version, ped_id, " " del_id, wei_id,bxt_id, btt_id, tr_bxt_id, tr_btt_id, user_comment ) " "VALUES ( :1, :2, :3, :4, :5, :6, :7 ,:8, :9, :10, :11 )" ); m_writeStmt->setInt(1, next_id); m_ID=next_id; } catch (SQLException &e) { throw(std::runtime_error("ODFEDAQConfig::prepareWrite(): "+e.getMessage())); } }
void ODFEDAQConfig::setBadTTId | ( | int | x | ) | [inline] |
Definition at line 35 of file ODFEDAQConfig.h.
References m_btt, and ExpressReco_HICollisions_FallBack::x.
void ODFEDAQConfig::setBadXtId | ( | int | x | ) | [inline] |
Definition at line 33 of file ODFEDAQConfig.h.
References m_bxt, and ExpressReco_HICollisions_FallBack::x.
void ODFEDAQConfig::setComment | ( | std::string | x | ) | [inline] |
Definition at line 42 of file ODFEDAQConfig.h.
References m_com, and ExpressReco_HICollisions_FallBack::x.
void ODFEDAQConfig::setDelayId | ( | int | x | ) | [inline] |
Definition at line 28 of file ODFEDAQConfig.h.
References m_del, and ExpressReco_HICollisions_FallBack::x.
void ODFEDAQConfig::setId | ( | int | id | ) | [inline] |
Definition at line 18 of file ODFEDAQConfig.h.
References ExpressReco_HICollisions_FallBack::id, and m_ID.
Referenced by popcon::EcalChannelStatusHandler::daqOut(), and popcon::EcalDAQHandler::getNewObjects().
void ODFEDAQConfig::setParameters | ( | std::map< std::string, std::string > | my_keys_map | ) |
void ODFEDAQConfig::setPedestalId | ( | int | x | ) | [inline] |
Definition at line 26 of file ODFEDAQConfig.h.
References m_ped, and ExpressReco_HICollisions_FallBack::x.
void ODFEDAQConfig::setTriggerBadTTId | ( | int | x | ) | [inline] |
Definition at line 39 of file ODFEDAQConfig.h.
References m_tbtt, and ExpressReco_HICollisions_FallBack::x.
void ODFEDAQConfig::setTriggerBadXtId | ( | int | x | ) | [inline] |
Definition at line 37 of file ODFEDAQConfig.h.
References m_tbxt, and ExpressReco_HICollisions_FallBack::x.
void ODFEDAQConfig::setVersion | ( | int | id | ) | [inline] |
Definition at line 23 of file ODFEDAQConfig.h.
References ExpressReco_HICollisions_FallBack::id, and m_version.
void ODFEDAQConfig::setWeightId | ( | int | x | ) | [inline] |
Definition at line 30 of file ODFEDAQConfig.h.
References m_wei, and ExpressReco_HICollisions_FallBack::x.
void ODFEDAQConfig::writeDB | ( | ) | throw (std::runtime_error) [private] |
Definition at line 121 of file ODFEDAQConfig.cc.
References ExpressReco_HICollisions_FallBack::e, and SET_INT.
{ this->checkConnection(); this->checkPrepare(); try { // number 1 is the id m_writeStmt->setString(2, this->getConfigTag()); m_writeStmt->setInt(3, this->getVersion()); SET_INT(m_writeStmt,4, this->getPedestalId()); SET_INT(m_writeStmt,5, this->getDelayId()); SET_INT(m_writeStmt,6, this->getWeightId()); SET_INT(m_writeStmt,7, this->getBadXtId()); SET_INT(m_writeStmt,8, this->getBadTTId()); SET_INT(m_writeStmt,9, this->getTriggerBadXtId()); SET_INT(m_writeStmt,10,this->getTriggerBadTTId()); m_writeStmt->setString(11, this->getComment()); m_writeStmt->executeUpdate(); } catch (SQLException &e) { throw(std::runtime_error("ODFEDAQConfig::writeDB(): "+e.getMessage())); } // Now get the ID if (!this->fetchID()) { throw(std::runtime_error("ODFEDAQConfig::writeDB: Failed to write")); } }
friend class EcalCondDBInterface [friend] |
Reimplemented from IDBObject.
Definition at line 11 of file ODFEDAQConfig.h.
int ODFEDAQConfig::m_btt [private] |
Definition at line 67 of file ODFEDAQConfig.h.
Referenced by getBadTTId(), and setBadTTId().
int ODFEDAQConfig::m_bxt [private] |
Definition at line 66 of file ODFEDAQConfig.h.
Referenced by getBadXtId(), and setBadXtId().
std::string ODFEDAQConfig::m_com [private] |
Definition at line 71 of file ODFEDAQConfig.h.
Referenced by getComment(), and setComment().
int ODFEDAQConfig::m_del [private] |
Definition at line 63 of file ODFEDAQConfig.h.
Referenced by getDelayId(), and setDelayId().
int ODFEDAQConfig::m_ID [private] |
Definition at line 61 of file ODFEDAQConfig.h.
int ODFEDAQConfig::m_ped [private] |
Definition at line 62 of file ODFEDAQConfig.h.
Referenced by getPedestalId(), and setPedestalId().
int ODFEDAQConfig::m_tbtt [private] |
Definition at line 69 of file ODFEDAQConfig.h.
Referenced by getTriggerBadTTId(), and setTriggerBadTTId().
int ODFEDAQConfig::m_tbxt [private] |
Definition at line 68 of file ODFEDAQConfig.h.
Referenced by getTriggerBadXtId(), and setTriggerBadXtId().
int ODFEDAQConfig::m_version [private] |
Definition at line 70 of file ODFEDAQConfig.h.
Referenced by getVersion(), and setVersion().
int ODFEDAQConfig::m_wei [private] |
Definition at line 64 of file ODFEDAQConfig.h.
Referenced by getWeightId(), and setWeightId().