CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
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 ()
 
- 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) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::map< EcalLogicID, MonMemChConsistencyDat > *data, MonRunIOV *iov) throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const MonMemChConsistencyDat *item, MonRunIOV *iov) throw (std::runtime_error)
 

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 () throw (std::runtime_error)
 
void createReadStatement () throw (std::runtime_error)
 
void setPrefetchRowCount (int ncount) throw (std::runtime_error)
 
void terminateReadStatement () throw (std::runtime_error)
 
void terminateWriteStatement () throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 
- 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 ( )

Definition at line 10 of file MonMemChConsistencyDat.cc.

References NULL.

11 {
12  m_env = NULL;
13  m_conn = NULL;
14  m_writeStmt = NULL;
15  m_readStmt = NULL;
16 
19  m_problemsID = 0;
22  m_taskStatus = 0;
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
#define NULL
Definition: scimark2.h:8
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
MonMemChConsistencyDat::~MonMemChConsistencyDat ( )

Definition at line 27 of file MonMemChConsistencyDat.cc.

28 {
29 }

Member Function Documentation

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

Definition at line 81 of file MonMemChConsistencyDat.cc.

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

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

Definition at line 25 of file MonMemChConsistencyDat.h.

References m_problematicEvents.

Referenced by writeArrayDB().

int MonMemChConsistencyDat::getProblemsGainSwitch ( ) const
inline

Definition at line 34 of file MonMemChConsistencyDat.h.

References m_problemsGainSwitch.

Referenced by writeArrayDB().

int MonMemChConsistencyDat::getProblemsGainZero ( ) const
inline

Definition at line 31 of file MonMemChConsistencyDat.h.

References m_problemsGainZero.

Referenced by writeArrayDB().

int MonMemChConsistencyDat::getProblemsID ( ) const
inline

Definition at line 28 of file MonMemChConsistencyDat.h.

References m_problemsID.

Referenced by writeArrayDB().

int MonMemChConsistencyDat::getProcessedEvents ( ) const
inline

Definition at line 22 of file MonMemChConsistencyDat.h.

References m_processedEvents.

Referenced by writeArrayDB().

std::string MonMemChConsistencyDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 19 of file MonMemChConsistencyDat.h.

19 { return "MON_MEM_CH_CONSISTENCY_DAT"; }
bool MonMemChConsistencyDat::getTaskStatus ( ) const
inline

Definition at line 37 of file MonMemChConsistencyDat.h.

References m_taskStatus.

Referenced by writeArrayDB().

void MonMemChConsistencyDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 33 of file MonMemChConsistencyDat.cc.

References alignCSCRings::e.

35 {
36  this->checkConnection();
37 
38  try {
39  m_writeStmt = m_conn->createStatement();
40  m_writeStmt->setSQL("INSERT INTO mon_mem_ch_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("MonMemChConsistencyDat::prepareWrite(): "+e.getMessage()));
46  }
47 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const
Definition: IDBObject.h:41
void MonMemChConsistencyDat::setProblematicEvents ( int  prob)
inline

Definition at line 24 of file MonMemChConsistencyDat.h.

References m_problematicEvents.

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

void MonMemChConsistencyDat::setProblemsGainSwitch ( int  prob)
inline

Definition at line 33 of file MonMemChConsistencyDat.h.

References m_problemsGainSwitch.

Referenced by fetchData().

void MonMemChConsistencyDat::setProblemsGainZero ( int  prob)
inline

Definition at line 30 of file MonMemChConsistencyDat.h.

References m_problemsGainZero.

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

void MonMemChConsistencyDat::setProblemsID ( int  id)
inline

Definition at line 27 of file MonMemChConsistencyDat.h.

References m_problemsID.

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

void MonMemChConsistencyDat::setProcessedEvents ( int  proc)
inline

Definition at line 21 of file MonMemChConsistencyDat.h.

References m_processedEvents, and proc.

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

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

Definition at line 129 of file MonMemChConsistencyDat.cc.

References prof2calltree::count, data, alignCSCRings::e, EcalLogicID::getLogicID(), getProblematicEvents(), getProblemsGainSwitch(), getProblemsGainZero(), getProblemsID(), getProcessedEvents(), getTaskStatus(), o2o::iov, AlCaHLTBitMon_ParallelJobs::p, w, x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

131 {
132  this->checkConnection();
133  this->checkPrepare();
134 
135  int iovID = iov->fetchID();
136  if (!iovID) { throw(std::runtime_error("MonMemChConsistencyDat::writeArrayDB: IOV not in DB")); }
137 
138 
139  int nrows=data->size();
140  int* ids= new int[nrows];
141  int* iovid_vec= new int[nrows];
142  int* xx= new int[nrows];
143  int* yy= new int[nrows];
144  int* zz= new int[nrows];
145  int* ww= new int[nrows];
146  int* uu= new int[nrows];
147  int* st= new int[nrows];
148 
149  ub2* ids_len= new ub2[nrows];
150  ub2* iov_len= new ub2[nrows];
151  ub2* x_len= new ub2[nrows];
152  ub2* y_len= new ub2[nrows];
153  ub2* z_len= new ub2[nrows];
154  ub2* w_len= new ub2[nrows];
155  ub2* u_len= new ub2[nrows];
156  ub2* st_len= new ub2[nrows];
157 
158  const EcalLogicID* channel;
159  const MonMemChConsistencyDat* dataitem;
160  int count=0;
161  typedef map< EcalLogicID, MonMemChConsistencyDat >::const_iterator CI;
162  for (CI p = data->begin(); p != data->end(); ++p) {
163  channel = &(p->first);
164  int logicID = channel->getLogicID();
165  if (!logicID) { throw(std::runtime_error("MonMemChConsistencyDat::writeArrayDB: Bad EcalLogicID")); }
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->getProblemsGainZero();
175  int u=dataitem->getProblemsGainSwitch();
176  int statu=dataitem->getTaskStatus();
177 
178 
179 
180  xx[count]=x;
181  yy[count]=y;
182  zz[count]=z;
183  ww[count]=w;
184  uu[count]=u;
185  st[count]=statu;
186 
187 
188  ids_len[count]=sizeof(ids[count]);
189  iov_len[count]=sizeof(iovid_vec[count]);
190 
191  x_len[count]=sizeof(xx[count]);
192  y_len[count]=sizeof(yy[count]);
193  z_len[count]=sizeof(zz[count]);
194  w_len[count]=sizeof(ww[count]);
195  u_len[count]=sizeof(uu[count]);
196  st_len[count]=sizeof(st[count]);
197 
198  count++;
199  }
200 
201 
202  try {
203  m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]),iov_len);
204  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
205  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len );
206  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len );
207  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIINT , sizeof(zz[0]), z_len );
208  m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIINT , sizeof(ww[0]), w_len );
209  m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIINT , sizeof(uu[0]), u_len );
210  m_writeStmt->setDataBuffer(8, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len );
211 
212 
213  m_writeStmt->executeArrayUpdate(nrows);
214 
215  delete [] ids;
216  delete [] iovid_vec;
217  delete [] xx;
218  delete [] yy;
219  delete [] zz;
220  delete [] ww;
221  delete [] uu;
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 [] st_len;
232 
233 
234 
235  } catch (SQLException &e) {
236  throw(std::runtime_error("MonMemChConsistencyDat::writeArrayDB(): "+e.getMessage()));
237  }
238 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
const double w
Definition: UKUtility.cc:23
int fetchID()
Definition: MonRunIOV.cc:118
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
float float float z
int getLogicID() const
Definition: EcalLogicID.cc:41
void checkPrepare()
Definition: IDataItem.h:31
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Definition: DDAxes.h:10
void checkConnection() const
Definition: IDBObject.h:41
void MonMemChConsistencyDat::writeDB ( const EcalLogicID ecid,
const MonMemChConsistencyDat item,
MonRunIOV iov 
)
throw (std::runtime_error
)
private

Definition at line 51 of file MonMemChConsistencyDat.cc.

References alignCSCRings::e, and o2o::iov.

53 {
54  this->checkConnection();
55  this->checkPrepare();
56 
57  int iovID = iov->fetchID();
58  if (!iovID) { throw(std::runtime_error("MonMemChConsistencyDat::writeDB: IOV not in DB")); }
59 
60  int logicID = ecid->getLogicID();
61  if (!logicID) { throw(std::runtime_error("MonMemChConsistencyDat::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("MonMemChConsistencyDat::writeDB(): "+e.getMessage()));
76  }
77 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
int fetchID()
Definition: MonRunIOV.cc:118
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
int getLogicID() const
Definition: EcalLogicID.cc:41
void checkPrepare()
Definition: IDataItem.h:31
void checkConnection() const
Definition: IDBObject.h:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonMemChConsistencyDat.h.

Member Data Documentation

int MonMemChConsistencyDat::m_problematicEvents
private

Definition at line 55 of file MonMemChConsistencyDat.h.

Referenced by getProblematicEvents(), and setProblematicEvents().

int MonMemChConsistencyDat::m_problemsGainSwitch
private

Definition at line 58 of file MonMemChConsistencyDat.h.

Referenced by getProblemsGainSwitch(), and setProblemsGainSwitch().

int MonMemChConsistencyDat::m_problemsGainZero
private

Definition at line 57 of file MonMemChConsistencyDat.h.

Referenced by getProblemsGainZero(), and setProblemsGainZero().

int MonMemChConsistencyDat::m_problemsID
private

Definition at line 56 of file MonMemChConsistencyDat.h.

Referenced by getProblemsID(), and setProblemsID().

int MonMemChConsistencyDat::m_processedEvents
private

Definition at line 54 of file MonMemChConsistencyDat.h.

Referenced by getProcessedEvents(), and setProcessedEvents().

bool MonMemChConsistencyDat::m_taskStatus
private

Definition at line 59 of file MonMemChConsistencyDat.h.

Referenced by getTaskStatus(), and setTaskStatus().