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