#include <FEConfigSpikeDat.h>
Public Member Functions | |
FEConfigSpikeDat () | |
int | getSpikeThreshold () const |
std::string | getTable () |
void | setSpikeThreshold (int x) |
~FEConfigSpikeDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, FEConfigSpikeDat > *fillMap, FEConfigSpikeInfo *iconf) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeArrayDB (const std::map< EcalLogicID, FEConfigSpikeDat > *data, FEConfigSpikeInfo *iconf) throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const FEConfigSpikeDat *item, FEConfigSpikeInfo *iconf) throw (std::runtime_error) |
Private Attributes | |
int | m_thr |
Friends | |
class | EcalCondDBInterface |
Definition at line 11 of file FEConfigSpikeDat.h.
FEConfigSpikeDat::FEConfigSpikeDat | ( | ) |
Definition at line 11 of file FEConfigSpikeDat.cc.
References NULL.
{ m_env = NULL; m_conn = NULL; m_writeStmt = NULL; m_readStmt = NULL; m_thr = 0; }
FEConfigSpikeDat::~FEConfigSpikeDat | ( | ) |
Definition at line 24 of file FEConfigSpikeDat.cc.
{ }
void FEConfigSpikeDat::fetchData | ( | std::map< EcalLogicID, FEConfigSpikeDat > * | fillMap, |
FEConfigSpikeInfo * | iconf | ||
) | throw (std::runtime_error) [private] |
int FEConfigSpikeDat::getSpikeThreshold | ( | ) | const [inline] |
Definition at line 21 of file FEConfigSpikeDat.h.
References m_thr.
Referenced by popcon::EcalTPGSpikeThresholdHandler::getNewObjects(), and writeArrayDB().
{ return m_thr; }
std::string FEConfigSpikeDat::getTable | ( | ) | [inline, virtual] |
Implements IDataItem.
Definition at line 18 of file FEConfigSpikeDat.h.
{ return "FE_CONFIG_SPIKE_DAT"; }
void FEConfigSpikeDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 30 of file FEConfigSpikeDat.cc.
{ this->checkConnection(); try { m_writeStmt = m_conn->createStatement(); m_writeStmt->setSQL("INSERT INTO "+getTable()+" (spi_conf_id, logic_id, " "spike_threshold ) " "VALUES (:spi_conf_id, :logic_id, " ":spike_threshold )" ); } catch (SQLException &e) { throw(std::runtime_error("FEConfigSpikeDat::prepareWrite(): "+e.getMessage())); } }
void FEConfigSpikeDat::setSpikeThreshold | ( | int | x | ) | [inline] |
Definition at line 20 of file FEConfigSpikeDat.h.
Referenced by EcalTPGParamBuilder::analyze().
void FEConfigSpikeDat::writeArrayDB | ( | const std::map< EcalLogicID, FEConfigSpikeDat > * | data, |
FEConfigSpikeInfo * | iconf | ||
) | throw (std::runtime_error) [private] |
Definition at line 113 of file FEConfigSpikeDat.cc.
References prof2calltree::count, AlCaHLTBitMon_QueryRunRegistry::data, EcalLogicID::getLogicID(), getSpikeThreshold(), AlCaHLTBitMon_ParallelJobs::p, and x.
{ this->checkConnection(); this->checkPrepare(); int iconfID = iconf->fetchID(); if (!iconfID) { throw(std::runtime_error("FEConfigSpikeDat::writeArrayDB: ICONF not in DB")); } int nrows=data->size(); int* ids= new int[nrows]; int* iconfid_vec= new int[nrows]; int* xx= new int[nrows]; ub2* ids_len= new ub2[nrows]; ub2* iconf_len= new ub2[nrows]; ub2* x_len= new ub2[nrows]; const EcalLogicID* channel; const FEConfigSpikeDat* dataitem; int count=0; typedef map< EcalLogicID, FEConfigSpikeDat >::const_iterator CI; for (CI p = data->begin(); p != data->end(); ++p) { channel = &(p->first); int logicID = channel->getLogicID(); if (!logicID) { throw(std::runtime_error("FEConfigSpikeDat::writeArrayDB: Bad EcalLogicID")); } ids[count]=logicID; iconfid_vec[count]=iconfID; dataitem = &(p->second); // dataIface.writeDB( channel, dataitem, iconf); int x=dataitem->getSpikeThreshold(); xx[count]=x; ids_len[count]=sizeof(ids[count]); iconf_len[count]=sizeof(iconfid_vec[count]); x_len[count]=sizeof(xx[count]); count++; } try { m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len); m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len ); m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len ); m_writeStmt->executeArrayUpdate(nrows); delete [] ids; delete [] iconfid_vec; delete [] xx; delete [] ids_len; delete [] iconf_len; delete [] x_len; } catch (SQLException &e) { throw(std::runtime_error("FEConfigSpikeDat::writeArrayDB(): "+e.getMessage())); } }
void FEConfigSpikeDat::writeDB | ( | const EcalLogicID * | ecid, |
const FEConfigSpikeDat * | item, | ||
FEConfigSpikeInfo * | iconf | ||
) | throw (std::runtime_error) [private] |
Definition at line 47 of file FEConfigSpikeDat.cc.
{ this->checkConnection(); this->checkPrepare(); int iconfID = iconf->fetchID(); if (!iconfID) { throw(std::runtime_error("FEConfigSpikeDat::writeDB: ICONF not in DB")); } int logicID = ecid->getLogicID(); if (!logicID) { throw(std::runtime_error("FEConfigSpikeDat::writeDB: Bad EcalLogicID")); } try { m_writeStmt->setInt(1, iconfID); m_writeStmt->setInt(2, logicID); m_writeStmt->setInt(3, item->getSpikeThreshold()); m_writeStmt->executeUpdate(); } catch (SQLException &e) { throw(std::runtime_error("FEConfigSpikeDat::writeDB(): "+e.getMessage())); } }
friend class EcalCondDBInterface [friend] |
Reimplemented from IDBObject.
Definition at line 13 of file FEConfigSpikeDat.h.
int FEConfigSpikeDat::m_thr [private] |
Definition at line 39 of file FEConfigSpikeDat.h.
Referenced by getSpikeThreshold(), and setSpikeThreshold().