CMS 3D CMS Logo

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

#include <MonLed2Dat.h>

Inheritance diagram for MonLed2Dat:
IDataItem IDBObject

Public Member Functions

std::string getTable () override
 
bool getTaskStatus () const
 
float getVPTMean () const
 
float getVPTOverPNMean () const
 
float getVPTOverPNRMS () const
 
float getVPTRMS () const
 
 MonLed2Dat ()
 
void setTaskStatus (bool status)
 
void setVPTMean (float mean)
 
void setVPTOverPNMean (float mean)
 
void setVPTOverPNRMS (float rms)
 
void setVPTRMS (float rms)
 
 ~MonLed2Dat () 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, MonLed2Dat > *fillMap, MonRunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, MonLed2Dat > *data, MonRunIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const MonLed2Dat *item, MonRunIOV *iov) noexcept(false)
 

Private Attributes

bool m_taskStatus
 
float m_vptMean
 
float m_vptOverPNMean
 
float m_vptOverPNRMS
 
float m_vptRMS
 

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

Constructor & Destructor Documentation

MonLed2Dat::MonLed2Dat ( )

Definition at line 10 of file MonLed2Dat.cc.

11 {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_readStmt = nullptr;
16 
17  m_vptMean = 0;
18  m_vptRMS = 0;
19  m_vptOverPNMean = 0;
20  m_vptOverPNRMS = 0;
21  m_taskStatus = false;
22 
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
bool m_taskStatus
Definition: MonLed2Dat.h:55
float m_vptRMS
Definition: MonLed2Dat.h:52
float m_vptOverPNMean
Definition: MonLed2Dat.h:53
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
float m_vptMean
Definition: MonLed2Dat.h:51
float m_vptOverPNRMS
Definition: MonLed2Dat.h:54
MonLed2Dat::~MonLed2Dat ( )
override

Definition at line 27 of file MonLed2Dat.cc.

28 {
29 }

Member Function Documentation

void MonLed2Dat::fetchData ( std::map< EcalLogicID, MonLed2Dat > *  fillMap,
MonRunIOV iov 
)
privatenoexcept

Definition at line 81 of file MonLed2Dat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setTaskStatus(), setVPTMean(), setVPTOverPNMean(), setVPTOverPNRMS(), setVPTRMS(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getTaskStatus().

83 {
84  this->checkConnection();
85 
86  fillMap->clear();
87 
88  iov->setConnection(m_env, m_conn);
89  int iovID = iov->fetchID();
90  if (!iovID) {
91  // throw(std::runtime_error("MonLed2Dat::writeDB: IOV not in DB"));
92  return;
93  }
94 
95  try {
96 
97  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
98  "d.vpt_mean, d.vpt_rms, d.vpt_over_pn_mean, d.vpt_over_pn_rms, d.task_status "
99  "FROM channelview cv JOIN mon_led2_dat d "
100  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
101  "WHERE d.iov_id = :iov_id");
102  m_readStmt->setInt(1, iovID);
103  ResultSet* rset = m_readStmt->executeQuery();
104 
105  std::pair< EcalLogicID, MonLed2Dat > p;
106  MonLed2Dat dat;
107  while(rset->next()) {
108  p.first = EcalLogicID( getOraString(rset,1), // name
109  rset->getInt(2), // logic_id
110  rset->getInt(3), // id1
111  rset->getInt(4), // id2
112  rset->getInt(5), // id3
113  getOraString(rset,6)); // maps_to
114 
115  dat.setVPTMean( rset->getFloat(7) );
116  dat.setVPTRMS( rset->getFloat(8) );
117  dat.setVPTOverPNMean( rset->getFloat(9) );
118  dat.setVPTOverPNRMS( rset->getFloat(10) );
119  dat.setTaskStatus( rset->getInt(11) );
120 
121 
122  p.second = dat;
123  fillMap->insert(p);
124  }
125  } catch (SQLException &e) {
126  throw(std::runtime_error(std::string("MonLed2Dat::fetchData(): ")+getOraMessage(&e)));
127  }
128 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setVPTOverPNMean(float mean)
Definition: MonLed2Dat.h:27
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:118
void setVPTMean(float mean)
Definition: MonLed2Dat.h:21
void setVPTOverPNRMS(float rms)
Definition: MonLed2Dat.h:30
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void setTaskStatus(bool status)
Definition: MonLed2Dat.h:33
void setVPTRMS(float rms)
Definition: MonLed2Dat.h:24
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
std::string MonLed2Dat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file MonLed2Dat.h.

19 { return "MON_LED2_DAT"; }
bool MonLed2Dat::getTaskStatus ( ) const
inline

Definition at line 34 of file MonLed2Dat.h.

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

Referenced by writeArrayDB().

34 { return m_taskStatus; }
bool m_taskStatus
Definition: MonLed2Dat.h:55
float MonLed2Dat::getVPTMean ( ) const
inline

Definition at line 22 of file MonLed2Dat.h.

References m_vptMean.

Referenced by writeArrayDB().

22 { return m_vptMean; }
float m_vptMean
Definition: MonLed2Dat.h:51
float MonLed2Dat::getVPTOverPNMean ( ) const
inline

Definition at line 28 of file MonLed2Dat.h.

References m_vptOverPNMean.

Referenced by writeArrayDB().

28 { return m_vptOverPNMean; }
float m_vptOverPNMean
Definition: MonLed2Dat.h:53
float MonLed2Dat::getVPTOverPNRMS ( ) const
inline

Definition at line 31 of file MonLed2Dat.h.

References m_vptOverPNRMS.

Referenced by writeArrayDB().

31 { return m_vptOverPNRMS; }
float m_vptOverPNRMS
Definition: MonLed2Dat.h:54
float MonLed2Dat::getVPTRMS ( ) const
inline

Definition at line 25 of file MonLed2Dat.h.

References m_vptRMS.

Referenced by writeArrayDB().

25 { return m_vptRMS; }
float m_vptRMS
Definition: MonLed2Dat.h:52
void MonLed2Dat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 33 of file MonLed2Dat.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_led2_dat (iov_id, logic_id, "
41  "vpt_mean, vpt_rms, vpt_over_pn_mean, vpt_over_pn_rms, task_status) "
42  "VALUES (:iov_id, :logic_id, "
43  ":vpt_mean, :vpt_rms, :vpt_over_pn_mean, :vpt_over_pn_rms, :task_status)");
44  } catch (SQLException &e) {
45  throw(std::runtime_error(std::string("MonLed2Dat::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 MonLed2Dat::setTaskStatus ( bool  status)
inline

Definition at line 33 of file MonLed2Dat.h.

References m_taskStatus, and mps_update::status.

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

33 { m_taskStatus = status; }
bool m_taskStatus
Definition: MonLed2Dat.h:55
void MonLed2Dat::setVPTMean ( float  mean)
inline

Definition at line 21 of file MonLed2Dat.h.

References m_vptMean, and SiStripPI::mean.

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

void MonLed2Dat::setVPTOverPNMean ( float  mean)
inline

Definition at line 27 of file MonLed2Dat.h.

References m_vptOverPNMean, and SiStripPI::mean.

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

void MonLed2Dat::setVPTOverPNRMS ( float  rms)
inline

Definition at line 30 of file MonLed2Dat.h.

References m_vptOverPNRMS, and SiStripPI::rms.

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

void MonLed2Dat::setVPTRMS ( float  rms)
inline

Definition at line 24 of file MonLed2Dat.h.

References m_vptRMS, and SiStripPI::rms.

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

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

Definition at line 130 of file MonLed2Dat.cc.

References KineDebug3::count(), data, MillePedeFileConverter_cfg::e, EcalLogicID::getLogicID(), getTaskStatus(), getVPTMean(), getVPTOverPNMean(), getVPTOverPNRMS(), getVPTRMS(), AlCaHLTBitMon_ParallelJobs::p, AlCaHLTBitMon_QueryRunRegistry::string, w, x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, and geometryCSVtoXML::zz.

Referenced by getTaskStatus().

132 {
133  this->checkConnection();
134  this->checkPrepare();
135 
136  int iovID = iov->fetchID();
137  if (!iovID) { throw(std::runtime_error("MonLed2Dat::writeArrayDB: IOV not in DB")); }
138 
139 
140  int nrows=data->size();
141  int* ids= new int[nrows];
142  int* iovid_vec= new int[nrows];
143  float* xx= new float[nrows];
144  float* yy= new float[nrows];
145  float* zz= new float[nrows];
146  float* ww= new float[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* st_len= new ub2[nrows];
156 
157  const EcalLogicID* channel;
158  const MonLed2Dat* dataitem;
159  int count=0;
160  typedef map< EcalLogicID, MonLed2Dat >::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("MonLed2Dat::writeArrayDB: Bad EcalLogicID")); }
165  ids[count]=logicID;
166  iovid_vec[count]=iovID;
167 
168  dataitem = &(p->second);
169  // dataIface.writeDB( channel, dataitem, iov);
170  float x=dataitem->getVPTMean();
171  float y=dataitem->getVPTRMS();
172  float z=dataitem->getVPTOverPNMean();
173  float w=dataitem->getVPTOverPNRMS();
174  int statu=dataitem->getTaskStatus();
175 
176 
177 
178  xx[count]=x;
179  yy[count]=y;
180  zz[count]=z;
181  ww[count]=w;
182  st[count]=statu;
183 
184 
185  ids_len[count]=sizeof(ids[count]);
186  iov_len[count]=sizeof(iovid_vec[count]);
187 
188  x_len[count]=sizeof(xx[count]);
189  y_len[count]=sizeof(yy[count]);
190  z_len[count]=sizeof(zz[count]);
191  w_len[count]=sizeof(ww[count]);
192  st_len[count]=sizeof(st[count]);
193 
194  count++;
195  }
196 
197 
198  try {
199  m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]),iov_len);
200  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
201  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len );
202  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT , sizeof(yy[0]), y_len );
203  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT , sizeof(zz[0]), z_len );
204  m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT , sizeof(ww[0]), w_len );
205  m_writeStmt->setDataBuffer(7, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len );
206 
207 
208  m_writeStmt->executeArrayUpdate(nrows);
209 
210  delete [] ids;
211  delete [] iovid_vec;
212  delete [] xx;
213  delete [] yy;
214  delete [] zz;
215  delete [] ww;
216  delete [] st;
217 
218  delete [] ids_len;
219  delete [] iov_len;
220  delete [] x_len;
221  delete [] y_len;
222  delete [] z_len;
223  delete [] w_len;
224  delete [] st_len;
225 
226 
227 
228  } catch (SQLException &e) {
229  throw(std::runtime_error(std::string("MonLed2Dat::writeArrayDB(): ")+getOraMessage(&e)));
230  }
231 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
const double w
Definition: UKUtility.cc:23
float getVPTOverPNRMS() const
Definition: MonLed2Dat.h:31
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:118
bool getTaskStatus() const
Definition: MonLed2Dat.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
float getVPTRMS() const
Definition: MonLed2Dat.h:25
int getLogicID() const
Definition: EcalLogicID.cc:41
float getVPTOverPNMean() const
Definition: MonLed2Dat.h:28
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
float getVPTMean() const
Definition: MonLed2Dat.h:22
void MonLed2Dat::writeDB ( const EcalLogicID ecid,
const MonLed2Dat item,
MonRunIOV iov 
)
privatenoexcept

Definition at line 51 of file MonLed2Dat.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("MonLed2Dat::writeDB: IOV not in DB")); }
59 
60  int logicID = ecid->getLogicID();
61  if (!logicID) { throw(std::runtime_error("MonLed2Dat::writeDB: Bad EcalLogicID")); }
62 
63  try {
64  m_writeStmt->setInt(1, iovID);
65  m_writeStmt->setInt(2, logicID);
66 
67  m_writeStmt->setFloat(3, item->getVPTMean() );
68  m_writeStmt->setFloat(4, item->getVPTRMS() );
69  m_writeStmt->setFloat(5, item->getVPTOverPNMean() );
70  m_writeStmt->setFloat(6, item->getVPTOverPNRMS() );
71  m_writeStmt->setInt(7, item->getTaskStatus() );
72 
73  m_writeStmt->executeUpdate();
74  } catch (SQLException &e) {
75  throw(std::runtime_error(std::string("MonLed2Dat::writeDB(): ")+getOraMessage(&e)));
76  }
77 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
float getVPTOverPNRMS() const
Definition: MonLed2Dat.h:31
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:118
bool getTaskStatus() const
Definition: MonLed2Dat.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
float getVPTRMS() const
Definition: MonLed2Dat.h:25
int getLogicID() const
Definition: EcalLogicID.cc:41
float getVPTOverPNMean() const
Definition: MonLed2Dat.h:28
float getVPTMean() const
Definition: MonLed2Dat.h:22

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonLed2Dat.h.

Member Data Documentation

bool MonLed2Dat::m_taskStatus
private

Definition at line 55 of file MonLed2Dat.h.

Referenced by getTaskStatus(), and setTaskStatus().

float MonLed2Dat::m_vptMean
private

Definition at line 51 of file MonLed2Dat.h.

Referenced by getVPTMean(), and setVPTMean().

float MonLed2Dat::m_vptOverPNMean
private

Definition at line 53 of file MonLed2Dat.h.

Referenced by getVPTOverPNMean(), and setVPTOverPNMean().

float MonLed2Dat::m_vptOverPNRMS
private

Definition at line 54 of file MonLed2Dat.h.

Referenced by getVPTOverPNRMS(), and setVPTOverPNRMS().

float MonLed2Dat::m_vptRMS
private

Definition at line 52 of file MonLed2Dat.h.

Referenced by getVPTRMS(), and setVPTRMS().