![]() |
![]() |
#include <OnlineDB/EcalCondDB/interface/ODCCSConfig.h>
Definition at line 9 of file ODCCSConfig.h.
ODCCSConfig::ODCCSConfig | ( | ) |
Definition at line 15 of file ODCCSConfig.cc.
References clear(), IODConfig::m_config_tag, IDBObject::m_conn, IDBObject::m_env, m_ID, IODConfig::m_readStmt, IODConfig::m_writeStmt, and NULL.
00016 { 00017 m_env = NULL; 00018 m_conn = NULL; 00019 m_writeStmt = NULL; 00020 m_readStmt = NULL; 00021 m_config_tag=""; 00022 m_ID=0; 00023 clear(); 00024 }
ODCCSConfig::~ODCCSConfig | ( | ) |
Definition at line 27 of file ODCCSConfig.cc.
References m_bc0, m_bc0_delay, m_bgo, m_daccal, m_daq, m_delay, m_gain, m_memgain, m_offset_high, m_offset_low, m_offset_mid, m_te_delay, m_trg, m_trg_filter, m_trg_mode, m_tts_mask, and MY_SQL_NULL.
Referenced by ODCCSConfig().
00027 { 00028 m_daccal=MY_SQL_NULL; 00029 m_delay=MY_SQL_NULL; 00030 m_gain=""; 00031 m_memgain=""; 00032 m_offset_high=MY_SQL_NULL; 00033 m_offset_low=MY_SQL_NULL; 00034 m_offset_mid=MY_SQL_NULL; 00035 m_trg_mode=""; 00036 m_trg_filter=""; 00037 m_bgo=""; 00038 m_tts_mask=MY_SQL_NULL; 00039 m_daq=MY_SQL_NULL; 00040 m_trg=MY_SQL_NULL; 00041 m_bc0=MY_SQL_NULL; 00042 m_bc0_delay=MY_SQL_NULL; 00043 m_te_delay=MY_SQL_NULL; 00044 }
void ODCCSConfig::fetchData | ( | ODCCSConfig * | result | ) | throw (std::runtime_error) [private] |
Definition at line 190 of file ODCCSConfig.cc.
References IDBObject::checkConnection(), e, IODConfig::m_readStmt, and HLT_VtxMuL3::result.
00192 { 00193 this->checkConnection(); 00194 result->clear(); 00195 if(result->getId()==0 && (result->getConfigTag()=="") ){ 00196 throw(runtime_error("ODCCSConfig::fetchData(): no Id defined for this ODCCSConfig ")); 00197 } 00198 00199 try { 00200 00201 m_readStmt->setSQL("SELECT * " 00202 "FROM ECAL_CCS_CONFIGURATION " 00203 " where ( CCS_configuration_id = :1 or CCS_tag=:2 )" ); 00204 m_readStmt->setInt(1, result->getId()); 00205 m_readStmt->setString(2, result->getConfigTag()); 00206 ResultSet* rset = m_readStmt->executeQuery(); 00207 00208 rset->next(); 00209 00210 // 1 is the id and 2 is the config tag 00211 00212 result->setId(rset->getInt(1)); 00213 result->setConfigTag(rset->getString(2)); 00214 00215 result->setDaccal( rset->getInt(3) ); 00216 result->setDelay( rset->getInt(4) ); 00217 result->setGain( rset->getString(5) ); 00218 result->setMemGain( rset->getString(6) ); 00219 result->setOffsetHigh( rset->getInt(7) ); 00220 result->setOffsetLow( rset->getInt(8) ); 00221 result->setOffsetMid( rset->getInt(9) ); 00222 result->setTrgMode( rset->getString(10) ); 00223 result->setTrgFilter( rset->getString(11) ); 00224 result->setClock( rset->getInt(12) ); 00225 result->setBGOSource( rset->getString(13) ); 00226 result->setTTSMask( rset->getInt(14) ); 00227 result->setDAQBCIDPreset( rset->getInt(15) ); 00228 result->setTrgBCIDPreset( rset->getInt(16) ); 00229 result->setBC0Counter( rset->getInt(17) ); 00230 00231 00232 } catch (SQLException &e) { 00233 throw(runtime_error("ODCCSConfig::fetchData(): "+e.getMessage())); 00234 } 00235 }
int ODCCSConfig::fetchID | ( | ) | throw (std::runtime_error) [private] |
Definition at line 237 of file ODCCSConfig.cc.
References IDBObject::checkConnection(), e, IODConfig::getConfigTag(), IDBObject::m_conn, and m_ID.
00238 { 00239 // Return from memory if available 00240 if (m_ID!=0) { 00241 return m_ID; 00242 } 00243 00244 this->checkConnection(); 00245 00246 try { 00247 Statement* stmt = m_conn->createStatement(); 00248 stmt->setSQL("SELECT ccs_configuration_id FROM ecal_ccs_configuration " 00249 "WHERE ccs_tag=:ccs_tag " 00250 ); 00251 00252 stmt->setString(1, getConfigTag() ); 00253 00254 ResultSet* rset = stmt->executeQuery(); 00255 00256 if (rset->next()) { 00257 m_ID = rset->getInt(1); 00258 } else { 00259 m_ID = 0; 00260 } 00261 m_conn->terminateStatement(stmt); 00262 } catch (SQLException &e) { 00263 throw(runtime_error("ODCCSConfig::fetchID: "+e.getMessage())); 00264 } 00265 00266 return m_ID; 00267 }
int ODCCSConfig::fetchNextId | ( | ) | throw (std::runtime_error) |
Definition at line 54 of file ODCCSConfig.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, IODConfig::m_readStmt, and HLT_VtxMuL3::result.
Referenced by prepareWrite().
00054 { 00055 00056 int result=0; 00057 try { 00058 this->checkConnection(); 00059 00060 m_readStmt = m_conn->createStatement(); 00061 m_readStmt->setSQL("select ecal_CCS_config_sq.NextVal from dual"); 00062 ResultSet* rset = m_readStmt->executeQuery(); 00063 while (rset->next ()){ 00064 result= rset->getInt(1); 00065 } 00066 m_conn->terminateStatement(m_readStmt); 00067 return result; 00068 00069 } catch (SQLException &e) { 00070 throw(runtime_error("ODCCSConfig::fetchNextId(): "+e.getMessage())); 00071 } 00072 00073 }
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] |
Definition at line 34 of file ODCCSConfig.h.
References m_offset_high.
00034 { return m_offset_high; }
int ODCCSConfig::getOffsetLow | ( | ) | const [inline] |
Definition at line 37 of file ODCCSConfig.h.
References m_offset_low.
00037 { return m_offset_low; }
int ODCCSConfig::getOffsetMid | ( | ) | const [inline] |
Definition at line 40 of file ODCCSConfig.h.
References m_offset_mid.
00040 { return m_offset_mid; }
std::string ODCCSConfig::getTable | ( | ) | [inline, virtual] |
int ODCCSConfig::getTEDelay | ( | ) | const [inline] |
int ODCCSConfig::getTrgBCIDPreset | ( | ) | const [inline] |
std::string ODCCSConfig::getTrgFilter | ( | ) | const [inline] |
Definition at line 46 of file ODCCSConfig.h.
References m_trg_filter.
00046 { return m_trg_filter; }
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 75 of file ODCCSConfig.cc.
References IDBObject::checkConnection(), e, fetchNextId(), IDBObject::m_conn, m_ID, and IODConfig::m_writeStmt.
00077 { 00078 this->checkConnection(); 00079 int next_id=fetchNextId(); 00080 00081 try { 00082 m_writeStmt = m_conn->createStatement(); 00083 m_writeStmt->setSQL("INSERT INTO ECAL_CCS_CONFIGURATION ( ccs_configuration_id, ccs_tag ," 00084 " daccal, delay, gain, memgain, offset_high,offset_low,offset_mid, trg_mode, trg_filter, " 00085 " clock, BGO_SOURCE, TTS_MASK, DAQ_BCID_PRESET , TRIG_BCID_PRESET, BC0_COUNTER, BC0_DELAY, TE_DELAY ) " 00086 "VALUES ( " 00087 " :ccs_configuration_id, :ccs_tag, :daccal, :delay, :gain, :memgain, :offset_high,:offset_low," 00088 " :offset_mid, :trg_mode, :trg_filter, :clock, :BGO_SOURCE, :TTS_MASK, " 00089 " :DAQ_BCID_PRESET , :TRIG_BCID_PRESET, :BC0_COUNTER, :BC0_DELAY, :TE_DELAY) "); 00090 00091 m_writeStmt->setInt(1, next_id); 00092 m_ID=next_id; 00093 00094 } catch (SQLException &e) { 00095 throw(runtime_error("ODCCSConfig::prepareWrite(): "+e.getMessage())); 00096 } 00097 00098 }
Definition at line 61 of file ODCCSConfig.h.
References m_bc0_delay.
Referenced by setParameters().
00061 { m_bc0_delay = x; }
void ODCCSConfig::setBGOSource | ( | std::string | x | ) | [inline] |
void ODCCSConfig::setGain | ( | std::string | x | ) | [inline] |
void ODCCSConfig::setMemGain | ( | std::string | x | ) | [inline] |
Definition at line 33 of file ODCCSConfig.h.
References m_offset_high.
Referenced by setParameters().
00033 { m_offset_high = x; }
Definition at line 36 of file ODCCSConfig.h.
References m_offset_low.
Referenced by setParameters().
00036 { m_offset_low = x; }
Definition at line 39 of file ODCCSConfig.h.
References m_offset_mid.
Referenced by setParameters().
00039 { m_offset_mid = x; }
void ODCCSConfig::setParameters | ( | std::map< string, string > | my_keys_map | ) |
Definition at line 100 of file ODCCSConfig.cc.
References setBC0Counter(), setBC0Delay(), setBGOSource(), setClock(), IODConfig::setConfigTag(), setDaccal(), setDAQBCIDPreset(), setGain(), setMemGain(), setOffsetHigh(), setOffsetLow(), setOffsetMid(), setTEDelay(), setTrgBCIDPreset(), setTrgFilter(), setTrgMode(), and setTTSMask().
00100 { 00101 00102 // parses the result of the XML parser that is a map of 00103 // string string with variable name variable value 00104 00105 for( std::map<std::string, std::string >::iterator ci= 00106 my_keys_map.begin(); ci!=my_keys_map.end(); ci++ ) { 00107 00108 if(ci->first== "CCS_CONFIGURATION_ID") setConfigTag(ci->second); 00109 if(ci->first== "DACCAL") setDaccal(atoi(ci->second.c_str()) ); 00110 if(ci->first== "GAIN") setGain(ci->second); 00111 if(ci->first== "MEMGAIN") setMemGain(ci->second); 00112 if(ci->first== "OFFSET_HIGH") setOffsetHigh(atoi(ci->second.c_str() )); 00113 if(ci->first== "OFFSET_LOW") setOffsetLow(atoi(ci->second.c_str() )); 00114 if(ci->first== "OFFSET_MID") setOffsetMid(atoi(ci->second.c_str() )); 00115 if(ci->first== "TRG_MODE") setTrgMode(ci->second ); 00116 if(ci->first== "TRG_FILTER") setTrgFilter(ci->second ); 00117 if(ci->first== "CLOCK") setClock(atoi(ci->second.c_str()) ); 00118 if(ci->first== "BGO_SOURCE") setBGOSource(ci->second) ; 00119 if(ci->first== "TTS_MASK") setTTSMask(atoi(ci->second.c_str()) ); 00120 if(ci->first== "DAQ_BCID_PRESET") setDAQBCIDPreset(atoi(ci->second.c_str() )); 00121 if(ci->first== "TRIG_BCID_PRESET") setTrgBCIDPreset(atoi(ci->second.c_str()) ); 00122 if(ci->first== "BC0_COUNTER") setBC0Counter(atoi(ci->second.c_str() )); 00123 if(ci->first== "BC0_DELAY") setBC0Delay(atoi(ci->second.c_str() )); 00124 if(ci->first== "TE_DELAY") setTEDelay(atoi(ci->second.c_str() )); 00125 00126 } 00127 00128 }
Definition at line 63 of file ODCCSConfig.h.
References m_te_delay.
Referenced by setParameters().
00063 { m_te_delay = x; }
void ODCCSConfig::setTrgFilter | ( | std::string | x | ) | [inline] |
Definition at line 45 of file ODCCSConfig.h.
References m_trg_filter.
Referenced by setParameters().
00045 { m_trg_filter = x; }
void ODCCSConfig::setTrgMode | ( | std::string | x | ) | [inline] |
Definition at line 42 of file ODCCSConfig.h.
References m_trg_mode.
Referenced by setParameters().
00042 { m_trg_mode = x; }
Definition at line 52 of file ODCCSConfig.h.
References m_tts_mask.
Referenced by setParameters().
00052 { m_tts_mask = x; }
void ODCCSConfig::writeDB | ( | ) | throw (std::runtime_error) [private] |
Definition at line 130 of file ODCCSConfig.cc.
References IDBObject::checkConnection(), IODConfig::checkPrepare(), e, IODConfig::m_writeStmt, SET_INT, and SET_STRING.
00132 { 00133 this->checkConnection(); 00134 this->checkPrepare(); 00135 00136 try { 00137 00138 // number 1 is the id 00139 // m_writeStmt->setString(2, this->getConfigTag()); 00140 // m_writeStmt->setInt(3, this->getDaccal()); 00141 // m_writeStmt->setInt(4, this->getDelay()); 00142 // m_writeStmt->setString(5, this->getGain()); 00143 // m_writeStmt->setString(6, this->getMemGain()); 00144 // m_writeStmt->setInt(7, this->getOffsetHigh()); 00145 // m_writeStmt->setInt(8, this->getOffsetLow()); 00146 // m_writeStmt->setInt(9, this->getOffsetMid()); 00147 // m_writeStmt->setString(10, this->getTrgMode() ); 00148 // m_writeStmt->setString(11, this->getTrgFilter() ); 00149 // m_writeStmt->setInt( 12, this->getClock() ); 00150 // m_writeStmt->setString(13, this->getBGOSource() ); 00151 // m_writeStmt->setInt(14, this->getTTSMask() ); 00152 // m_writeStmt->setInt(15, this->getDAQBCIDPreset() ); 00153 // m_writeStmt->setInt(16, this->getTrgBCIDPreset() ); 00154 // m_writeStmt->setInt(17, this->getBC0Counter() ); 00155 00156 SET_STRING(m_writeStmt, 2, this->getConfigTag()); 00157 SET_INT (m_writeStmt, 3, this->getDaccal()); 00158 SET_INT (m_writeStmt, 4, this->getDelay()); 00159 SET_STRING(m_writeStmt, 5, this->getGain()); 00160 SET_STRING(m_writeStmt, 6, this->getMemGain()); 00161 SET_INT (m_writeStmt, 7, this->getOffsetHigh()); 00162 SET_INT (m_writeStmt, 8, this->getOffsetLow()); 00163 SET_INT (m_writeStmt, 9, this->getOffsetMid()); 00164 SET_STRING(m_writeStmt, 10, this->getTrgMode()); 00165 SET_STRING(m_writeStmt, 11, this->getTrgFilter()); 00166 SET_INT (m_writeStmt, 12, this->getClock()); 00167 SET_STRING(m_writeStmt, 13, this->getBGOSource()); 00168 SET_INT (m_writeStmt, 14, this->getTTSMask()); 00169 SET_INT (m_writeStmt, 15, this->getDAQBCIDPreset()); 00170 SET_INT (m_writeStmt, 16, this->getTrgBCIDPreset()); 00171 SET_INT (m_writeStmt, 17, this->getBC0Counter()); 00172 SET_INT (m_writeStmt, 18, this->getBC0Delay()); 00173 SET_INT (m_writeStmt, 19, this->getTEDelay()); 00174 00175 m_writeStmt->executeUpdate(); 00176 00177 00178 } catch (SQLException &e) { 00179 throw(runtime_error("ODCCSConfig::writeDB(): "+e.getMessage())); 00180 } 00181 // Now get the ID 00182 if (!this->fetchID()) { 00183 throw(runtime_error("ODCCSConfig::writeDB: Failed to write")); 00184 } 00185 00186 00187 }
friend class EcalCondDBInterface [friend] |
int ODCCSConfig::m_bc0 [private] |
Definition at line 99 of file ODCCSConfig.h.
Referenced by clear(), getBC0Counter(), and setBC0Counter().
int ODCCSConfig::m_bc0_delay [private] |
Definition at line 100 of file ODCCSConfig.h.
Referenced by clear(), getBC0Delay(), and setBC0Delay().
std::string ODCCSConfig::m_bgo [private] |
Definition at line 95 of file ODCCSConfig.h.
Referenced by clear(), getBGOSource(), and setBGOSource().
int ODCCSConfig::m_clock [private] |
int ODCCSConfig::m_daccal [private] |
int ODCCSConfig::m_daq [private] |
Definition at line 97 of file ODCCSConfig.h.
Referenced by clear(), getDAQBCIDPreset(), and setDAQBCIDPreset().
int ODCCSConfig::m_delay [private] |
std::string ODCCSConfig::m_gain [private] |
int ODCCSConfig::m_ID [private] |
Definition at line 82 of file ODCCSConfig.h.
Referenced by fetchID(), getId(), ODCCSConfig(), prepareWrite(), and setId().
std::string ODCCSConfig::m_memgain [private] |
int ODCCSConfig::m_offset_high [private] |
Definition at line 87 of file ODCCSConfig.h.
Referenced by clear(), getOffsetHigh(), and setOffsetHigh().
int ODCCSConfig::m_offset_low [private] |
Definition at line 88 of file ODCCSConfig.h.
Referenced by clear(), getOffsetLow(), and setOffsetLow().
int ODCCSConfig::m_offset_mid [private] |
Definition at line 89 of file ODCCSConfig.h.
Referenced by clear(), 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 clear(), getTEDelay(), and setTEDelay().
int ODCCSConfig::m_trg [private] |
Definition at line 98 of file ODCCSConfig.h.
Referenced by clear(), getTrgBCIDPreset(), and setTrgBCIDPreset().
std::string ODCCSConfig::m_trg_filter [private] |
Definition at line 93 of file ODCCSConfig.h.
Referenced by clear(), getTrgFilter(), and setTrgFilter().
std::string ODCCSConfig::m_trg_mode [private] |
int ODCCSConfig::m_tts_mask [private] |