#include <ODCCSConfig.h>
Public Member Functions | |
int | fetchNextId () throw (std::runtime_error) |
int | getBC0Counter () const |
int | getBC0Delay () const |
std::string | getBGOSource () const |
int | getClock () const |
int | getDaccal () const |
int | getDAQBCIDPreset () const |
int | getDelay () const |
std::string | getGain () const |
int | getId () const |
std::string | getMemGain () const |
int | getOffsetHigh () const |
int | getOffsetLow () const |
int | getOffsetMid () const |
std::string | getTable () |
int | getTEDelay () const |
int | getTrgBCIDPreset () const |
std::string | getTrgFilter () const |
std::string | getTrgMode () const |
int | getTTSMask () const |
ODCCSConfig () | |
void | setBC0Counter (int x) |
void | setBC0Delay (int x) |
void | setBGOSource (std::string x) |
void | setClock (int x) |
void | setDaccal (int x) |
void | setDAQBCIDPreset (int x) |
void | setDelay (int x) |
void | setGain (std::string x) |
void | setId (int id) |
void | setMemGain (std::string x) |
void | setOffsetHigh (int x) |
void | setOffsetLow (int x) |
void | setOffsetMid (int x) |
void | setParameters (std::map< std::string, std::string > my_keys_map) |
void | setTEDelay (int x) |
void | setTrgBCIDPreset (int x) |
void | setTrgFilter (std::string x) |
void | setTrgMode (std::string x) |
void | setTTSMask (int x) |
~ODCCSConfig () | |
Private Member Functions | |
void | clear () |
void | fetchData (ODCCSConfig *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_bc0 |
int | m_bc0_delay |
std::string | m_bgo |
int | m_clock |
int | m_daccal |
int | m_daq |
int | m_delay |
std::string | m_gain |
int | m_ID |
std::string | m_memgain |
int | m_offset_high |
int | m_offset_low |
int | m_offset_mid |
std::string | m_pedestal_offset_release |
std::string | m_system |
int | m_te_delay |
int | m_trg |
std::string | m_trg_filter |
std::string | m_trg_mode |
int | m_tts_mask |
Friends | |
class | EcalCondDBInterface |
Definition at line 9 of file ODCCSConfig.h.
ODCCSConfig::ODCCSConfig | ( | ) |
Definition at line 19 of file ODCCSConfig.cc.
References hitfit::clear(), and NULL.
{ m_env = NULL; m_conn = NULL; m_writeStmt = NULL; m_readStmt = NULL; m_config_tag=""; m_ID=0; clear(); }
ODCCSConfig::~ODCCSConfig | ( | ) |
Definition at line 52 of file ODCCSConfig.cc.
{ }
void ODCCSConfig::clear | ( | void | ) | [private] |
Definition at line 31 of file ODCCSConfig.cc.
References MY_NULL.
{ m_daccal=MY_NULL; m_delay=MY_NULL; m_gain=""; m_memgain=""; m_offset_high=MY_NULL; m_offset_low=MY_NULL; m_offset_mid=MY_NULL; m_trg_mode=""; m_trg_filter=""; m_bgo=""; m_tts_mask=MY_NULL; m_daq=MY_NULL; m_trg=MY_NULL; m_bc0=MY_NULL; m_bc0_delay=MY_NULL; m_te_delay=MY_NULL; }
void ODCCSConfig::fetchData | ( | ODCCSConfig * | result | ) | throw (std::runtime_error) [private] |
Definition at line 195 of file ODCCSConfig.cc.
References alignCSCRings::e, and query::result.
{ this->checkConnection(); result->clear(); if(result->getId()==0 && (result->getConfigTag()=="") ){ throw(std::runtime_error("ODCCSConfig::fetchData(): no Id defined for this ODCCSConfig ")); } try { m_readStmt->setSQL("SELECT * " "FROM ECAL_CCS_CONFIGURATION " " where ( CCS_configuration_id = :1 or CCS_tag=:2 )" ); m_readStmt->setInt(1, result->getId()); m_readStmt->setString(2, result->getConfigTag()); ResultSet* rset = m_readStmt->executeQuery(); rset->next(); // 1 is the id and 2 is the config tag result->setId(rset->getInt(1)); result->setConfigTag(rset->getString(2)); result->setDaccal( rset->getInt(3) ); result->setDelay( rset->getInt(4) ); result->setGain( rset->getString(5) ); result->setMemGain( rset->getString(6) ); result->setOffsetHigh( rset->getInt(7) ); result->setOffsetLow( rset->getInt(8) ); result->setOffsetMid( rset->getInt(9) ); result->setTrgMode( rset->getString(10) ); result->setTrgFilter( rset->getString(11) ); result->setClock( rset->getInt(12) ); result->setBGOSource( rset->getString(13) ); result->setTTSMask( rset->getInt(14) ); result->setDAQBCIDPreset( rset->getInt(15) ); result->setTrgBCIDPreset( rset->getInt(16) ); result->setBC0Counter( rset->getInt(17) ); } catch (SQLException &e) { throw(std::runtime_error("ODCCSConfig::fetchData(): "+e.getMessage())); } }
int ODCCSConfig::fetchID | ( | ) | throw (std::runtime_error) [private] |
Definition at line 242 of file ODCCSConfig.cc.
References alignCSCRings::e.
{ // Return from memory if available if (m_ID!=0) { return m_ID; } this->checkConnection(); try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT ccs_configuration_id FROM ecal_ccs_configuration " "WHERE ccs_tag=:ccs_tag " ); stmt->setString(1, getConfigTag() ); 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("ODCCSConfig::fetchID: "+e.getMessage())); } return m_ID; }
int ODCCSConfig::fetchNextId | ( | ) | throw (std::runtime_error) |
Definition at line 58 of file ODCCSConfig.cc.
References alignCSCRings::e, and query::result.
{ int result=0; try { this->checkConnection(); m_readStmt = m_conn->createStatement(); m_readStmt->setSQL("select ecal_CCS_config_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("ODCCSConfig::fetchNextId(): "+e.getMessage())); } }
int ODCCSConfig::getBC0Counter | ( | ) | const [inline] |
int ODCCSConfig::getBC0Delay | ( | ) | const [inline] |
std::string ODCCSConfig::getBGOSource | ( | ) | const [inline] |
int ODCCSConfig::getClock | ( | ) | const [inline] |
int ODCCSConfig::getDaccal | ( | ) | const [inline] |
int ODCCSConfig::getDAQBCIDPreset | ( | ) | const [inline] |
int ODCCSConfig::getDelay | ( | ) | const [inline] |
std::string ODCCSConfig::getGain | ( | ) | const [inline] |
int ODCCSConfig::getId | ( | ) | const [inline] |
std::string ODCCSConfig::getMemGain | ( | ) | const [inline] |
int ODCCSConfig::getOffsetHigh | ( | ) | const [inline] |
int ODCCSConfig::getOffsetLow | ( | ) | const [inline] |
int ODCCSConfig::getOffsetMid | ( | ) | const [inline] |
std::string ODCCSConfig::getTable | ( | ) | [inline, virtual] |
Implements IODConfig.
Definition at line 16 of file ODCCSConfig.h.
{ return "ECAL_CCS_CONFIGURATION"; }
int ODCCSConfig::getTEDelay | ( | ) | const [inline] |
int ODCCSConfig::getTrgBCIDPreset | ( | ) | const [inline] |
std::string ODCCSConfig::getTrgFilter | ( | ) | const [inline] |
std::string ODCCSConfig::getTrgMode | ( | ) | const [inline] |
int ODCCSConfig::getTTSMask | ( | ) | const [inline] |
void ODCCSConfig::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IODConfig.
Definition at line 79 of file ODCCSConfig.cc.
References alignCSCRings::e.
{ this->checkConnection(); int next_id=fetchNextId(); try { m_writeStmt = m_conn->createStatement(); m_writeStmt->setSQL("INSERT INTO ECAL_CCS_CONFIGURATION ( ccs_configuration_id, ccs_tag ," " daccal, delay, gain, memgain, offset_high,offset_low,offset_mid, trg_mode, trg_filter, " " clock, BGO_SOURCE, TTS_MASK, DAQ_BCID_PRESET , TRIG_BCID_PRESET, BC0_COUNTER, BC0_DELAY, TE_DELAY ) " "VALUES ( " " :ccs_configuration_id, :ccs_tag, :daccal, :delay, :gain, :memgain, :offset_high,:offset_low," " :offset_mid, :trg_mode, :trg_filter, :clock, :BGO_SOURCE, :TTS_MASK, " " :DAQ_BCID_PRESET , :TRIG_BCID_PRESET, :BC0_COUNTER, :BC0_DELAY, :TE_DELAY) "); m_writeStmt->setInt(1, next_id); m_ID=next_id; } catch (SQLException &e) { throw(std::runtime_error("ODCCSConfig::prepareWrite(): "+e.getMessage())); } }
void ODCCSConfig::setBC0Counter | ( | int | x | ) | [inline] |
void ODCCSConfig::setBC0Delay | ( | int | x | ) | [inline] |
void ODCCSConfig::setBGOSource | ( | std::string | x | ) | [inline] |
void ODCCSConfig::setClock | ( | int | x | ) | [inline] |
void ODCCSConfig::setDaccal | ( | int | x | ) | [inline] |
void ODCCSConfig::setDAQBCIDPreset | ( | int | x | ) | [inline] |
void ODCCSConfig::setDelay | ( | int | x | ) | [inline] |
void ODCCSConfig::setGain | ( | std::string | x | ) | [inline] |
void ODCCSConfig::setId | ( | int | id | ) | [inline] |
Definition at line 18 of file ODCCSConfig.h.
References errorMatrix2Lands_multiChannel::id, and m_ID.
void ODCCSConfig::setMemGain | ( | std::string | x | ) | [inline] |
void ODCCSConfig::setOffsetHigh | ( | int | x | ) | [inline] |
Definition at line 33 of file ODCCSConfig.h.
References m_offset_high, and x.
{ m_offset_high = x; }
void ODCCSConfig::setOffsetLow | ( | int | x | ) | [inline] |
void ODCCSConfig::setOffsetMid | ( | int | x | ) | [inline] |
void ODCCSConfig::setParameters | ( | std::map< std::string, std::string > | my_keys_map | ) |
void ODCCSConfig::setTEDelay | ( | int | x | ) | [inline] |
void ODCCSConfig::setTrgBCIDPreset | ( | int | x | ) | [inline] |
void ODCCSConfig::setTrgFilter | ( | std::string | x | ) | [inline] |
void ODCCSConfig::setTrgMode | ( | std::string | x | ) | [inline] |
void ODCCSConfig::setTTSMask | ( | int | x | ) | [inline] |
void ODCCSConfig::writeDB | ( | ) | throw (std::runtime_error) [private] |
Definition at line 135 of file ODCCSConfig.cc.
References alignCSCRings::e, SET_INT, and SET_STRING.
{ this->checkConnection(); this->checkPrepare(); try { // number 1 is the id // m_writeStmt->setString(2, this->getConfigTag()); // m_writeStmt->setInt(3, this->getDaccal()); // m_writeStmt->setInt(4, this->getDelay()); // m_writeStmt->setString(5, this->getGain()); // m_writeStmt->setString(6, this->getMemGain()); // m_writeStmt->setInt(7, this->getOffsetHigh()); // m_writeStmt->setInt(8, this->getOffsetLow()); // m_writeStmt->setInt(9, this->getOffsetMid()); // m_writeStmt->setString(10, this->getTrgMode() ); // m_writeStmt->setString(11, this->getTrgFilter() ); // m_writeStmt->setInt( 12, this->getClock() ); // m_writeStmt->setString(13, this->getBGOSource() ); // m_writeStmt->setInt(14, this->getTTSMask() ); // m_writeStmt->setInt(15, this->getDAQBCIDPreset() ); // m_writeStmt->setInt(16, this->getTrgBCIDPreset() ); // m_writeStmt->setInt(17, this->getBC0Counter() ); SET_STRING(m_writeStmt, 2, this->getConfigTag()); SET_INT (m_writeStmt, 3, this->getDaccal()); SET_INT (m_writeStmt, 4, this->getDelay()); SET_STRING(m_writeStmt, 5, this->getGain()); SET_STRING(m_writeStmt, 6, this->getMemGain()); SET_INT (m_writeStmt, 7, this->getOffsetHigh()); SET_INT (m_writeStmt, 8, this->getOffsetLow()); SET_INT (m_writeStmt, 9, this->getOffsetMid()); SET_STRING(m_writeStmt, 10, this->getTrgMode()); SET_STRING(m_writeStmt, 11, this->getTrgFilter()); SET_INT (m_writeStmt, 12, this->getClock()); SET_STRING(m_writeStmt, 13, this->getBGOSource()); SET_INT (m_writeStmt, 14, this->getTTSMask()); SET_INT (m_writeStmt, 15, this->getDAQBCIDPreset()); SET_INT (m_writeStmt, 16, this->getTrgBCIDPreset()); SET_INT (m_writeStmt, 17, this->getBC0Counter()); SET_INT (m_writeStmt, 18, this->getBC0Delay()); SET_INT (m_writeStmt, 19, this->getTEDelay()); m_writeStmt->executeUpdate(); } catch (SQLException &e) { throw(std::runtime_error("ODCCSConfig::writeDB(): "+e.getMessage())); } // Now get the ID if (!this->fetchID()) { throw(std::runtime_error("ODCCSConfig::writeDB: Failed to write")); } }
friend class EcalCondDBInterface [friend] |
Reimplemented from IDBObject.
Definition at line 11 of file ODCCSConfig.h.
int ODCCSConfig::m_bc0 [private] |
Definition at line 99 of file ODCCSConfig.h.
Referenced by getBC0Counter(), and setBC0Counter().
int ODCCSConfig::m_bc0_delay [private] |
Definition at line 100 of file ODCCSConfig.h.
Referenced by getBC0Delay(), and setBC0Delay().
std::string ODCCSConfig::m_bgo [private] |
Definition at line 95 of file ODCCSConfig.h.
Referenced by getBGOSource(), and setBGOSource().
int ODCCSConfig::m_clock [private] |
Definition at line 94 of file ODCCSConfig.h.
Referenced by getClock(), and setClock().
int ODCCSConfig::m_daccal [private] |
Definition at line 83 of file ODCCSConfig.h.
Referenced by getDaccal(), and setDaccal().
int ODCCSConfig::m_daq [private] |
Definition at line 97 of file ODCCSConfig.h.
Referenced by getDAQBCIDPreset(), and setDAQBCIDPreset().
int ODCCSConfig::m_delay [private] |
Definition at line 84 of file ODCCSConfig.h.
Referenced by getDelay(), and setDelay().
std::string ODCCSConfig::m_gain [private] |
Definition at line 85 of file ODCCSConfig.h.
int ODCCSConfig::m_ID [private] |
Definition at line 82 of file ODCCSConfig.h.
std::string ODCCSConfig::m_memgain [private] |
Definition at line 86 of file ODCCSConfig.h.
Referenced by getMemGain(), and setMemGain().
int ODCCSConfig::m_offset_high [private] |
Definition at line 87 of file ODCCSConfig.h.
Referenced by getOffsetHigh(), and setOffsetHigh().
int ODCCSConfig::m_offset_low [private] |
Definition at line 88 of file ODCCSConfig.h.
Referenced by getOffsetLow(), and setOffsetLow().
int ODCCSConfig::m_offset_mid [private] |
Definition at line 89 of file ODCCSConfig.h.
Referenced by getOffsetMid(), and setOffsetMid().
std::string ODCCSConfig::m_pedestal_offset_release [private] |
Definition at line 90 of file ODCCSConfig.h.
std::string ODCCSConfig::m_system [private] |
Definition at line 91 of file ODCCSConfig.h.
int ODCCSConfig::m_te_delay [private] |
Definition at line 101 of file ODCCSConfig.h.
Referenced by getTEDelay(), and setTEDelay().
int ODCCSConfig::m_trg [private] |
Definition at line 98 of file ODCCSConfig.h.
Referenced by getTrgBCIDPreset(), and setTrgBCIDPreset().
std::string ODCCSConfig::m_trg_filter [private] |
Definition at line 93 of file ODCCSConfig.h.
Referenced by getTrgFilter(), and setTrgFilter().
std::string ODCCSConfig::m_trg_mode [private] |
Definition at line 92 of file ODCCSConfig.h.
Referenced by getTrgMode(), and setTrgMode().
int ODCCSConfig::m_tts_mask [private] |
Definition at line 96 of file ODCCSConfig.h.
Referenced by getTTSMask(), and setTTSMask().