CMS 3D CMS Logo

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

#include <MonTTConsistencyDat.h>

Inheritance diagram for MonTTConsistencyDat:
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
 
 MonTTConsistencyDat ()
 
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)
 
 ~MonTTConsistencyDat () 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, MonTTConsistencyDat > *fillVec, MonRunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, MonTTConsistencyDat > *data, MonRunIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const MonTTConsistencyDat *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 MonTTConsistencyDat.h.

Constructor & Destructor Documentation

◆ MonTTConsistencyDat()

MonTTConsistencyDat::MonTTConsistencyDat ( )

Definition at line 10 of file MonTTConsistencyDat.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

◆ ~MonTTConsistencyDat()

MonTTConsistencyDat::~MonTTConsistencyDat ( )
override

Definition at line 25 of file MonTTConsistencyDat.cc.

25 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 76 of file MonTTConsistencyDat.cc.

References MillePedeFileConverter_cfg::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("MonTTConsistencyDat::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_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, MonTTConsistencyDat> 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("MonTTConsistencyDat::fetchData(): " + e.getMessage()));
122  }
123 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void setProblematicEvents(int prob)
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void setProblemsLV1(int LV1)
void setProblemsSize(int size)
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
void setProcessedEvents(int proc)
void setProblemsBunchX(int bunchX)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
void setTaskStatus(bool status)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23

◆ getProblematicEvents()

int MonTTConsistencyDat::getProblematicEvents ( ) const
inline

Definition at line 25 of file MonTTConsistencyDat.h.

References m_problematicEvents.

Referenced by writeArrayDB().

◆ getProblemsBunchX()

int MonTTConsistencyDat::getProblemsBunchX ( ) const
inline

Definition at line 37 of file MonTTConsistencyDat.h.

References m_problemsBunchX.

Referenced by writeArrayDB().

◆ getProblemsID()

int MonTTConsistencyDat::getProblemsID ( ) const
inline

Definition at line 28 of file MonTTConsistencyDat.h.

References m_problemsID.

Referenced by writeArrayDB().

28 { return m_problemsID; }

◆ getProblemsLV1()

int MonTTConsistencyDat::getProblemsLV1 ( ) const
inline

Definition at line 34 of file MonTTConsistencyDat.h.

References m_problemsLV1.

Referenced by writeArrayDB().

◆ getProblemsSize()

int MonTTConsistencyDat::getProblemsSize ( ) const
inline

Definition at line 31 of file MonTTConsistencyDat.h.

References m_problemsSize.

Referenced by writeArrayDB().

◆ getProcessedEvents()

int MonTTConsistencyDat::getProcessedEvents ( ) const
inline

Definition at line 22 of file MonTTConsistencyDat.h.

References m_processedEvents.

Referenced by writeArrayDB().

◆ getTable()

std::string MonTTConsistencyDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file MonTTConsistencyDat.h.

19 { return "MON_TT_CONSISTENCY_DAT"; }

◆ getTaskStatus()

bool MonTTConsistencyDat::getTaskStatus ( ) const
inline

Definition at line 40 of file MonTTConsistencyDat.h.

References m_taskStatus.

Referenced by writeArrayDB().

40 { return m_taskStatus; }

◆ prepareWrite()

void MonTTConsistencyDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 27 of file MonTTConsistencyDat.cc.

References MillePedeFileConverter_cfg::e.

27  {
28  this->checkConnection();
29 
30  try {
31  m_writeStmt = m_conn->createStatement();
32  m_writeStmt->setSQL(
33  "INSERT INTO mon_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("MonTTConsistencyDat::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

◆ setProblematicEvents()

void MonTTConsistencyDat::setProblematicEvents ( int  prob)
inline

◆ setProblemsBunchX()

void MonTTConsistencyDat::setProblemsBunchX ( int  bunchX)
inline

Definition at line 36 of file MonTTConsistencyDat.h.

References m_problemsBunchX.

Referenced by fetchData().

36 { m_problemsBunchX = bunchX; }

◆ setProblemsID()

void MonTTConsistencyDat::setProblemsID ( int  id)
inline

Definition at line 27 of file MonTTConsistencyDat.h.

References l1ctLayer2EG_cff::id, and m_problemsID.

Referenced by fetchData().

◆ setProblemsLV1()

void MonTTConsistencyDat::setProblemsLV1 ( int  LV1)
inline

Definition at line 33 of file MonTTConsistencyDat.h.

References m_problemsLV1.

Referenced by fetchData().

◆ setProblemsSize()

void MonTTConsistencyDat::setProblemsSize ( int  size)
inline

Definition at line 30 of file MonTTConsistencyDat.h.

References m_problemsSize, and findQualityFiles::size.

Referenced by fetchData().

◆ setProcessedEvents()

void MonTTConsistencyDat::setProcessedEvents ( int  proc)
inline

◆ setTaskStatus()

void MonTTConsistencyDat::setTaskStatus ( bool  status)
inline

Definition at line 39 of file MonTTConsistencyDat.h.

References m_taskStatus, and mps_update::status.

Referenced by fetchData().

◆ writeArrayDB()

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

Definition at line 125 of file MonTTConsistencyDat.cc.

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

126  {
127  this->checkConnection();
128  this->checkPrepare();
129 
130  int iovID = iov->fetchID();
131  if (!iovID) {
132  throw(std::runtime_error("MonTTConsistencyDat::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 MonTTConsistencyDat* dataitem;
158  int count = 0;
159  typedef map<EcalLogicID, MonTTConsistencyDat>::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("MonTTConsistencyDat::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("MonTTConsistencyDat::writeArrayDB(): " + e.getMessage()));
236  }
237 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
int getProcessedEvents() const
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
Definition: TTTypes.h:54
int getLogicID() const
Definition: EcalLogicID.cc:28
int getProblematicEvents() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

◆ writeDB()

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

Definition at line 43 of file MonTTConsistencyDat.cc.

References MillePedeFileConverter_cfg::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("MonTTConsistencyDat::writeDB: IOV not in DB"));
52  }
53 
54  int logicID = ecid->getLogicID();
55  if (!logicID) {
56  throw(std::runtime_error("MonTTConsistencyDat::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("MonTTConsistencyDat::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

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonTTConsistencyDat.h.

Member Data Documentation

◆ m_problematicEvents

int MonTTConsistencyDat::m_problematicEvents
private

Definition at line 53 of file MonTTConsistencyDat.h.

Referenced by getProblematicEvents(), and setProblematicEvents().

◆ m_problemsBunchX

int MonTTConsistencyDat::m_problemsBunchX
private

Definition at line 57 of file MonTTConsistencyDat.h.

Referenced by getProblemsBunchX(), and setProblemsBunchX().

◆ m_problemsID

int MonTTConsistencyDat::m_problemsID
private

Definition at line 54 of file MonTTConsistencyDat.h.

Referenced by getProblemsID(), and setProblemsID().

◆ m_problemsLV1

int MonTTConsistencyDat::m_problemsLV1
private

Definition at line 56 of file MonTTConsistencyDat.h.

Referenced by getProblemsLV1(), and setProblemsLV1().

◆ m_problemsSize

int MonTTConsistencyDat::m_problemsSize
private

Definition at line 55 of file MonTTConsistencyDat.h.

Referenced by getProblemsSize(), and setProblemsSize().

◆ m_processedEvents

int MonTTConsistencyDat::m_processedEvents
private

Definition at line 52 of file MonTTConsistencyDat.h.

Referenced by getProcessedEvents(), and setProcessedEvents().

◆ m_taskStatus

bool MonTTConsistencyDat::m_taskStatus
private

Definition at line 58 of file MonTTConsistencyDat.h.

Referenced by getTaskStatus(), and setTaskStatus().