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 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 MonCrystalConsistencyDat.h.

Constructor & Destructor Documentation

MonCrystalConsistencyDat::MonCrystalConsistencyDat ( )

Definition at line 10 of file MonCrystalConsistencyDat.cc.

11 {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_readStmt = nullptr;
16 
19  m_problemsID = 0;
22  m_taskStatus = false;
23 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
MonCrystalConsistencyDat::~MonCrystalConsistencyDat ( )
override

Definition at line 27 of file MonCrystalConsistencyDat.cc.

28 {
29 }

Member Function Documentation

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

Definition at line 79 of file MonCrystalConsistencyDat.cc.

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

Referenced by getTaskStatus().

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

Definition at line 25 of file MonCrystalConsistencyDat.h.

References m_problematicEvents.

Referenced by writeArrayDB().

int MonCrystalConsistencyDat::getProblemsGainSwitch ( ) const
inline

Definition at line 34 of file MonCrystalConsistencyDat.h.

References m_problemsGainSwitch.

Referenced by writeArrayDB().

int MonCrystalConsistencyDat::getProblemsGainZero ( ) const
inline
int MonCrystalConsistencyDat::getProblemsID ( ) const
inline

Definition at line 28 of file MonCrystalConsistencyDat.h.

References m_problemsID.

Referenced by writeArrayDB().

int MonCrystalConsistencyDat::getProcessedEvents ( ) const
inline

Definition at line 22 of file MonCrystalConsistencyDat.h.

References m_processedEvents.

Referenced by writeArrayDB().

std::string MonCrystalConsistencyDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file MonCrystalConsistencyDat.h.

19 { return "MON_CRYSTAL_CONSISTENCY_DAT"; }
bool MonCrystalConsistencyDat::getTaskStatus ( ) const
inline
void MonCrystalConsistencyDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 33 of file MonCrystalConsistencyDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getTaskStatus().

35 {
36  this->checkConnection();
37 
38  try {
39  m_writeStmt = m_conn->createStatement();
40  m_writeStmt->setSQL("INSERT INTO mon_crystal_consistency_dat (iov_id, logic_id, "
41  "processed_events, problematic_events, problems_id, problems_gain_zero, problems_gain_switch, task_status) "
42  "VALUES (:iov_id, :logic_id, "
43  ":3, :4, :5, :6, :7, :8)");
44  } catch (SQLException &e) {
45  throw(std::runtime_error(std::string("MonCrystalConsistencyDat::prepareWrite(): ")+getOraMessage(&e)));
46  }
47 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void MonCrystalConsistencyDat::setProblematicEvents ( int  prob)
inline
void MonCrystalConsistencyDat::setProblemsGainSwitch ( int  prob)
inline
void MonCrystalConsistencyDat::setProblemsGainZero ( int  prob)
inline
void MonCrystalConsistencyDat::setProblemsID ( int  id)
inline
void MonCrystalConsistencyDat::setProcessedEvents ( int  proc)
inline

Definition at line 21 of file MonCrystalConsistencyDat.h.

References m_processedEvents, and proc.

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

TrainProcessor *const proc
Definition: MVATrainer.cc:101
void MonCrystalConsistencyDat::setTaskStatus ( bool  status)
inline
void MonCrystalConsistencyDat::writeArrayDB ( const std::map< EcalLogicID, MonCrystalConsistencyDat > *  data,
MonRunIOV iov 
)
privatenoexcept

Definition at line 128 of file MonCrystalConsistencyDat.cc.

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

Referenced by getTaskStatus().

130 {
131  this->checkConnection();
132  this->checkPrepare();
133 
134  int iovID = iov->fetchID();
135  if (!iovID) { throw(std::runtime_error("MonCrystalConsistencyDat::writeArrayDB: IOV not in DB")); }
136 
137 
138  int nrows=data->size();
139  int* ids= new int[nrows];
140  int* iovid_vec= new int[nrows];
141  int* xx= new int[nrows];
142  int* yy= new int[nrows];
143  int* zz= new int[nrows];
144  int* ww= new int[nrows];
145  int* uu= new int[nrows];
146  int* st= new int[nrows];
147 
148  ub2* ids_len= new ub2[nrows];
149  ub2* iov_len= new ub2[nrows];
150  ub2* x_len= new ub2[nrows];
151  ub2* y_len= new ub2[nrows];
152  ub2* z_len= new ub2[nrows];
153  ub2* w_len= new ub2[nrows];
154  ub2* u_len= new ub2[nrows];
155  ub2* st_len= new ub2[nrows];
156 
157  const EcalLogicID* channel;
158  const MonCrystalConsistencyDat* dataitem;
159  int count=0;
160  typedef map< EcalLogicID, MonCrystalConsistencyDat >::const_iterator CI;
161  for (CI p = data->begin(); p != data->end(); ++p) {
162  channel = &(p->first);
163  int logicID = channel->getLogicID();
164  if (!logicID) { throw(std::runtime_error("MonCrystalConsistencyDat::writeArrayDB: Bad EcalLogicID")); }
165  ids[count]=logicID;
166  iovid_vec[count]=iovID;
167 
168  dataitem = &(p->second);
169  // dataIface.writeDB( channel, dataitem, iov);
170  int x=dataitem->getProcessedEvents();
171  int y=dataitem->getProblematicEvents();
172  int z=dataitem->getProblemsID();
173  int w=dataitem->getProblemsGainZero();
174  int u=dataitem->getProblemsGainSwitch();
175  int statu=dataitem->getTaskStatus();
176 
177 
178 
179  xx[count]=x;
180  yy[count]=y;
181  zz[count]=z;
182  ww[count]=w;
183  uu[count]=u;
184  st[count]=statu;
185 
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  st_len[count]=sizeof(st[count]);
196 
197  count++;
198  }
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*)st, OCCIINT , sizeof(st[0]), st_len );
210 
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 [] st;
222 
223  delete [] ids_len;
224  delete [] iov_len;
225  delete [] x_len;
226  delete [] y_len;
227  delete [] z_len;
228  delete [] w_len;
229  delete [] u_len;
230  delete [] st_len;
231 
232 
233 
234  } catch (SQLException &e) {
235  throw(std::runtime_error(std::string("MonCrystalConsistencyDat::writeArrayDB(): ")+getOraMessage(&e)));
236  }
237 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
const double w
Definition: UKUtility.cc:23
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:118
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int getLogicID() const
Definition: EcalLogicID.cc:41
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void MonCrystalConsistencyDat::writeDB ( const EcalLogicID ecid,
const MonCrystalConsistencyDat item,
MonRunIOV iov 
)
privatenoexcept

Definition at line 51 of file MonCrystalConsistencyDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getTaskStatus().

53 {
54  this->checkConnection();
55  this->checkPrepare();
56 
57  int iovID = iov->fetchID();
58  if (!iovID) { throw(std::runtime_error("MonCrystalConsistencyDat::writeDB: IOV not in DB")); }
59 
60  int logicID = ecid->getLogicID();
61  if (!logicID) { throw(std::runtime_error("MonCrystalConsistencyDat::writeDB: Bad EcalLogicID")); }
62 
63  try {
64  m_writeStmt->setInt(1, iovID);
65  m_writeStmt->setInt(2, logicID);
66 
67  m_writeStmt->setInt(3, item->getProcessedEvents() );
68  m_writeStmt->setInt(4, item->getProblematicEvents() );
69  m_writeStmt->setInt(5, item->getProblemsID() );
70  m_writeStmt->setInt(6, item->getProblemsGainZero() );
71  m_writeStmt->setInt(7, item->getProblemsGainSwitch() );
72  m_writeStmt->setInt(8, item->getTaskStatus() );
73  m_writeStmt->executeUpdate();
74  } catch (SQLException &e) {
75  throw(std::runtime_error(std::string("MonCrystalConsistencyDat::writeDB(): ")+getOraMessage(&e)));
76  }
77 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:118
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int getLogicID() const
Definition: EcalLogicID.cc:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonCrystalConsistencyDat.h.

Member Data Documentation

int MonCrystalConsistencyDat::m_problematicEvents
private

Definition at line 55 of file MonCrystalConsistencyDat.h.

Referenced by getProblematicEvents(), and setProblematicEvents().

int MonCrystalConsistencyDat::m_problemsGainSwitch
private

Definition at line 58 of file MonCrystalConsistencyDat.h.

Referenced by getProblemsGainSwitch(), and setProblemsGainSwitch().

int MonCrystalConsistencyDat::m_problemsGainZero
private

Definition at line 57 of file MonCrystalConsistencyDat.h.

Referenced by getProblemsGainZero(), and setProblemsGainZero().

int MonCrystalConsistencyDat::m_problemsID
private

Definition at line 56 of file MonCrystalConsistencyDat.h.

Referenced by getProblemsID(), and setProblemsID().

int MonCrystalConsistencyDat::m_processedEvents
private

Definition at line 54 of file MonCrystalConsistencyDat.h.

Referenced by getProcessedEvents(), and setProcessedEvents().

bool MonCrystalConsistencyDat::m_taskStatus
private

Definition at line 59 of file MonCrystalConsistencyDat.h.

Referenced by getTaskStatus(), and setTaskStatus().