CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
MonMemChConsistencyDat Class Reference

#include <MonMemChConsistencyDat.h>

Inheritance diagram for MonMemChConsistencyDat:
IDataItem IDBObject

Public Member Functions

int getProblematicEvents () const
 
int getProblemsGainSwitch () const
 
int getProblemsGainZero () const
 
int getProblemsID () const
 
int getProcessedEvents () const
 
std::string getTable () override
 
bool getTaskStatus () const
 
 MonMemChConsistencyDat ()
 
void setProblematicEvents (int prob)
 
void setProblemsGainSwitch (int prob)
 
void setProblemsGainZero (int prob)
 
void setProblemsID (int id)
 
void setProcessedEvents (int proc)
 
void setTaskStatus (bool status)
 
 ~MonMemChConsistencyDat () override
 
- Public Member Functions inherited from IDataItem
 IDataItem ()
 
- Public Member Functions inherited from IDBObject
oracle::occi::Connection * getConn () const
 
oracle::occi::Environment * getEnv () const
 
void setConnection (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
virtual ~IDBObject ()
 

Private Member Functions

void fetchData (std::map< EcalLogicID, MonMemChConsistencyDat > *fillVec, MonRunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, MonMemChConsistencyDat > *data, MonRunIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const MonMemChConsistencyDat *item, MonRunIOV *iov) noexcept(false)
 

Private Attributes

int m_problematicEvents
 
int m_problemsGainSwitch
 
int m_problemsGainZero
 
int m_problemsID
 
int m_processedEvents
 
bool m_taskStatus
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS = 1024
 
- Protected Member Functions inherited from IDataItem
void checkPrepare () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void setPrefetchRowCount (int ncount) noexcept(false)
 
void terminateReadStatement () noexcept(false)
 
void terminateWriteStatement () noexcept(false)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 
- Protected Attributes inherited from IDataItem
oracle::occi::Statement * m_readStmt
 
oracle::occi::Statement * m_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 12 of file MonMemChConsistencyDat.h.

Constructor & Destructor Documentation

◆ MonMemChConsistencyDat()

MonMemChConsistencyDat::MonMemChConsistencyDat ( )

Definition at line 10 of file MonMemChConsistencyDat.cc.

10  {
11  m_env = nullptr;
12  m_conn = nullptr;
13  m_writeStmt = nullptr;
14  m_readStmt = nullptr;
15 
18  m_problemsID = 0;
21  m_taskStatus = false;
22 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24

◆ ~MonMemChConsistencyDat()

MonMemChConsistencyDat::~MonMemChConsistencyDat ( )
override

Definition at line 24 of file MonMemChConsistencyDat.cc.

24 {}

Member Function Documentation

◆ fetchData()

void MonMemChConsistencyDat::fetchData ( std::map< EcalLogicID, MonMemChConsistencyDat > *  fillVec,
MonRunIOV iov 
)
privatenoexcept

Definition at line 73 of file MonMemChConsistencyDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setProblematicEvents(), setProblemsGainSwitch(), setProblemsGainZero(), setProblemsID(), setProcessedEvents(), and setTaskStatus().

74  {
75  this->checkConnection();
76  fillMap->clear();
77 
78  iov->setConnection(m_env, m_conn);
79  int iovID = iov->fetchID();
80  if (!iovID) {
81  // throw(std::runtime_error("MonMemChConsistencyDat::writeDB: IOV not in DB"));
82  return;
83  }
84 
85  try {
86  m_readStmt->setSQL(
87  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
88  "d.processed_events, d.problematic_events, d.problems_id, d.problems_gain_zero, d.problems_gain_switch, "
89  "d.task_status "
90  "FROM channelview cv JOIN mon_mem_ch_consistency_dat d "
91  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
92  "WHERE d.iov_id = :iov_id");
93  m_readStmt->setInt(1, iovID);
94  ResultSet* rset = m_readStmt->executeQuery();
95 
96  std::pair<EcalLogicID, MonMemChConsistencyDat> p;
98  while (rset->next()) {
99  p.first = EcalLogicID(rset->getString(1), // name
100  rset->getInt(2), // logic_id
101  rset->getInt(3), // id1
102  rset->getInt(4), // id2
103  rset->getInt(5), // id3
104  rset->getString(6)); // maps_to
105 
106  dat.setProcessedEvents(rset->getInt(7));
107  dat.setProblematicEvents(rset->getInt(8));
108  dat.setProblemsID(rset->getInt(9));
109  dat.setProblemsGainZero(rset->getInt(10));
110  dat.setProblemsGainSwitch(rset->getInt(11));
111  dat.setTaskStatus(rset->getInt(12));
112 
113  p.second = dat;
114  fillMap->insert(p);
115  }
116  } catch (SQLException& e) {
117  throw(std::runtime_error("MonMemChConsistencyDat::fetchData(): " + e.getMessage()));
118  }
119 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
void setTaskStatus(bool status)
void setProblemsGainSwitch(int prob)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23

◆ getProblematicEvents()

int MonMemChConsistencyDat::getProblematicEvents ( ) const
inline

Definition at line 25 of file MonMemChConsistencyDat.h.

References m_problematicEvents.

Referenced by writeArrayDB().

◆ getProblemsGainSwitch()

int MonMemChConsistencyDat::getProblemsGainSwitch ( ) const
inline

Definition at line 34 of file MonMemChConsistencyDat.h.

References m_problemsGainSwitch.

Referenced by writeArrayDB().

◆ getProblemsGainZero()

int MonMemChConsistencyDat::getProblemsGainZero ( ) const
inline

Definition at line 31 of file MonMemChConsistencyDat.h.

References m_problemsGainZero.

Referenced by writeArrayDB().

◆ getProblemsID()

int MonMemChConsistencyDat::getProblemsID ( ) const
inline

Definition at line 28 of file MonMemChConsistencyDat.h.

References m_problemsID.

Referenced by writeArrayDB().

◆ getProcessedEvents()

int MonMemChConsistencyDat::getProcessedEvents ( ) const
inline

Definition at line 22 of file MonMemChConsistencyDat.h.

References m_processedEvents.

Referenced by writeArrayDB().

◆ getTable()

std::string MonMemChConsistencyDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file MonMemChConsistencyDat.h.

19 { return "MON_MEM_CH_CONSISTENCY_DAT"; }

◆ getTaskStatus()

bool MonMemChConsistencyDat::getTaskStatus ( ) const
inline

Definition at line 37 of file MonMemChConsistencyDat.h.

References m_taskStatus.

Referenced by writeArrayDB().

◆ prepareWrite()

void MonMemChConsistencyDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 26 of file MonMemChConsistencyDat.cc.

References MillePedeFileConverter_cfg::e.

26  {
27  this->checkConnection();
28 
29  try {
30  m_writeStmt = m_conn->createStatement();
31  m_writeStmt->setSQL(
32  "INSERT INTO mon_mem_ch_consistency_dat (iov_id, logic_id, "
33  "processed_events, problematic_events, problems_id, problems_gain_zero, problems_gain_switch, task_status) "
34  "VALUES (:iov_id, :logic_id, "
35  ":3, :4, :5, :6, :7, :8)");
36  } catch (SQLException& e) {
37  throw(std::runtime_error("MonMemChConsistencyDat::prepareWrite(): " + e.getMessage()));
38  }
39 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36

◆ setProblematicEvents()

void MonMemChConsistencyDat::setProblematicEvents ( int  prob)
inline

◆ setProblemsGainSwitch()

void MonMemChConsistencyDat::setProblemsGainSwitch ( int  prob)
inline

◆ setProblemsGainZero()

void MonMemChConsistencyDat::setProblemsGainZero ( int  prob)
inline

◆ setProblemsID()

void MonMemChConsistencyDat::setProblemsID ( int  id)
inline

◆ setProcessedEvents()

void MonMemChConsistencyDat::setProcessedEvents ( int  proc)
inline

◆ setTaskStatus()

void MonMemChConsistencyDat::setTaskStatus ( bool  status)
inline

Definition at line 36 of file MonMemChConsistencyDat.h.

References m_taskStatus, and mps_update::status.

Referenced by fetchData().

◆ writeArrayDB()

void MonMemChConsistencyDat::writeArrayDB ( const std::map< EcalLogicID, MonMemChConsistencyDat > *  data,
MonRunIOV iov 
)
privatenoexcept

Definition at line 121 of file MonMemChConsistencyDat.cc.

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, EcalLogicID::getLogicID(), getProblematicEvents(), getProblemsGainSwitch(), getProblemsGainZero(), getProblemsID(), getProcessedEvents(), getTaskStatus(), AlCaHLTBitMon_ParallelJobs::p, w(), x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, and geometryCSVtoXML::zz.

122  {
123  this->checkConnection();
124  this->checkPrepare();
125 
126  int iovID = iov->fetchID();
127  if (!iovID) {
128  throw(std::runtime_error("MonMemChConsistencyDat::writeArrayDB: IOV not in DB"));
129  }
130 
131  int nrows = data->size();
132  int* ids = new int[nrows];
133  int* iovid_vec = new int[nrows];
134  int* xx = new int[nrows];
135  int* yy = new int[nrows];
136  int* zz = new int[nrows];
137  int* ww = new int[nrows];
138  int* uu = new int[nrows];
139  int* st = new int[nrows];
140 
141  ub2* ids_len = new ub2[nrows];
142  ub2* iov_len = new ub2[nrows];
143  ub2* x_len = new ub2[nrows];
144  ub2* y_len = new ub2[nrows];
145  ub2* z_len = new ub2[nrows];
146  ub2* w_len = new ub2[nrows];
147  ub2* u_len = new ub2[nrows];
148  ub2* st_len = new ub2[nrows];
149 
150  const EcalLogicID* channel;
151  const MonMemChConsistencyDat* dataitem;
152  int count = 0;
153  typedef map<EcalLogicID, MonMemChConsistencyDat>::const_iterator CI;
154  for (CI p = data->begin(); p != data->end(); ++p) {
155  channel = &(p->first);
156  int logicID = channel->getLogicID();
157  if (!logicID) {
158  throw(std::runtime_error("MonMemChConsistencyDat::writeArrayDB: Bad EcalLogicID"));
159  }
160  ids[count] = logicID;
161  iovid_vec[count] = iovID;
162 
163  dataitem = &(p->second);
164  // dataIface.writeDB( channel, dataitem, iov);
165  int x = dataitem->getProcessedEvents();
166  int y = dataitem->getProblematicEvents();
167  int z = dataitem->getProblemsID();
168  int w = dataitem->getProblemsGainZero();
169  int u = dataitem->getProblemsGainSwitch();
170  int statu = dataitem->getTaskStatus();
171 
172  xx[count] = x;
173  yy[count] = y;
174  zz[count] = z;
175  ww[count] = w;
176  uu[count] = u;
177  st[count] = statu;
178 
179  ids_len[count] = sizeof(ids[count]);
180  iov_len[count] = sizeof(iovid_vec[count]);
181 
182  x_len[count] = sizeof(xx[count]);
183  y_len[count] = sizeof(yy[count]);
184  z_len[count] = sizeof(zz[count]);
185  w_len[count] = sizeof(ww[count]);
186  u_len[count] = sizeof(uu[count]);
187  st_len[count] = sizeof(st[count]);
188 
189  count++;
190  }
191 
192  try {
193  m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]), iov_len);
194  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
195  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len);
196  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT, sizeof(yy[0]), y_len);
197  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIINT, sizeof(zz[0]), z_len);
198  m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIINT, sizeof(ww[0]), w_len);
199  m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIINT, sizeof(uu[0]), u_len);
200  m_writeStmt->setDataBuffer(8, (dvoid*)st, OCCIINT, sizeof(st[0]), st_len);
201 
202  m_writeStmt->executeArrayUpdate(nrows);
203 
204  delete[] ids;
205  delete[] iovid_vec;
206  delete[] xx;
207  delete[] yy;
208  delete[] zz;
209  delete[] ww;
210  delete[] uu;
211  delete[] st;
212 
213  delete[] ids_len;
214  delete[] iov_len;
215  delete[] x_len;
216  delete[] y_len;
217  delete[] z_len;
218  delete[] w_len;
219  delete[] u_len;
220  delete[] st_len;
221 
222  } catch (SQLException& e) {
223  throw(std::runtime_error("MonMemChConsistencyDat::writeArrayDB(): " + e.getMessage()));
224  }
225 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
T w() const
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
int getLogicID() const
Definition: EcalLogicID.cc:28
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80

◆ writeDB()

void MonMemChConsistencyDat::writeDB ( const EcalLogicID ecid,
const MonMemChConsistencyDat item,
MonRunIOV iov 
)
privatenoexcept

Definition at line 41 of file MonMemChConsistencyDat.cc.

References MillePedeFileConverter_cfg::e, and B2GTnPMonitor_cfi::item.

43  {
44  this->checkConnection();
45  this->checkPrepare();
46 
47  int iovID = iov->fetchID();
48  if (!iovID) {
49  throw(std::runtime_error("MonMemChConsistencyDat::writeDB: IOV not in DB"));
50  }
51 
52  int logicID = ecid->getLogicID();
53  if (!logicID) {
54  throw(std::runtime_error("MonMemChConsistencyDat::writeDB: Bad EcalLogicID"));
55  }
56 
57  try {
58  m_writeStmt->setInt(1, iovID);
59  m_writeStmt->setInt(2, logicID);
60 
61  m_writeStmt->setInt(3, item->getProcessedEvents());
62  m_writeStmt->setInt(4, item->getProblematicEvents());
63  m_writeStmt->setInt(5, item->getProblemsID());
64  m_writeStmt->setInt(6, item->getProblemsGainZero());
65  m_writeStmt->setInt(7, item->getProblemsGainSwitch());
66  m_writeStmt->setInt(8, item->getTaskStatus());
67  m_writeStmt->executeUpdate();
68  } catch (SQLException& e) {
69  throw(std::runtime_error("MonMemChConsistencyDat::writeDB(): " + e.getMessage()));
70  }
71 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
int getLogicID() const
Definition: EcalLogicID.cc:28

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonMemChConsistencyDat.h.

Member Data Documentation

◆ m_problematicEvents

int MonMemChConsistencyDat::m_problematicEvents
private

Definition at line 50 of file MonMemChConsistencyDat.h.

Referenced by getProblematicEvents(), and setProblematicEvents().

◆ m_problemsGainSwitch

int MonMemChConsistencyDat::m_problemsGainSwitch
private

Definition at line 53 of file MonMemChConsistencyDat.h.

Referenced by getProblemsGainSwitch(), and setProblemsGainSwitch().

◆ m_problemsGainZero

int MonMemChConsistencyDat::m_problemsGainZero
private

Definition at line 52 of file MonMemChConsistencyDat.h.

Referenced by getProblemsGainZero(), and setProblemsGainZero().

◆ m_problemsID

int MonMemChConsistencyDat::m_problemsID
private

Definition at line 51 of file MonMemChConsistencyDat.h.

Referenced by getProblemsID(), and setProblemsID().

◆ m_processedEvents

int MonMemChConsistencyDat::m_processedEvents
private

Definition at line 49 of file MonMemChConsistencyDat.h.

Referenced by getProcessedEvents(), and setProcessedEvents().

◆ m_taskStatus

bool MonMemChConsistencyDat::m_taskStatus
private

Definition at line 54 of file MonMemChConsistencyDat.h.

Referenced by getTaskStatus(), and setTaskStatus().