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
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 ()
 
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 ()
 
- 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) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::map< EcalLogicID, MonTTConsistencyDat > *data, MonRunIOV *iov) throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const MonTTConsistencyDat *item, MonRunIOV *iov) throw (std::runtime_error)
 

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 () 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 MonTTConsistencyDat.h.

Constructor & Destructor Documentation

MonTTConsistencyDat::MonTTConsistencyDat ( )

Definition at line 10 of file MonTTConsistencyDat.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;
20  m_problemsSize = 0;
21  m_problemsLV1 = 0;
22  m_problemsBunchX = 0;
23  m_taskStatus = 0;
24 }
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
MonTTConsistencyDat::~MonTTConsistencyDat ( )

Definition at line 28 of file MonTTConsistencyDat.cc.

29 {
30 }

Member Function Documentation

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

Definition at line 83 of file MonTTConsistencyDat.cc.

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

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

Definition at line 25 of file MonTTConsistencyDat.h.

References m_problematicEvents.

Referenced by writeArrayDB().

int MonTTConsistencyDat::getProblemsBunchX ( ) const
inline

Definition at line 37 of file MonTTConsistencyDat.h.

References m_problemsBunchX.

Referenced by writeArrayDB().

int MonTTConsistencyDat::getProblemsID ( ) const
inline

Definition at line 28 of file MonTTConsistencyDat.h.

References m_problemsID.

Referenced by writeArrayDB().

28 { return m_problemsID; }
int MonTTConsistencyDat::getProblemsLV1 ( ) const
inline

Definition at line 34 of file MonTTConsistencyDat.h.

References m_problemsLV1.

Referenced by writeArrayDB().

34 { return m_problemsLV1; }
int MonTTConsistencyDat::getProblemsSize ( ) const
inline

Definition at line 31 of file MonTTConsistencyDat.h.

References m_problemsSize.

Referenced by writeArrayDB().

31 { return m_problemsSize; }
int MonTTConsistencyDat::getProcessedEvents ( ) const
inline

Definition at line 22 of file MonTTConsistencyDat.h.

References m_processedEvents.

Referenced by writeArrayDB().

std::string MonTTConsistencyDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 19 of file MonTTConsistencyDat.h.

19 { return "MON_TT_CONSISTENCY_DAT"; }
bool MonTTConsistencyDat::getTaskStatus ( ) const
inline

Definition at line 40 of file MonTTConsistencyDat.h.

References m_taskStatus.

Referenced by writeArrayDB().

40 { return m_taskStatus; }
void MonTTConsistencyDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 34 of file MonTTConsistencyDat.cc.

References alignCSCRings::e.

36 {
37  this->checkConnection();
38 
39  try {
40  m_writeStmt = m_conn->createStatement();
41  m_writeStmt->setSQL("INSERT INTO mon_tt_consistency_dat (iov_id, logic_id, "
42  "processed_events, problematic_events, problems_id, problems_size, problems_LV1, problems_bunch_X, task_status) "
43  "VALUES (:iov_id, :logic_id, "
44  ":3, :4, :5, :6, :7, :8, :9)");
45  } catch (SQLException &e) {
46  throw(std::runtime_error("MonTTConsistencyDat::prepareWrite(): "+e.getMessage()));
47  }
48 }
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 MonTTConsistencyDat::setProblematicEvents ( int  prob)
inline
void MonTTConsistencyDat::setProblemsBunchX ( int  bunchX)
inline

Definition at line 36 of file MonTTConsistencyDat.h.

References m_problemsBunchX.

Referenced by fetchData().

36 { m_problemsBunchX = bunchX; }
void MonTTConsistencyDat::setProblemsID ( int  id)
inline

Definition at line 27 of file MonTTConsistencyDat.h.

References m_problemsID.

Referenced by fetchData().

void MonTTConsistencyDat::setProblemsLV1 ( int  LV1)
inline

Definition at line 33 of file MonTTConsistencyDat.h.

References m_problemsLV1.

Referenced by fetchData().

void MonTTConsistencyDat::setProblemsSize ( int  size)
inline

Definition at line 30 of file MonTTConsistencyDat.h.

References m_problemsSize, and findQualityFiles::size.

Referenced by fetchData().

30 { m_problemsSize = size; }
tuple size
Write out results.
void MonTTConsistencyDat::setProcessedEvents ( int  proc)
inline

Definition at line 21 of file MonTTConsistencyDat.h.

References m_processedEvents, and proc.

Referenced by fetchData().

TrainProcessor *const proc
Definition: MVATrainer.cc:101
void MonTTConsistencyDat::setTaskStatus ( bool  status)
inline

Definition at line 39 of file MonTTConsistencyDat.h.

References m_taskStatus, and ntuplemaker::status.

Referenced by fetchData().

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

Definition at line 132 of file MonTTConsistencyDat.cc.

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

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

Definition at line 52 of file MonTTConsistencyDat.cc.

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

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

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonTTConsistencyDat.h.

Member Data Documentation

int MonTTConsistencyDat::m_problematicEvents
private

Definition at line 57 of file MonTTConsistencyDat.h.

Referenced by getProblematicEvents(), and setProblematicEvents().

int MonTTConsistencyDat::m_problemsBunchX
private

Definition at line 61 of file MonTTConsistencyDat.h.

Referenced by getProblemsBunchX(), and setProblemsBunchX().

int MonTTConsistencyDat::m_problemsID
private

Definition at line 58 of file MonTTConsistencyDat.h.

Referenced by getProblemsID(), and setProblemsID().

int MonTTConsistencyDat::m_problemsLV1
private

Definition at line 60 of file MonTTConsistencyDat.h.

Referenced by getProblemsLV1(), and setProblemsLV1().

int MonTTConsistencyDat::m_problemsSize
private

Definition at line 59 of file MonTTConsistencyDat.h.

Referenced by getProblemsSize(), and setProblemsSize().

int MonTTConsistencyDat::m_processedEvents
private

Definition at line 56 of file MonTTConsistencyDat.h.

Referenced by getProcessedEvents(), and setProcessedEvents().

bool MonTTConsistencyDat::m_taskStatus
private

Definition at line 62 of file MonTTConsistencyDat.h.

Referenced by getTaskStatus(), and setTaskStatus().