CMS 3D CMS Logo

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

#include <MonCrystalConsistencyDat.h>

Inheritance diagram for MonCrystalConsistencyDat:
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
 
 MonCrystalConsistencyDat ()
 
void setProblematicEvents (int prob)
 
void setProblemsGainSwitch (int prob)
 
void setProblemsGainZero (int prob)
 
void setProblemsID (int id)
 
void setProcessedEvents (int proc)
 
void setTaskStatus (bool status)
 
 ~MonCrystalConsistencyDat () 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, MonCrystalConsistencyDat > *fillVec, MonRunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, MonCrystalConsistencyDat > *data, MonRunIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const MonCrystalConsistencyDat *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 const int 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 MonCrystalConsistencyDat.h.

Constructor & Destructor Documentation

◆ MonCrystalConsistencyDat()

MonCrystalConsistencyDat::MonCrystalConsistencyDat ( )

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

◆ ~MonCrystalConsistencyDat()

MonCrystalConsistencyDat::~MonCrystalConsistencyDat ( )
override

Definition at line 24 of file MonCrystalConsistencyDat.cc.

24 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 73 of file MonCrystalConsistencyDat.cc.

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("MonCrystalConsistencyDat::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_crystal_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, MonCrystalConsistencyDat> 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 
117  } catch (SQLException& e) {
118  throw(std::runtime_error("MonCrystalConsistencyDat::fetchData(): " + e.getMessage()));
119  }
120 }

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

◆ getProblematicEvents()

int MonCrystalConsistencyDat::getProblematicEvents ( ) const
inline

Definition at line 25 of file MonCrystalConsistencyDat.h.

25 { return m_problematicEvents; }

References m_problematicEvents.

Referenced by writeArrayDB().

◆ getProblemsGainSwitch()

int MonCrystalConsistencyDat::getProblemsGainSwitch ( ) const
inline

Definition at line 34 of file MonCrystalConsistencyDat.h.

34 { return m_problemsGainSwitch; }

References m_problemsGainSwitch.

Referenced by writeArrayDB().

◆ getProblemsGainZero()

int MonCrystalConsistencyDat::getProblemsGainZero ( ) const
inline

◆ getProblemsID()

int MonCrystalConsistencyDat::getProblemsID ( ) const
inline

Definition at line 28 of file MonCrystalConsistencyDat.h.

28 { return m_problemsID; }

References m_problemsID.

Referenced by writeArrayDB().

◆ getProcessedEvents()

int MonCrystalConsistencyDat::getProcessedEvents ( ) const
inline

Definition at line 22 of file MonCrystalConsistencyDat.h.

22 { return m_processedEvents; }

References m_processedEvents.

Referenced by writeArrayDB().

◆ getTable()

std::string MonCrystalConsistencyDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file MonCrystalConsistencyDat.h.

19 { return "MON_CRYSTAL_CONSISTENCY_DAT"; }

◆ getTaskStatus()

bool MonCrystalConsistencyDat::getTaskStatus ( ) const
inline

Definition at line 37 of file MonCrystalConsistencyDat.h.

37 { return m_taskStatus; }

References m_taskStatus.

Referenced by writeArrayDB().

◆ prepareWrite()

void MonCrystalConsistencyDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 26 of file MonCrystalConsistencyDat.cc.

26  {
27  this->checkConnection();
28 
29  try {
30  m_writeStmt = m_conn->createStatement();
31  m_writeStmt->setSQL(
32  "INSERT INTO mon_crystal_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("MonCrystalConsistencyDat::prepareWrite(): " + e.getMessage()));
38  }
39 }

References MillePedeFileConverter_cfg::e.

◆ setProblematicEvents()

void MonCrystalConsistencyDat::setProblematicEvents ( int  prob)
inline

Definition at line 24 of file MonCrystalConsistencyDat.h.

References m_problematicEvents, and TtFullHadEvtBuilder_cfi::prob.

Referenced by fetchData().

◆ setProblemsGainSwitch()

void MonCrystalConsistencyDat::setProblemsGainSwitch ( int  prob)
inline

Definition at line 33 of file MonCrystalConsistencyDat.h.

References m_problemsGainSwitch, and TtFullHadEvtBuilder_cfi::prob.

Referenced by fetchData().

◆ setProblemsGainZero()

void MonCrystalConsistencyDat::setProblemsGainZero ( int  prob)
inline

Definition at line 30 of file MonCrystalConsistencyDat.h.

References m_problemsGainZero, and TtFullHadEvtBuilder_cfi::prob.

Referenced by fetchData().

◆ setProblemsID()

void MonCrystalConsistencyDat::setProblemsID ( int  id)
inline

Definition at line 27 of file MonCrystalConsistencyDat.h.

27 { m_problemsID = id; }

References triggerObjects_cff::id, and m_problemsID.

Referenced by fetchData().

◆ setProcessedEvents()

void MonCrystalConsistencyDat::setProcessedEvents ( int  proc)
inline

Definition at line 21 of file MonCrystalConsistencyDat.h.

References m_processedEvents, and ValidateTausOnZEEFastSim_cff::proc.

Referenced by fetchData().

◆ setTaskStatus()

void MonCrystalConsistencyDat::setTaskStatus ( bool  status)
inline

Definition at line 36 of file MonCrystalConsistencyDat.h.

36 { m_taskStatus = status; }

References m_taskStatus, and mps_update::status.

Referenced by fetchData().

◆ writeArrayDB()

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

Definition at line 122 of file MonCrystalConsistencyDat.cc.

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

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.

◆ writeDB()

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

Definition at line 41 of file MonCrystalConsistencyDat.cc.

43  {
44  this->checkConnection();
45  this->checkPrepare();
46 
47  int iovID = iov->fetchID();
48  if (!iovID) {
49  throw(std::runtime_error("MonCrystalConsistencyDat::writeDB: IOV not in DB"));
50  }
51 
52  int logicID = ecid->getLogicID();
53  if (!logicID) {
54  throw(std::runtime_error("MonCrystalConsistencyDat::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("MonCrystalConsistencyDat::writeDB(): " + e.getMessage()));
70  }
71 }

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonCrystalConsistencyDat.h.

Member Data Documentation

◆ m_problematicEvents

int MonCrystalConsistencyDat::m_problematicEvents
private

Definition at line 50 of file MonCrystalConsistencyDat.h.

Referenced by getProblematicEvents(), and setProblematicEvents().

◆ m_problemsGainSwitch

int MonCrystalConsistencyDat::m_problemsGainSwitch
private

Definition at line 53 of file MonCrystalConsistencyDat.h.

Referenced by getProblemsGainSwitch(), and setProblemsGainSwitch().

◆ m_problemsGainZero

int MonCrystalConsistencyDat::m_problemsGainZero
private

Definition at line 52 of file MonCrystalConsistencyDat.h.

Referenced by getProblemsGainZero(), and setProblemsGainZero().

◆ m_problemsID

int MonCrystalConsistencyDat::m_problemsID
private

Definition at line 51 of file MonCrystalConsistencyDat.h.

Referenced by getProblemsID(), and setProblemsID().

◆ m_processedEvents

int MonCrystalConsistencyDat::m_processedEvents
private

Definition at line 49 of file MonCrystalConsistencyDat.h.

Referenced by getProcessedEvents(), and setProcessedEvents().

◆ m_taskStatus

bool MonCrystalConsistencyDat::m_taskStatus
private

Definition at line 54 of file MonCrystalConsistencyDat.h.

Referenced by getTaskStatus(), and setTaskStatus().

DDAxes::y
MonCrystalConsistencyDat::m_problemsGainSwitch
int m_problemsGainSwitch
Definition: MonCrystalConsistencyDat.h:53
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
MonRunIOV::fetchID
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
MonCrystalConsistencyDat::getProcessedEvents
int getProcessedEvents() const
Definition: MonCrystalConsistencyDat.h:22
MonCrystalConsistencyDat::setProcessedEvents
void setProcessedEvents(int proc)
Definition: MonCrystalConsistencyDat.h:21
mps_update.status
status
Definition: mps_update.py:69
MonCrystalConsistencyDat::getProblemsGainZero
int getProblemsGainZero() const
Definition: MonCrystalConsistencyDat.h:31
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MonCrystalConsistencyDat::setTaskStatus
void setTaskStatus(bool status)
Definition: MonCrystalConsistencyDat.h:36
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
DDAxes::x
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
MonCrystalConsistencyDat::getProblematicEvents
int getProblematicEvents() const
Definition: MonCrystalConsistencyDat.h:25
IDataItem::m_writeStmt
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
w
const double w
Definition: UKUtility.cc:23
MonCrystalConsistencyDat::setProblemsGainZero
void setProblemsGainZero(int prob)
Definition: MonCrystalConsistencyDat.h:30
DDAxes::z
EcalLogicID
Definition: EcalLogicID.h:7
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
MonCrystalConsistencyDat::m_problemsGainZero
int m_problemsGainZero
Definition: MonCrystalConsistencyDat.h:52
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
ValidateTausOnZEEFastSim_cff.proc
proc
Definition: ValidateTausOnZEEFastSim_cff.py:6
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
MonCrystalConsistencyDat::setProblematicEvents
void setProblematicEvents(int prob)
Definition: MonCrystalConsistencyDat.h:24
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
MonCrystalConsistencyDat::m_processedEvents
int m_processedEvents
Definition: MonCrystalConsistencyDat.h:49
MonCrystalConsistencyDat::setProblemsGainSwitch
void setProblemsGainSwitch(int prob)
Definition: MonCrystalConsistencyDat.h:33
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
MonCrystalConsistencyDat
Definition: MonCrystalConsistencyDat.h:12
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
MonCrystalConsistencyDat::m_problematicEvents
int m_problematicEvents
Definition: MonCrystalConsistencyDat.h:50
MonCrystalConsistencyDat::m_taskStatus
bool m_taskStatus
Definition: MonCrystalConsistencyDat.h:54
MonCrystalConsistencyDat::getProblemsID
int getProblemsID() const
Definition: MonCrystalConsistencyDat.h:28
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
MonCrystalConsistencyDat::m_problemsID
int m_problemsID
Definition: MonCrystalConsistencyDat.h:51
MonCrystalConsistencyDat::getProblemsGainSwitch
int getProblemsGainSwitch() const
Definition: MonCrystalConsistencyDat.h:34
TtFullHadEvtBuilder_cfi.prob
prob
Definition: TtFullHadEvtBuilder_cfi.py:33
MonCrystalConsistencyDat::setProblemsID
void setProblemsID(int id)
Definition: MonCrystalConsistencyDat.h:27
MonCrystalConsistencyDat::getTaskStatus
bool getTaskStatus() const
Definition: MonCrystalConsistencyDat.h:37
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37