#include <FEConfigMainInfo.h>
Public Member Functions | |
FEConfigMainInfo () | |
int | getBstId () const |
int | getBttId () const |
int | getBxtId () const |
Tm | getDBTime () const |
std::string | getDescription () const |
int | getFgrId () const |
int | getId () const |
int | getLinId () const |
int | getLUTId () const |
int | getPedId () const |
int | getSliId () const |
int | getSpiId () const |
std::string | getTable () |
int | getTimId () const |
int | getVersion () const |
int | getWeiId () const |
bool | operator!= (const FEConfigMainInfo &r) const |
bool | operator== (const FEConfigMainInfo &r) const |
void | setBstId (int x) |
void | setBttId (int x) |
void | setBxtId (int x) |
void | setDBTime (Tm x) |
void | setDescription (std::string x) |
void | setFgrId (int x) |
void | setId (int id) |
void | setLinId (int x) |
void | setLUTId (int x) |
void | setPedId (int x) |
void | setSliId (int x) |
void | setSpiId (int x) |
void | setTimId (int x) |
void | setVersion (int id) |
void | setWeiId (int x) |
~FEConfigMainInfo () | |
Private Member Functions | |
void | clear () |
void | fetchData (FEConfigMainInfo *result) throw (std::runtime_error) |
int | fetchID () throw (std::runtime_error) |
int | fetchIDLast () throw (std::runtime_error) |
int | fetchNextId () throw (std::runtime_error) |
void | insertConfig () throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | setByID (int id) throw (std::runtime_error) |
void | writeDB () throw (std::runtime_error) |
Private Attributes | |
int | m_bst_id |
int | m_btt_id |
int | m_bxt_id |
Tm | m_db_time |
std::string | m_description |
int | m_fgr_id |
int | m_ID |
int | m_lin_id |
int | m_lut_id |
int | m_ped_id |
int | m_sli_id |
int | m_spi_id |
int | m_tim_id |
int | m_version |
int | m_wei_id |
Friends | |
class | EcalCondDBInterface |
Definition at line 19 of file FEConfigMainInfo.h.
FEConfigMainInfo::FEConfigMainInfo | ( | ) |
Definition at line 12 of file FEConfigMainInfo.cc.
References hitfit::clear(), and NULL.
FEConfigMainInfo::~FEConfigMainInfo | ( | ) |
Definition at line 27 of file FEConfigMainInfo.cc.
{}
void FEConfigMainInfo::clear | ( | void | ) | [private] |
void FEConfigMainInfo::fetchData | ( | FEConfigMainInfo * | result | ) | throw (std::runtime_error) [private] |
Definition at line 263 of file FEConfigMainInfo.cc.
References gather_cfg::cout, DateHandler::dateToTm(), alignCSCRings::e, and query::result.
{ std::cout << " ### 1 getId from FEConfigMainInfo = " << result->getId() << std::endl; std::cout << " tag/version " << result->getConfigTag() <<"/"<<result->getVersion() << std::endl; this->checkConnection(); DateHandler dh(m_env, m_conn); // result->clear(); int idid=0; if(result->getId()==0){ //throw(std::runtime_error("FEConfigMainInfo::fetchData(): no Id defined for this FEConfigMainInfo ")); idid=result->fetchID(); result->setId(idid); } try { m_readStmt->setSQL("SELECT * FROM FE_CONFIG_MAIN WHERE conf_id = :1 "); std::cout << " ### 2 getId from FEConfigMainInfo = " << result->getId() << std::endl; // good m_readStmt->setInt(1, result->getId()); m_readStmt->setInt(1, result->getId()); ResultSet* rset = m_readStmt->executeQuery(); rset->next(); result->setId( rset->getInt(1) ); setPedId( rset->getInt(2) ); setLinId( rset->getInt(3) ); setLUTId( rset->getInt(4) ); setFgrId( rset->getInt(5) ); setSliId( rset->getInt(6) ); setWeiId( rset->getInt(7) ); setSpiId( rset->getInt(8) ); setTimId( rset->getInt(9) ); setBxtId( rset->getInt(10) ); setBttId( rset->getInt(11) ); setBstId( rset->getInt(12) ); result->setConfigTag( rset->getString(13) ); result->setVersion( rset->getInt(14) ); result->setDescription( rset->getString(15) ); Date dbdate = rset->getDate(16); result->setDBTime( dh.dateToTm( dbdate )); } catch (SQLException &e) { throw(std::runtime_error("FEConfigMainInfo::fetchData(): "+e.getMessage())); } }
int FEConfigMainInfo::fetchID | ( | ) | throw (std::runtime_error) [private] |
Definition at line 70 of file FEConfigMainInfo.cc.
References gather_cfg::cout, and alignCSCRings::e.
{ // Return from memory if available if (m_ID>0) { return m_ID; } this->checkConnection(); DateHandler dh(m_env, m_conn); std::cout << " tag/version " << getConfigTag() <<"/"<<getVersion() << std::endl; try { Statement* stmt = m_conn->createStatement(); if(m_version !=0){ stmt->setSQL("SELECT conf_id from FE_CONFIG_MAIN " "WHERE tag = :tag " " and version = :version " ); stmt->setString(1, m_config_tag); stmt->setInt(2, m_version); std::cout<<" using query with version " <<endl; } else { // always select the last inserted one with a given tag stmt->setSQL("SELECT conf_id from FE_CONFIG_MAIN " "WHERE tag = :1 and version= (select max(version) from FE_CONFIG_MAIN where tag=:2) " ); stmt->setString(1, m_config_tag); stmt->setString(2, m_config_tag); std::cout<<" using query WITHOUT version " <<endl; } ResultSet* rset = stmt->executeQuery(); if (rset->next()) { m_ID = rset->getInt(1); } else { m_ID = 0; } std::cout<<m_ID<<endl; m_conn->terminateStatement(stmt); } catch (SQLException &e) { throw(std::runtime_error("FEConfigMainInfo::fetchID: "+e.getMessage())); } setByID(m_ID); return m_ID; }
int FEConfigMainInfo::fetchIDLast | ( | ) | throw (std::runtime_error) [private] |
Definition at line 190 of file FEConfigMainInfo.cc.
References alignCSCRings::e.
{ this->checkConnection(); DateHandler dh(m_env, m_conn); try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT max(conf_id) FROM fe_config_main "); 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("ODRunConfigInfo::fetchIDLast: "+e.getMessage())); } setByID(m_ID); return m_ID; }
int FEConfigMainInfo::fetchNextId | ( | ) | throw (std::runtime_error) [private] |
Definition at line 49 of file FEConfigMainInfo.cc.
References alignCSCRings::e, and query::result.
{ int result=0; try { this->checkConnection(); m_readStmt = m_conn->createStatement(); m_readStmt->setSQL("select fe_config_main_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("FEConfigMainInfo::fetchNextId(): "+e.getMessage())); } }
int FEConfigMainInfo::getBstId | ( | ) | const [inline] |
Definition at line 70 of file FEConfigMainInfo.h.
References m_bst_id.
Referenced by EcalTPGParamBuilder::analyze(), and popcon::EcalTPGBadStripHandler::getNewObjects().
{return m_bst_id; }
int FEConfigMainInfo::getBttId | ( | ) | const [inline] |
Definition at line 67 of file FEConfigMainInfo.h.
References m_btt_id.
Referenced by EcalTPGParamBuilder::analyze(), and popcon::EcalTPGBadTTHandler::getNewObjects().
{return m_btt_id; }
int FEConfigMainInfo::getBxtId | ( | ) | const [inline] |
Definition at line 64 of file FEConfigMainInfo.h.
References m_bxt_id.
Referenced by EcalTPGParamBuilder::analyze(), and popcon::EcalTPGBadXTHandler::getNewObjects().
{return m_bxt_id; }
Tm FEConfigMainInfo::getDBTime | ( | ) | const [inline] |
std::string FEConfigMainInfo::getDescription | ( | ) | const [inline] |
Definition at line 37 of file FEConfigMainInfo.h.
References m_description.
{ return m_description;}
int FEConfigMainInfo::getFgrId | ( | ) | const [inline] |
Definition at line 49 of file FEConfigMainInfo.h.
References m_fgr_id.
Referenced by EcalTPGParamBuilder::analyze(), popcon::EcalTPGFineGrainEBGroupHandler::getNewObjects(), popcon::EcalTPGFineGrainTowerEEHandler::getNewObjects(), popcon::EcalTPGFineGrainEBIdMapHandler::getNewObjects(), popcon::EcalTPGPhysicsConstHandler::getNewObjects(), and popcon::EcalTPGFineGrainStripEEHandler::getNewObjects().
{ return m_fgr_id;}
int FEConfigMainInfo::getId | ( | ) | const [inline] |
Definition at line 30 of file FEConfigMainInfo.h.
References m_ID.
Referenced by EcalTPGDBApp::writeToConfDB_TPGMain().
{ return m_ID; }
int FEConfigMainInfo::getLinId | ( | ) | const [inline] |
Definition at line 43 of file FEConfigMainInfo.h.
References m_lin_id.
Referenced by EcalTPGParamBuilder::analyze(), popcon::EcalTPGPhysicsConstHandler::getNewObjects(), and popcon::EcalTPGLinConstHandler::getNewObjects().
{return m_lin_id; }
int FEConfigMainInfo::getLUTId | ( | ) | const [inline] |
Definition at line 46 of file FEConfigMainInfo.h.
References m_lut_id.
Referenced by EcalTPGParamBuilder::analyze(), popcon::EcalTPGPhysicsConstHandler::getNewObjects(), popcon::EcalTPGLutIdMapHandler::getNewObjects(), and popcon::EcalTPGLutGroupHandler::getNewObjects().
{return m_lut_id; }
int FEConfigMainInfo::getPedId | ( | ) | const [inline] |
Definition at line 40 of file FEConfigMainInfo.h.
References m_ped_id.
Referenced by EcalTPGParamBuilder::analyze(), and popcon::EcalTPGPedestalsHandler::getNewObjects().
{ return m_ped_id;}
int FEConfigMainInfo::getSliId | ( | ) | const [inline] |
Definition at line 52 of file FEConfigMainInfo.h.
References m_sli_id.
Referenced by EcalTPGParamBuilder::analyze(), and popcon::EcalTPGSlidingWindowHandler::getNewObjects().
{return m_sli_id; }
int FEConfigMainInfo::getSpiId | ( | ) | const [inline] |
Definition at line 58 of file FEConfigMainInfo.h.
References m_spi_id.
Referenced by EcalTPGParamBuilder::analyze(), and popcon::EcalTPGSpikeThresholdHandler::getNewObjects().
{ return m_spi_id;}
std::string FEConfigMainInfo::getTable | ( | ) | [inline, virtual] |
Implements IODConfig.
Definition at line 26 of file FEConfigMainInfo.h.
{ return "FE_CONFIG_MAIN"; }
int FEConfigMainInfo::getTimId | ( | ) | const [inline] |
Definition at line 61 of file FEConfigMainInfo.h.
References m_tim_id.
Referenced by EcalTPGParamBuilder::analyze().
{ return m_tim_id;}
int FEConfigMainInfo::getVersion | ( | ) | const [inline] |
Definition at line 73 of file FEConfigMainInfo.h.
References m_version.
Referenced by popcon::EcalTPGBadXTHandler::getNewObjects().
{ return m_version; }
int FEConfigMainInfo::getWeiId | ( | ) | const [inline] |
Definition at line 55 of file FEConfigMainInfo.h.
References m_wei_id.
Referenced by EcalTPGParamBuilder::analyze(), popcon::EcalTPGWeightGroupHandler::getNewObjects(), and popcon::EcalTPGWeightIdMapHandler::getNewObjects().
{ return m_wei_id;}
void FEConfigMainInfo::insertConfig | ( | ) | throw (std::runtime_error) [private] |
Definition at line 316 of file FEConfigMainInfo.cc.
References alignCSCRings::e.
{ try { prepareWrite(); writeDB(); m_conn->commit(); terminateWriteStatement(); } catch (std::runtime_error &e) { m_conn->rollback(); throw(e); } catch (...) { m_conn->rollback(); throw(std::runtime_error("FEConfigMainInfo::insertConfig: Unknown exception caught")); } }
bool FEConfigMainInfo::operator!= | ( | const FEConfigMainInfo & | r | ) | const [inline] |
Definition at line 79 of file FEConfigMainInfo.h.
References alignCSCRings::r.
{ return !(*this == r); }
bool FEConfigMainInfo::operator== | ( | const FEConfigMainInfo & | r | ) | const [inline] |
void FEConfigMainInfo::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IODConfig.
Definition at line 122 of file FEConfigMainInfo.cc.
References alignCSCRings::e.
{ this->checkConnection(); int next_id=fetchNextId(); try { m_writeStmt = m_conn->createStatement(); m_writeStmt->setSQL("INSERT INTO fe_config_main (conf_id, ped_conf_id, lin_conf_id, lut_conf_id, fgr_conf_id, sli_conf_id, wei_conf_id, spi_conf_id, tim_conf_id, bxt_conf_id, btt_conf_id, bst_conf_id, tag, version, description) " " VALUES (:1, :2, :3 , :4, :5, :6 ,:7, :8, :9, :10, :11, :12, :13, :14, :15 )"); m_writeStmt->setInt(1, next_id); m_ID=next_id; } catch (SQLException &e) { throw(std::runtime_error("FEConfigMainInfo::prepareWrite(): "+e.getMessage())); } }
void FEConfigMainInfo::setBstId | ( | int | x | ) | [inline] |
Definition at line 69 of file FEConfigMainInfo.h.
Referenced by EcalTPGDBApp::writeToConfDB_TPGMain().
void FEConfigMainInfo::setBttId | ( | int | x | ) | [inline] |
Definition at line 66 of file FEConfigMainInfo.h.
Referenced by EcalTPGDBApp::writeToConfDB_TPGMain().
void FEConfigMainInfo::setBxtId | ( | int | x | ) | [inline] |
Definition at line 63 of file FEConfigMainInfo.h.
Referenced by EcalTPGDBApp::writeToConfDB_TPGMain().
void FEConfigMainInfo::setByID | ( | int | id | ) | throw (std::runtime_error) [private] |
Definition at line 218 of file FEConfigMainInfo.cc.
References gather_cfg::cout, DateHandler::dateToTm(), and alignCSCRings::e.
{ this->checkConnection(); DateHandler dh(m_env, m_conn); cout<< "FEConfigMainInfo::setByID called for id "<<id<<endl; try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT * FROM FE_CONFIG_MAIN WHERE conf_id = :1 "); stmt->setInt(1, id); ResultSet* rset = stmt->executeQuery(); if (rset->next()) { setId( rset->getInt(1) ); setPedId( rset->getInt(2) ); setLinId( rset->getInt(3) ); setLUTId( rset->getInt(4) ); setFgrId( rset->getInt(5) ); setSliId( rset->getInt(6) ); setWeiId( rset->getInt(7) ); setSpiId( rset->getInt(8) ); setTimId( rset->getInt(9) ); setBxtId( rset->getInt(10) ); setBttId( rset->getInt(11) ); setBstId( rset->getInt(12) ); setConfigTag( rset->getString(13) ); setVersion( rset->getInt(14) ); setDescription( rset->getString(15) ); Date dbdate = rset->getDate(16); setDBTime( dh.dateToTm( dbdate )); m_ID = id; } else { throw(std::runtime_error("FEConfigMainInfo::setByID: Given cycle_id is not in the database")); } m_conn->terminateStatement(stmt); } catch (SQLException &e) { throw(std::runtime_error("FEConfigMainInfo::setByID: "+e.getMessage())); } }
void FEConfigMainInfo::setDBTime | ( | Tm | x | ) | [inline] |
void FEConfigMainInfo::setDescription | ( | std::string | x | ) | [inline] |
Definition at line 36 of file FEConfigMainInfo.h.
References m_description, and x.
{ m_description = x;}
void FEConfigMainInfo::setFgrId | ( | int | x | ) | [inline] |
Definition at line 48 of file FEConfigMainInfo.h.
Referenced by EcalTPGDBApp::writeToConfDB_TPGMain().
void FEConfigMainInfo::setId | ( | int | id | ) | [inline] |
void FEConfigMainInfo::setLinId | ( | int | x | ) | [inline] |
Definition at line 42 of file FEConfigMainInfo.h.
Referenced by EcalTPGDBApp::writeToConfDB_TPGMain().
void FEConfigMainInfo::setLUTId | ( | int | x | ) | [inline] |
Definition at line 45 of file FEConfigMainInfo.h.
Referenced by EcalTPGDBApp::writeToConfDB_TPGMain().
void FEConfigMainInfo::setPedId | ( | int | x | ) | [inline] |
Definition at line 39 of file FEConfigMainInfo.h.
Referenced by EcalTPGDBApp::writeToConfDB_TPGMain().
void FEConfigMainInfo::setSliId | ( | int | x | ) | [inline] |
Definition at line 51 of file FEConfigMainInfo.h.
Referenced by EcalTPGDBApp::writeToConfDB_TPGMain().
void FEConfigMainInfo::setSpiId | ( | int | x | ) | [inline] |
Definition at line 57 of file FEConfigMainInfo.h.
Referenced by EcalTPGDBApp::writeToConfDB_TPGMain().
void FEConfigMainInfo::setTimId | ( | int | x | ) | [inline] |
Definition at line 60 of file FEConfigMainInfo.h.
Referenced by EcalTPGDBApp::writeToConfDB_TPGMain().
void FEConfigMainInfo::setVersion | ( | int | id | ) | [inline] |
Definition at line 72 of file FEConfigMainInfo.h.
References m_version.
Referenced by popcon::EcalTPGFineGrainEBGroupHandler::getNewObjects(), popcon::EcalTPGFineGrainTowerEEHandler::getNewObjects(), popcon::EcalTPGWeightGroupHandler::getNewObjects(), popcon::EcalTPGBadXTHandler::getNewObjects(), popcon::EcalTPGWeightIdMapHandler::getNewObjects(), popcon::EcalTPGBadTTHandler::getNewObjects(), popcon::EcalTPGSpikeThresholdHandler::getNewObjects(), popcon::EcalTPGPedestalsHandler::getNewObjects(), popcon::EcalTPGSlidingWindowHandler::getNewObjects(), popcon::EcalTPGFineGrainEBIdMapHandler::getNewObjects(), popcon::EcalTPGPhysicsConstHandler::getNewObjects(), popcon::EcalTPGLinConstHandler::getNewObjects(), popcon::EcalTPGLutIdMapHandler::getNewObjects(), popcon::EcalTPGBadStripHandler::getNewObjects(), popcon::EcalTPGFineGrainStripEEHandler::getNewObjects(), popcon::EcalTPGLutGroupHandler::getNewObjects(), and EcalTPGDBApp::writeToConfDB_TPGMain().
{ m_version = id; }
void FEConfigMainInfo::setWeiId | ( | int | x | ) | [inline] |
Definition at line 54 of file FEConfigMainInfo.h.
Referenced by EcalTPGDBApp::writeToConfDB_TPGMain().
void FEConfigMainInfo::writeDB | ( | ) | throw (std::runtime_error) [private] |
Definition at line 145 of file FEConfigMainInfo.cc.
References gather_cfg::cout, and alignCSCRings::e.
{ this->checkConnection(); this->checkPrepare(); // Validate the data, use infinity-till convention DateHandler dh(m_env, m_conn); try { m_writeStmt->setInt(2, this->getPedId()); m_writeStmt->setInt(3, this->getLinId()); m_writeStmt->setInt(4, this->getLUTId()); m_writeStmt->setInt(5, this->getFgrId()); m_writeStmt->setInt(6, this->getSliId()); m_writeStmt->setInt(7, this->getWeiId()); m_writeStmt->setInt(8, this->getSpiId()); m_writeStmt->setInt(9, this->getTimId()); m_writeStmt->setInt(10, this->getBxtId()); m_writeStmt->setInt(11, this->getBttId()); m_writeStmt->setInt(12, this->getBstId()); m_writeStmt->setString(13, this->getConfigTag()); m_writeStmt->setInt(14, this->getVersion()); m_writeStmt->setString(15, this->getDescription()); m_writeStmt->executeUpdate(); } catch (SQLException &e) { throw(std::runtime_error("FEConfigMainInfo::writeDB: "+e.getMessage())); } // Now get the ID if (!this->fetchID()) { throw(std::runtime_error("FEConfigMainInfo::writeDB: Failed to write")); } setByID(m_ID); cout<< "FEConfigMainInfo::writeDB>> done inserting FEConfigMainInfo with id="<<m_ID<<endl; }
friend class EcalCondDBInterface [friend] |
Reimplemented from IDBObject.
Definition at line 21 of file FEConfigMainInfo.h.
int FEConfigMainInfo::m_bst_id [private] |
Definition at line 92 of file FEConfigMainInfo.h.
Referenced by getBstId(), and setBstId().
int FEConfigMainInfo::m_btt_id [private] |
Definition at line 91 of file FEConfigMainInfo.h.
Referenced by getBttId(), and setBttId().
int FEConfigMainInfo::m_bxt_id [private] |
Definition at line 90 of file FEConfigMainInfo.h.
Referenced by getBxtId(), and setBxtId().
Tm FEConfigMainInfo::m_db_time [private] |
Definition at line 96 of file FEConfigMainInfo.h.
Referenced by getDBTime(), and setDBTime().
std::string FEConfigMainInfo::m_description [private] |
Definition at line 97 of file FEConfigMainInfo.h.
Referenced by getDescription(), and setDescription().
int FEConfigMainInfo::m_fgr_id [private] |
Definition at line 88 of file FEConfigMainInfo.h.
Referenced by getFgrId(), and setFgrId().
int FEConfigMainInfo::m_ID [private] |
Definition at line 83 of file FEConfigMainInfo.h.
Referenced by getId(), operator==(), and setId().
int FEConfigMainInfo::m_lin_id [private] |
Definition at line 85 of file FEConfigMainInfo.h.
Referenced by getLinId(), and setLinId().
int FEConfigMainInfo::m_lut_id [private] |
Definition at line 86 of file FEConfigMainInfo.h.
Referenced by getLUTId(), and setLUTId().
int FEConfigMainInfo::m_ped_id [private] |
Definition at line 84 of file FEConfigMainInfo.h.
Referenced by getPedId(), and setPedId().
int FEConfigMainInfo::m_sli_id [private] |
Definition at line 87 of file FEConfigMainInfo.h.
Referenced by getSliId(), and setSliId().
int FEConfigMainInfo::m_spi_id [private] |
Definition at line 94 of file FEConfigMainInfo.h.
Referenced by getSpiId(), and setSpiId().
int FEConfigMainInfo::m_tim_id [private] |
Definition at line 93 of file FEConfigMainInfo.h.
Referenced by getTimId(), and setTimId().
int FEConfigMainInfo::m_version [private] |
Definition at line 95 of file FEConfigMainInfo.h.
Referenced by getVersion(), and setVersion().
int FEConfigMainInfo::m_wei_id [private] |
Definition at line 89 of file FEConfigMainInfo.h.
Referenced by getWeiId(), and setWeiId().