![]() |
![]() |
#include <OnlineDB/EcalCondDB/interface/MonMemChConsistencyDat.h>
Definition at line 12 of file MonMemChConsistencyDat.h.
MonMemChConsistencyDat::MonMemChConsistencyDat | ( | ) |
Definition at line 10 of file MonMemChConsistencyDat.cc.
References IDBObject::m_conn, IDBObject::m_env, m_problematicEvents, m_problemsGainSwitch, m_problemsGainZero, m_problemsID, m_processedEvents, IDataItem::m_readStmt, m_taskStatus, IDataItem::m_writeStmt, and NULL.
00011 { 00012 m_env = NULL; 00013 m_conn = NULL; 00014 m_writeStmt = NULL; 00015 m_readStmt = NULL; 00016 00017 m_processedEvents = 0; 00018 m_problematicEvents = 0; 00019 m_problemsID = 0; 00020 m_problemsGainZero = 0; 00021 m_problemsGainSwitch = 0; 00022 m_taskStatus = 0; 00023 }
MonMemChConsistencyDat::~MonMemChConsistencyDat | ( | ) |
void MonMemChConsistencyDat::fetchData | ( | std::map< EcalLogicID, MonMemChConsistencyDat > * | fillVec, | |
MonRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 81 of file MonMemChConsistencyDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, p, setProblematicEvents(), setProblemsGainSwitch(), setProblemsGainZero(), setProblemsID(), setProcessedEvents(), and setTaskStatus().
00083 { 00084 this->checkConnection(); 00085 fillMap->clear(); 00086 00087 iov->setConnection(m_env, m_conn); 00088 int iovID = iov->fetchID(); 00089 if (!iovID) { 00090 // throw(runtime_error("MonMemChConsistencyDat::writeDB: IOV not in DB")); 00091 return; 00092 } 00093 00094 try { 00095 00096 m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 00097 "d.processed_events, d.problematic_events, d.problems_id, d.problems_gain_zero, d.problems_gain_switch, d.task_status " 00098 "FROM channelview cv JOIN mon_mem_ch_consistency_dat d " 00099 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 00100 "WHERE d.iov_id = :iov_id"); 00101 m_readStmt->setInt(1, iovID); 00102 ResultSet* rset = m_readStmt->executeQuery(); 00103 00104 std::pair< EcalLogicID, MonMemChConsistencyDat > p; 00105 MonMemChConsistencyDat dat; 00106 while(rset->next()) { 00107 p.first = EcalLogicID( rset->getString(1), // name 00108 rset->getInt(2), // logic_id 00109 rset->getInt(3), // id1 00110 rset->getInt(4), // id2 00111 rset->getInt(5), // id3 00112 rset->getString(6)); // maps_to 00113 00114 dat.setProcessedEvents( rset->getInt(7) ); 00115 dat.setProblematicEvents( rset->getInt(8) ); 00116 dat.setProblemsID( rset->getInt(9) ); 00117 dat.setProblemsGainZero( rset->getInt(10) ); 00118 dat.setProblemsGainSwitch( rset->getInt(11) ); 00119 dat.setTaskStatus( rset->getInt(12) ); 00120 00121 p.second = dat; 00122 fillMap->insert(p); 00123 } 00124 } catch (SQLException &e) { 00125 throw(runtime_error("MonMemChConsistencyDat::fetchData(): "+e.getMessage())); 00126 } 00127 }
int MonMemChConsistencyDat::getProblematicEvents | ( | ) | const [inline] |
Definition at line 25 of file MonMemChConsistencyDat.h.
References m_problematicEvents.
Referenced by writeArrayDB().
00025 { return m_problematicEvents; }
int MonMemChConsistencyDat::getProblemsGainSwitch | ( | ) | const [inline] |
Definition at line 34 of file MonMemChConsistencyDat.h.
References m_problemsGainSwitch.
Referenced by writeArrayDB().
00034 { return m_problemsGainSwitch; }
int MonMemChConsistencyDat::getProblemsGainZero | ( | ) | const [inline] |
Definition at line 31 of file MonMemChConsistencyDat.h.
References m_problemsGainZero.
Referenced by writeArrayDB().
00031 { return m_problemsGainZero; }
int MonMemChConsistencyDat::getProblemsID | ( | ) | const [inline] |
Definition at line 28 of file MonMemChConsistencyDat.h.
References m_problemsID.
Referenced by writeArrayDB().
00028 { return m_problemsID; }
int MonMemChConsistencyDat::getProcessedEvents | ( | ) | const [inline] |
Definition at line 22 of file MonMemChConsistencyDat.h.
References m_processedEvents.
Referenced by writeArrayDB().
00022 { return m_processedEvents; }
std::string MonMemChConsistencyDat::getTable | ( | ) | [inline, virtual] |
bool MonMemChConsistencyDat::getTaskStatus | ( | ) | const [inline] |
Definition at line 37 of file MonMemChConsistencyDat.h.
References m_taskStatus.
Referenced by writeArrayDB().
00037 { return m_taskStatus; }
void MonMemChConsistencyDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 33 of file MonMemChConsistencyDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, and IDataItem::m_writeStmt.
00035 { 00036 this->checkConnection(); 00037 00038 try { 00039 m_writeStmt = m_conn->createStatement(); 00040 m_writeStmt->setSQL("INSERT INTO mon_mem_ch_consistency_dat (iov_id, logic_id, " 00041 "processed_events, problematic_events, problems_id, problems_gain_zero, problems_gain_switch, task_status) " 00042 "VALUES (:iov_id, :logic_id, " 00043 ":3, :4, :5, :6, :7, :8)"); 00044 } catch (SQLException &e) { 00045 throw(runtime_error("MonMemChConsistencyDat::prepareWrite(): "+e.getMessage())); 00046 } 00047 }
Definition at line 24 of file MonMemChConsistencyDat.h.
References m_problematicEvents.
Referenced by fetchData(), EEIntegrityClient::writeDb(), and EBIntegrityClient::writeDb().
00024 { m_problematicEvents = prob; }
Definition at line 33 of file MonMemChConsistencyDat.h.
References m_problemsGainSwitch.
Referenced by fetchData().
00033 { m_problemsGainSwitch = prob; }
Definition at line 30 of file MonMemChConsistencyDat.h.
References m_problemsGainZero.
Referenced by fetchData(), EEIntegrityClient::writeDb(), and EBIntegrityClient::writeDb().
00030 { m_problemsGainZero = prob; }
Definition at line 27 of file MonMemChConsistencyDat.h.
References m_problemsID.
Referenced by fetchData(), EEIntegrityClient::writeDb(), and EBIntegrityClient::writeDb().
00027 { m_problemsID = id; }
Definition at line 21 of file MonMemChConsistencyDat.h.
References m_processedEvents.
Referenced by fetchData(), EEIntegrityClient::writeDb(), and EBIntegrityClient::writeDb().
00021 { m_processedEvents = proc; }
Definition at line 36 of file MonMemChConsistencyDat.h.
References m_taskStatus.
Referenced by fetchData().
00036 { m_taskStatus = status; }
void MonMemChConsistencyDat::writeArrayDB | ( | const std::map< EcalLogicID, MonMemChConsistencyDat > * | data, | |
MonRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 129 of file MonMemChConsistencyDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), count, data, e, EcalLogicID::getLogicID(), getProblematicEvents(), getProblemsGainSwitch(), getProblemsGainZero(), getProblemsID(), getProcessedEvents(), getTaskStatus(), IDataItem::m_writeStmt, p, st, w, ww, x, y, and z.
00131 { 00132 this->checkConnection(); 00133 this->checkPrepare(); 00134 00135 int iovID = iov->fetchID(); 00136 if (!iovID) { throw(runtime_error("MonMemChConsistencyDat::writeArrayDB: IOV not in DB")); } 00137 00138 00139 int nrows=data->size(); 00140 int* ids= new int[nrows]; 00141 int* iovid_vec= new int[nrows]; 00142 int* xx= new int[nrows]; 00143 int* yy= new int[nrows]; 00144 int* zz= new int[nrows]; 00145 int* ww= new int[nrows]; 00146 int* uu= new int[nrows]; 00147 int* st= new int[nrows]; 00148 00149 ub2* ids_len= new ub2[nrows]; 00150 ub2* iov_len= new ub2[nrows]; 00151 ub2* x_len= new ub2[nrows]; 00152 ub2* y_len= new ub2[nrows]; 00153 ub2* z_len= new ub2[nrows]; 00154 ub2* w_len= new ub2[nrows]; 00155 ub2* u_len= new ub2[nrows]; 00156 ub2* st_len= new ub2[nrows]; 00157 00158 const EcalLogicID* channel; 00159 const MonMemChConsistencyDat* dataitem; 00160 int count=0; 00161 typedef map< EcalLogicID, MonMemChConsistencyDat >::const_iterator CI; 00162 for (CI p = data->begin(); p != data->end(); ++p) { 00163 channel = &(p->first); 00164 int logicID = channel->getLogicID(); 00165 if (!logicID) { throw(runtime_error("MonMemChConsistencyDat::writeArrayDB: Bad EcalLogicID")); } 00166 ids[count]=logicID; 00167 iovid_vec[count]=iovID; 00168 00169 dataitem = &(p->second); 00170 // dataIface.writeDB( channel, dataitem, iov); 00171 int x=dataitem->getProcessedEvents(); 00172 int y=dataitem->getProblematicEvents(); 00173 int z=dataitem->getProblemsID(); 00174 int w=dataitem->getProblemsGainZero(); 00175 int u=dataitem->getProblemsGainSwitch(); 00176 int statu=dataitem->getTaskStatus(); 00177 00178 00179 00180 xx[count]=x; 00181 yy[count]=y; 00182 zz[count]=z; 00183 ww[count]=w; 00184 uu[count]=u; 00185 st[count]=statu; 00186 00187 00188 ids_len[count]=sizeof(ids[count]); 00189 iov_len[count]=sizeof(iovid_vec[count]); 00190 00191 x_len[count]=sizeof(xx[count]); 00192 y_len[count]=sizeof(yy[count]); 00193 z_len[count]=sizeof(zz[count]); 00194 w_len[count]=sizeof(ww[count]); 00195 u_len[count]=sizeof(uu[count]); 00196 st_len[count]=sizeof(st[count]); 00197 00198 count++; 00199 } 00200 00201 00202 try { 00203 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]),iov_len); 00204 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len ); 00205 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len ); 00206 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len ); 00207 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIINT , sizeof(zz[0]), z_len ); 00208 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIINT , sizeof(ww[0]), w_len ); 00209 m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIINT , sizeof(uu[0]), u_len ); 00210 m_writeStmt->setDataBuffer(8, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len ); 00211 00212 00213 m_writeStmt->executeArrayUpdate(nrows); 00214 00215 delete [] ids; 00216 delete [] iovid_vec; 00217 delete [] xx; 00218 delete [] yy; 00219 delete [] zz; 00220 delete [] ww; 00221 delete [] uu; 00222 delete [] st; 00223 00224 delete [] ids_len; 00225 delete [] iov_len; 00226 delete [] x_len; 00227 delete [] y_len; 00228 delete [] z_len; 00229 delete [] w_len; 00230 delete [] u_len; 00231 delete [] st_len; 00232 00233 00234 00235 } catch (SQLException &e) { 00236 throw(runtime_error("MonMemChConsistencyDat::writeArrayDB(): "+e.getMessage())); 00237 } 00238 }
void MonMemChConsistencyDat::writeDB | ( | const EcalLogicID * | ecid, | |
const MonMemChConsistencyDat * | item, | |||
MonRunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 51 of file MonMemChConsistencyDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), e, and IDataItem::m_writeStmt.
00053 { 00054 this->checkConnection(); 00055 this->checkPrepare(); 00056 00057 int iovID = iov->fetchID(); 00058 if (!iovID) { throw(runtime_error("MonMemChConsistencyDat::writeDB: IOV not in DB")); } 00059 00060 int logicID = ecid->getLogicID(); 00061 if (!logicID) { throw(runtime_error("MonMemChConsistencyDat::writeDB: Bad EcalLogicID")); } 00062 00063 try { 00064 m_writeStmt->setInt(1, iovID); 00065 m_writeStmt->setInt(2, logicID); 00066 00067 m_writeStmt->setInt(3, item->getProcessedEvents() ); 00068 m_writeStmt->setInt(4, item->getProblematicEvents() ); 00069 m_writeStmt->setInt(5, item->getProblemsID() ); 00070 m_writeStmt->setInt(6, item->getProblemsGainZero() ); 00071 m_writeStmt->setInt(7, item->getProblemsGainSwitch() ); 00072 m_writeStmt->setInt(8, item->getTaskStatus() ); 00073 m_writeStmt->executeUpdate(); 00074 } catch (SQLException &e) { 00075 throw(runtime_error("MonMemChConsistencyDat::writeDB(): "+e.getMessage())); 00076 } 00077 }
friend class EcalCondDBInterface [friend] |
Definition at line 55 of file MonMemChConsistencyDat.h.
Referenced by getProblematicEvents(), MonMemChConsistencyDat(), and setProblematicEvents().
Definition at line 58 of file MonMemChConsistencyDat.h.
Referenced by getProblemsGainSwitch(), MonMemChConsistencyDat(), and setProblemsGainSwitch().
Definition at line 57 of file MonMemChConsistencyDat.h.
Referenced by getProblemsGainZero(), MonMemChConsistencyDat(), and setProblemsGainZero().
int MonMemChConsistencyDat::m_problemsID [private] |
Definition at line 56 of file MonMemChConsistencyDat.h.
Referenced by getProblemsID(), MonMemChConsistencyDat(), and setProblemsID().
int MonMemChConsistencyDat::m_processedEvents [private] |
Definition at line 54 of file MonMemChConsistencyDat.h.
Referenced by getProcessedEvents(), MonMemChConsistencyDat(), and setProcessedEvents().
bool MonMemChConsistencyDat::m_taskStatus [private] |
Definition at line 59 of file MonMemChConsistencyDat.h.
Referenced by getTaskStatus(), MonMemChConsistencyDat(), and setTaskStatus().