CMS 3D CMS Logo

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

#include <MonDelaysTTDat.h>

Inheritance diagram for MonDelaysTTDat:
IDataItem IDBObject

Public Member Functions

float getDelayMean () const
 
float getDelayRMS () const
 
std::string getTable () override
 
bool getTaskStatus () const
 
 MonDelaysTTDat ()
 
void setDelayMean (float mean)
 
void setDelayRMS (float rms)
 
void setTaskStatus (bool status)
 
 ~MonDelaysTTDat () 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, MonDelaysTTDat > *fillVec, MonRunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, MonDelaysTTDat > *data, MonRunIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const MonDelaysTTDat *item, MonRunIOV *iov) noexcept(false)
 

Private Attributes

float m_delayMean
 
float m_delayRMS
 
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 MonDelaysTTDat.h.

Constructor & Destructor Documentation

MonDelaysTTDat::MonDelaysTTDat ( )

Definition at line 12 of file MonDelaysTTDat.cc.

13 {
14  m_env = nullptr;
15  m_conn = nullptr;
16  m_writeStmt = nullptr;
17  m_readStmt = nullptr;
18 
19  m_delayMean = 0;
20  m_delayRMS = 0;
21  m_taskStatus = false;
22 }
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
MonDelaysTTDat::~MonDelaysTTDat ( )
override

Definition at line 26 of file MonDelaysTTDat.cc.

27 {
28 }

Member Function Documentation

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

Definition at line 78 of file MonDelaysTTDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setDelayMean(), setDelayRMS(), setTaskStatus(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getTaskStatus().

80 {
81  this->checkConnection();
82  fillMap->clear();
83 
84  iov->setConnection(m_env, m_conn);
85  int iovID = iov->fetchID();
86  if (!iovID) {
87  // throw(std::runtime_error("MonDelaysTTDat::writeDB: IOV not in DB"));
88  return;
89  }
90 
91  try {
92 
93  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
94  "d.delay_mean, d.delay_rms, d.task_status "
95  "FROM channelview cv JOIN mon_delays_tt_dat d "
96  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
97  "WHERE d.iov_id = :iov_id");
98  m_readStmt->setInt(1, iovID);
99  ResultSet* rset = m_readStmt->executeQuery();
100 
101  std::pair< EcalLogicID, MonDelaysTTDat > p;
102  MonDelaysTTDat dat;
103  while(rset->next()) {
104  p.first = EcalLogicID( getOraString(rset,1), // name
105  rset->getInt(2), // logic_id
106  rset->getInt(3), // id1
107  rset->getInt(4), // id2
108  rset->getInt(5), // id3
109  getOraString(rset,6)); // maps_to
110 
111  dat.setDelayMean( rset->getFloat(7) );
112  dat.setDelayRMS( rset->getFloat(8) );
113  dat.setTaskStatus( rset->getInt(9) );
114 
115 
116  p.second = dat;
117  fillMap->insert(p);
118  }
119  } catch (SQLException &e) {
120  throw(std::runtime_error(std::string("MonDelaysTTDat::fetchData(): ")+getOraMessage(&e)));
121  }
122 }
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
void setDelayRMS(float rms)
void setTaskStatus(bool status)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
void setDelayMean(float mean)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
float MonDelaysTTDat::getDelayMean ( ) const
inline

Definition at line 22 of file MonDelaysTTDat.h.

References m_delayMean.

Referenced by writeArrayDB().

22 { return m_delayMean; }
float MonDelaysTTDat::getDelayRMS ( ) const
inline

Definition at line 25 of file MonDelaysTTDat.h.

References m_delayRMS.

Referenced by writeArrayDB().

25 { return m_delayRMS; }
std::string MonDelaysTTDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file MonDelaysTTDat.h.

19 { return "MON_DELAYS_TT_DAT"; }
bool MonDelaysTTDat::getTaskStatus ( ) const
inline

Definition at line 28 of file MonDelaysTTDat.h.

References data, fetchData(), m_taskStatus, noexcept, prepareWrite(), writeArrayDB(), and writeDB().

Referenced by writeArrayDB().

28 { return m_taskStatus; }
void MonDelaysTTDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 32 of file MonDelaysTTDat.cc.

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

Referenced by getTaskStatus().

34 {
35  this->checkConnection();
36 
37  try {
38  m_writeStmt = m_conn->createStatement();
39  m_writeStmt->setSQL("INSERT INTO mon_delays_tt_dat (iov_id, logic_id, "
40  "delay_mean, delay_rms, task_status) "
41  "VALUES (:iov_id, :logic_id, "
42  ":delay_mean, :delay_rms, :task_status)");
43  } catch (SQLException &e) {
44  throw(std::runtime_error(std::string("MonDelaysTTDat::prepareWrite(): ")+getOraMessage(&e)));
45  }
46 }
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 MonDelaysTTDat::setDelayMean ( float  mean)
inline

Definition at line 21 of file MonDelaysTTDat.h.

References m_delayMean, and SiStripPI::mean.

Referenced by fetchData().

void MonDelaysTTDat::setDelayRMS ( float  rms)
inline

Definition at line 24 of file MonDelaysTTDat.h.

References m_delayRMS, and SiStripPI::rms.

Referenced by fetchData().

void MonDelaysTTDat::setTaskStatus ( bool  status)
inline

Definition at line 27 of file MonDelaysTTDat.h.

References m_taskStatus, and mps_update::status.

Referenced by fetchData().

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

Definition at line 124 of file MonDelaysTTDat.cc.

References KineDebug3::count(), data, MillePedeFileConverter_cfg::e, getDelayMean(), getDelayRMS(), EcalLogicID::getLogicID(), getTaskStatus(), AlCaHLTBitMon_ParallelJobs::p, AlCaHLTBitMon_QueryRunRegistry::string, x, geometryCSVtoXML::xx, y, and geometryCSVtoXML::yy.

Referenced by getTaskStatus().

126 {
127  this->checkConnection();
128  this->checkPrepare();
129 
130  int iovID = iov->fetchID();
131  if (!iovID) { throw(std::runtime_error("MonDelaysTTDat::writeArrayDB: IOV not in DB")); }
132 
133 
134  int nrows=data->size();
135  int* ids= new int[nrows];
136  int* iovid_vec= new int[nrows];
137  float* xx= new float[nrows];
138  float* yy= new float[nrows];
139  int* st= new int[nrows];
140 
141  ub2* ids_len= new ub2[nrows];
142  ub2* iov_len= new ub2[nrows];
143  ub2* x_len= new ub2[nrows];
144  ub2* y_len= new ub2[nrows];
145  ub2* st_len= new ub2[nrows];
146 
147  const EcalLogicID* channel;
148  const MonDelaysTTDat* dataitem;
149  int count=0;
150  typedef map< EcalLogicID, MonDelaysTTDat >::const_iterator CI;
151  for (CI p = data->begin(); p != data->end(); ++p) {
152  channel = &(p->first);
153  int logicID = channel->getLogicID();
154  if (!logicID) { throw(std::runtime_error("MonDelaysTTDat::writeArrayDB: Bad EcalLogicID")); }
155  ids[count]=logicID;
156  iovid_vec[count]=iovID;
157 
158  dataitem = &(p->second);
159  // dataIface.writeDB( channel, dataitem, iov);
160  float x=dataitem->getDelayMean();
161  float y=dataitem->getDelayRMS();
162  int statu=dataitem->getTaskStatus();
163 
164 
165 
166  xx[count]=x;
167  yy[count]=y;
168  st[count]=statu;
169 
170 
171  ids_len[count]=sizeof(ids[count]);
172  iov_len[count]=sizeof(iovid_vec[count]);
173 
174  x_len[count]=sizeof(xx[count]);
175  y_len[count]=sizeof(yy[count]);
176  st_len[count]=sizeof(st[count]);
177 
178  count++;
179  }
180 
181 
182  try {
183  m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]),iov_len);
184  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
185  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len );
186  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len );
187  m_writeStmt->setDataBuffer(5, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len );
188 
189 
190  m_writeStmt->executeArrayUpdate(nrows);
191 
192  delete [] ids;
193  delete [] iovid_vec;
194  delete [] xx;
195  delete [] yy;
196  delete [] st;
197 
198  delete [] ids_len;
199  delete [] iov_len;
200  delete [] x_len;
201  delete [] y_len;
202  delete [] st_len;
203 
204 
205 
206  } catch (SQLException &e) {
207  throw(std::runtime_error(std::string("MonDelaysTTDat::writeArrayDB(): ")+getOraMessage(&e)));
208  }
209 }
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
float getDelayRMS() const
int getLogicID() const
Definition: EcalLogicID.cc:41
bool getTaskStatus() const
float getDelayMean() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void MonDelaysTTDat::writeDB ( const EcalLogicID ecid,
const MonDelaysTTDat item,
MonRunIOV iov 
)
privatenoexcept

Definition at line 50 of file MonDelaysTTDat.cc.

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

Referenced by getTaskStatus().

52 {
53  this->checkConnection();
54  this->checkPrepare();
55 
56  int iovID = iov->fetchID();
57  if (!iovID) { throw(std::runtime_error("MonDelaysTTDat::writeDB: IOV not in DB")); }
58 
59  int logicID = ecid->getLogicID();
60  if (!logicID) { throw(std::runtime_error("MonDelaysTTDat::writeDB: Bad EcalLogicID")); }
61 
62  try {
63  m_writeStmt->setInt(1, iovID);
64  m_writeStmt->setInt(2, logicID);
65 
66  m_writeStmt->setFloat(3, item->getDelayMean() );
67  m_writeStmt->setFloat(4, item->getDelayRMS() );
68  m_writeStmt->setInt(5, item->getTaskStatus() );
69 
70  m_writeStmt->executeUpdate();
71  } catch (SQLException &e) {
72  throw(std::runtime_error(std::string("MonDelaysTTDat::writeDB(): ")+getOraMessage(&e)));
73  }
74 }
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
float getDelayRMS() const
int getLogicID() const
Definition: EcalLogicID.cc:41
bool getTaskStatus() const
float getDelayMean() const

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonDelaysTTDat.h.

Member Data Documentation

float MonDelaysTTDat::m_delayMean
private

Definition at line 46 of file MonDelaysTTDat.h.

Referenced by getDelayMean(), and setDelayMean().

float MonDelaysTTDat::m_delayRMS
private

Definition at line 47 of file MonDelaysTTDat.h.

Referenced by getDelayRMS(), and setDelayRMS().

bool MonDelaysTTDat::m_taskStatus
private

Definition at line 48 of file MonDelaysTTDat.h.

Referenced by getTaskStatus(), and setTaskStatus().