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