CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
MonMemTTConsistencyDat Class Reference

#include <MonMemTTConsistencyDat.h>

Inheritance diagram for MonMemTTConsistencyDat:
IDataItem IDBObject

Public Member Functions

int getProblematicEvents () const
 
int getProblemsBunchX () const
 
int getProblemsID () const
 
int getProblemsLV1 () const
 
int getProblemsSize () const
 
int getProcessedEvents () const
 
std::string getTable () override
 
bool getTaskStatus () const
 
 MonMemTTConsistencyDat ()
 
void setProblematicEvents (int prob)
 
void setProblemsBunchX (int bunchX)
 
void setProblemsID (int id)
 
void setProblemsLV1 (int LV1)
 
void setProblemsSize (int size)
 
void setProcessedEvents (int proc)
 
void setTaskStatus (bool status)
 
 ~MonMemTTConsistencyDat () 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, MonMemTTConsistencyDat > *fillVec, MonRunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, MonMemTTConsistencyDat > *data, MonRunIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const MonMemTTConsistencyDat *item, MonRunIOV *iov) noexcept(false)
 

Private Attributes

int m_problematicEvents
 
int m_problemsBunchX
 
int m_problemsID
 
int m_problemsLV1
 
int m_problemsSize
 
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 MonMemTTConsistencyDat.h.

Constructor & Destructor Documentation

MonMemTTConsistencyDat::MonMemTTConsistencyDat ( )

Definition at line 10 of file MonMemTTConsistencyDat.cc.

10  {
11  m_env = nullptr;
12  m_conn = nullptr;
13  m_writeStmt = nullptr;
14  m_readStmt = nullptr;
15 
18  m_problemsID = 0;
19  m_problemsSize = 0;
20  m_problemsLV1 = 0;
21  m_problemsBunchX = 0;
22  m_taskStatus = false;
23 }
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
MonMemTTConsistencyDat::~MonMemTTConsistencyDat ( )
override

Definition at line 25 of file MonMemTTConsistencyDat.cc.

25 {}

Member Function Documentation

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

Definition at line 76 of file MonMemTTConsistencyDat.cc.

References dat, alignCSCRings::e, AlCaHLTBitMon_ParallelJobs::p, setProblematicEvents(), setProblemsBunchX(), setProblemsID(), setProblemsLV1(), setProblemsSize(), setProcessedEvents(), and setTaskStatus().

77  {
78  this->checkConnection();
79  fillMap->clear();
80 
81  iov->setConnection(m_env, m_conn);
82  int iovID = iov->fetchID();
83  if (!iovID) {
84  // throw(std::runtime_error("MonMemTTConsistencyDat::writeDB: IOV not in DB"));
85  return;
86  }
87 
88  try {
89  m_readStmt->setSQL(
90  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
91  "d.processed_events, d.problematic_events, d.problems_id, d.problems_size, d.problems_LV1, d.problems_bunch_X, "
92  "d.task_status "
93  "FROM channelview cv JOIN mon_mem_tt_consistency_dat d "
94  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
95  "WHERE d.iov_id = :iov_id");
96  m_readStmt->setInt(1, iovID);
97  ResultSet* rset = m_readStmt->executeQuery();
98 
99  std::pair<EcalLogicID, MonMemTTConsistencyDat> p;
101  while (rset->next()) {
102  p.first = EcalLogicID(rset->getString(1), // name
103  rset->getInt(2), // logic_id
104  rset->getInt(3), // id1
105  rset->getInt(4), // id2
106  rset->getInt(5), // id3
107  rset->getString(6)); // maps_to
108 
109  dat.setProcessedEvents(rset->getInt(7));
110  dat.setProblematicEvents(rset->getInt(8));
111  dat.setProblemsID(rset->getInt(9));
112  dat.setProblemsSize(rset->getInt(10));
113  dat.setProblemsLV1(rset->getInt(11));
114  dat.setProblemsBunchX(rset->getInt(12));
115  dat.setTaskStatus(rset->getInt(13));
116 
117  p.second = dat;
118  fillMap->insert(p);
119  }
120  } catch (SQLException& e) {
121  throw(std::runtime_error("MonMemTTConsistencyDat::fetchData(): " + e.getMessage()));
122  }
123 }
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
void setProblemsBunchX(int bunchX)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
static std::vector< std::string > checklist dat
void setTaskStatus(bool status)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
int MonMemTTConsistencyDat::getProblematicEvents ( ) const
inline

Definition at line 25 of file MonMemTTConsistencyDat.h.

References m_problematicEvents.

Referenced by writeArrayDB().

int MonMemTTConsistencyDat::getProblemsBunchX ( ) const
inline

Definition at line 37 of file MonMemTTConsistencyDat.h.

References m_problemsBunchX.

Referenced by writeArrayDB().

int MonMemTTConsistencyDat::getProblemsID ( ) const
inline

Definition at line 28 of file MonMemTTConsistencyDat.h.

References m_problemsID.

Referenced by writeArrayDB().

int MonMemTTConsistencyDat::getProblemsLV1 ( ) const
inline

Definition at line 34 of file MonMemTTConsistencyDat.h.

References m_problemsLV1.

Referenced by writeArrayDB().

int MonMemTTConsistencyDat::getProblemsSize ( ) const
inline

Definition at line 31 of file MonMemTTConsistencyDat.h.

References m_problemsSize.

Referenced by writeArrayDB().

int MonMemTTConsistencyDat::getProcessedEvents ( ) const
inline

Definition at line 22 of file MonMemTTConsistencyDat.h.

References m_processedEvents.

Referenced by writeArrayDB().

std::string MonMemTTConsistencyDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file MonMemTTConsistencyDat.h.

19 { return "MON_MEM_TT_CONSISTENCY_DAT"; }
bool MonMemTTConsistencyDat::getTaskStatus ( ) const
inline

Definition at line 40 of file MonMemTTConsistencyDat.h.

References m_taskStatus.

Referenced by writeArrayDB().

void MonMemTTConsistencyDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 27 of file MonMemTTConsistencyDat.cc.

References alignCSCRings::e.

27  {
28  this->checkConnection();
29 
30  try {
31  m_writeStmt = m_conn->createStatement();
32  m_writeStmt->setSQL(
33  "INSERT INTO mon_mem_tt_consistency_dat (iov_id, logic_id, "
34  "processed_events, problematic_events, problems_id, problems_size, problems_LV1, problems_bunch_X, "
35  "task_status) "
36  "VALUES (:iov_id, :logic_id, "
37  ":3, :4, :5, :6, :7, :8, :9)");
38  } catch (SQLException& e) {
39  throw(std::runtime_error("MonMemTTConsistencyDat::prepareWrite(): " + e.getMessage()));
40  }
41 }
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
void MonMemTTConsistencyDat::setProblematicEvents ( int  prob)
inline

Definition at line 24 of file MonMemTTConsistencyDat.h.

References m_problematicEvents.

Referenced by fetchData(), and ecaldqm::IntegrityWriter::run().

void MonMemTTConsistencyDat::setProblemsBunchX ( int  bunchX)
inline

Definition at line 36 of file MonMemTTConsistencyDat.h.

References m_problemsBunchX.

Referenced by fetchData().

void MonMemTTConsistencyDat::setProblemsID ( int  id)
inline

Definition at line 27 of file MonMemTTConsistencyDat.h.

References gpuClustering::id, and m_problemsID.

Referenced by fetchData(), and ecaldqm::IntegrityWriter::run().

27 { m_problemsID = id; }
uint16_t *__restrict__ id
void MonMemTTConsistencyDat::setProblemsLV1 ( int  LV1)
inline

Definition at line 33 of file MonMemTTConsistencyDat.h.

References m_problemsLV1.

Referenced by fetchData().

void MonMemTTConsistencyDat::setProblemsSize ( int  size)
inline

Definition at line 30 of file MonMemTTConsistencyDat.h.

References m_problemsSize, and findQualityFiles::size.

Referenced by fetchData(), and ecaldqm::IntegrityWriter::run().

30 { m_problemsSize = size; }
tuple size
Write out results.
void MonMemTTConsistencyDat::setProcessedEvents ( int  proc)
inline
void MonMemTTConsistencyDat::setTaskStatus ( bool  status)
inline
void MonMemTTConsistencyDat::writeArrayDB ( const std::map< EcalLogicID, MonMemTTConsistencyDat > *  data,
MonRunIOV iov 
)
privatenoexcept

Definition at line 125 of file MonMemTTConsistencyDat.cc.

References submitPVResolutionJobs::count, data, alignCSCRings::e, EcalLogicID::getLogicID(), getProblematicEvents(), getProblemsBunchX(), getProblemsID(), getProblemsLV1(), getProblemsSize(), getProcessedEvents(), getTaskStatus(), AlCaHLTBitMon_ParallelJobs::p, submitPVValidationJobs::t, groupFilesInBlocks::tt, w, x, y, and z.

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

Definition at line 43 of file MonMemTTConsistencyDat.cc.

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

45  {
46  this->checkConnection();
47  this->checkPrepare();
48 
49  int iovID = iov->fetchID();
50  if (!iovID) {
51  throw(std::runtime_error("MonMemTTConsistencyDat::writeDB: IOV not in DB"));
52  }
53 
54  int logicID = ecid->getLogicID();
55  if (!logicID) {
56  throw(std::runtime_error("MonMemTTConsistencyDat::writeDB: Bad EcalLogicID"));
57  }
58 
59  try {
60  m_writeStmt->setInt(1, iovID);
61  m_writeStmt->setInt(2, logicID);
62 
63  m_writeStmt->setInt(3, item->getProcessedEvents());
64  m_writeStmt->setInt(4, item->getProblematicEvents());
65  m_writeStmt->setInt(5, item->getProblemsID());
66  m_writeStmt->setInt(6, item->getProblemsSize());
67  m_writeStmt->setInt(7, item->getProblemsLV1());
68  m_writeStmt->setInt(8, item->getProblemsBunchX());
69  m_writeStmt->setInt(9, item->getTaskStatus());
70  m_writeStmt->executeUpdate();
71  } catch (SQLException& e) {
72  throw(std::runtime_error("MonMemTTConsistencyDat::writeDB(): " + e.getMessage()));
73  }
74 }
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

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonMemTTConsistencyDat.h.

Member Data Documentation

int MonMemTTConsistencyDat::m_problematicEvents
private

Definition at line 53 of file MonMemTTConsistencyDat.h.

Referenced by getProblematicEvents(), and setProblematicEvents().

int MonMemTTConsistencyDat::m_problemsBunchX
private

Definition at line 57 of file MonMemTTConsistencyDat.h.

Referenced by getProblemsBunchX(), and setProblemsBunchX().

int MonMemTTConsistencyDat::m_problemsID
private

Definition at line 54 of file MonMemTTConsistencyDat.h.

Referenced by getProblemsID(), and setProblemsID().

int MonMemTTConsistencyDat::m_problemsLV1
private

Definition at line 56 of file MonMemTTConsistencyDat.h.

Referenced by getProblemsLV1(), and setProblemsLV1().

int MonMemTTConsistencyDat::m_problemsSize
private

Definition at line 55 of file MonMemTTConsistencyDat.h.

Referenced by getProblemsSize(), and setProblemsSize().

int MonMemTTConsistencyDat::m_processedEvents
private

Definition at line 52 of file MonMemTTConsistencyDat.h.

Referenced by getProcessedEvents(), and setProcessedEvents().

bool MonMemTTConsistencyDat::m_taskStatus
private

Definition at line 58 of file MonMemTTConsistencyDat.h.

Referenced by getTaskStatus(), and setTaskStatus().