CMS 3D CMS Logo

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

#include <MonLaserIRedDat.h>

Inheritance diagram for MonLaserIRedDat:
IDataItem IDBObject

Public Member Functions

float getAPDMean () const
 
float getAPDOverPNMean () const
 
float getAPDOverPNRMS () const
 
float getAPDRMS () const
 
std::string getTable () override
 
bool getTaskStatus () const
 
 MonLaserIRedDat ()
 
void setAPDMean (float mean)
 
void setAPDOverPNMean (float mean)
 
void setAPDOverPNRMS (float rms)
 
void setAPDRMS (float rms)
 
void setTaskStatus (bool status)
 
 ~MonLaserIRedDat () 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, MonLaserIRedDat > *fillMap, MonRunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, MonLaserIRedDat > *data, MonRunIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const MonLaserIRedDat *item, MonRunIOV *iov) noexcept(false)
 

Private Attributes

float m_apdMean
 
float m_apdOverPNMean
 
float m_apdOverPNRMS
 
float m_apdRMS
 
bool m_taskStatus
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static const int 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 MonLaserIRedDat.h.

Constructor & Destructor Documentation

◆ MonLaserIRedDat()

MonLaserIRedDat::MonLaserIRedDat ( )

Definition at line 10 of file MonLaserIRedDat.cc.

10  {
11  m_env = nullptr;
12  m_conn = nullptr;
13  m_writeStmt = nullptr;
14  m_readStmt = nullptr;
15 
16  m_apdMean = 0;
17  m_apdRMS = 0;
18  m_apdOverPNMean = 0;
19  m_apdOverPNRMS = 0;
20  m_taskStatus = false;
21 }

◆ ~MonLaserIRedDat()

MonLaserIRedDat::~MonLaserIRedDat ( )
override

Definition at line 23 of file MonLaserIRedDat.cc.

23 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 70 of file MonLaserIRedDat.cc.

70  {
71  this->checkConnection();
72 
73  fillMap->clear();
74 
75  iov->setConnection(m_env, m_conn);
76  int iovID = iov->fetchID();
77  if (!iovID) {
78  // throw(std::runtime_error("MonLaserIRedDat::writeDB: IOV not in DB"));
79  return;
80  }
81 
82  try {
83  m_readStmt->setSQL(
84  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
85  "d.apd_mean, d.apd_rms, d.apd_over_pn_mean, d.apd_over_pn_rms, d.task_status "
86  "FROM channelview cv JOIN mon_laser_ired_dat d "
87  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
88  "WHERE d.iov_id = :iov_id");
89  m_readStmt->setInt(1, iovID);
90  ResultSet* rset = m_readStmt->executeQuery();
91 
92  std::pair<EcalLogicID, MonLaserIRedDat> p;
93  MonLaserIRedDat dat;
94  while (rset->next()) {
95  p.first = EcalLogicID(rset->getString(1), // name
96  rset->getInt(2), // logic_id
97  rset->getInt(3), // id1
98  rset->getInt(4), // id2
99  rset->getInt(5), // id3
100  rset->getString(6)); // maps_to
101 
102  dat.setAPDMean(rset->getFloat(7));
103  dat.setAPDRMS(rset->getFloat(8));
104  dat.setAPDOverPNMean(rset->getFloat(9));
105  dat.setAPDOverPNRMS(rset->getFloat(10));
106  dat.setTaskStatus(rset->getInt(11));
107 
108  p.second = dat;
109  fillMap->insert(p);
110  }
111  } catch (SQLException& e) {
112  throw(std::runtime_error("MonLaserIRedDat::fetchData(): " + e.getMessage()));
113  }
114 }

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setAPDMean(), setAPDOverPNMean(), setAPDOverPNRMS(), setAPDRMS(), and setTaskStatus().

◆ getAPDMean()

float MonLaserIRedDat::getAPDMean ( ) const
inline

Definition at line 22 of file MonLaserIRedDat.h.

22 { return m_apdMean; }

References m_apdMean.

Referenced by writeArrayDB().

◆ getAPDOverPNMean()

float MonLaserIRedDat::getAPDOverPNMean ( ) const
inline

Definition at line 28 of file MonLaserIRedDat.h.

28 { return m_apdOverPNMean; }

References m_apdOverPNMean.

Referenced by writeArrayDB().

◆ getAPDOverPNRMS()

float MonLaserIRedDat::getAPDOverPNRMS ( ) const
inline

Definition at line 31 of file MonLaserIRedDat.h.

31 { return m_apdOverPNRMS; }

References m_apdOverPNRMS.

Referenced by writeArrayDB().

◆ getAPDRMS()

float MonLaserIRedDat::getAPDRMS ( ) const
inline

Definition at line 25 of file MonLaserIRedDat.h.

25 { return m_apdRMS; }

References m_apdRMS.

Referenced by writeArrayDB().

◆ getTable()

std::string MonLaserIRedDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file MonLaserIRedDat.h.

19 { return "MON_LASER_IRED_DAT"; }

◆ getTaskStatus()

bool MonLaserIRedDat::getTaskStatus ( ) const
inline

Definition at line 34 of file MonLaserIRedDat.h.

34 { return m_taskStatus; }

References m_taskStatus.

Referenced by writeArrayDB().

◆ prepareWrite()

void MonLaserIRedDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 25 of file MonLaserIRedDat.cc.

25  {
26  this->checkConnection();
27 
28  try {
29  m_writeStmt = m_conn->createStatement();
30  m_writeStmt->setSQL(
31  "INSERT INTO mon_laser_ired_dat (iov_id, logic_id, "
32  "apd_mean, apd_rms, apd_over_pn_mean, apd_over_pn_rms, task_status) "
33  "VALUES (:iov_id, :logic_id, "
34  ":apd_mean, :apd_rms, :apd_over_pn_mean, :apd_over_pn_rms, :task_status)");
35  } catch (SQLException& e) {
36  throw(std::runtime_error("MonLaserIRedDat::prepareWrite(): " + e.getMessage()));
37  }
38 }

References MillePedeFileConverter_cfg::e.

◆ setAPDMean()

void MonLaserIRedDat::setAPDMean ( float  mean)
inline

Definition at line 21 of file MonLaserIRedDat.h.

21 { m_apdMean = mean; }

References m_apdMean, and SiStripPI::mean.

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

◆ setAPDOverPNMean()

void MonLaserIRedDat::setAPDOverPNMean ( float  mean)
inline

Definition at line 27 of file MonLaserIRedDat.h.

27 { m_apdOverPNMean = mean; }

References m_apdOverPNMean, and SiStripPI::mean.

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

◆ setAPDOverPNRMS()

void MonLaserIRedDat::setAPDOverPNRMS ( float  rms)
inline

Definition at line 30 of file MonLaserIRedDat.h.

30 { m_apdOverPNRMS = rms; }

References m_apdOverPNRMS, and SiStripPI::rms.

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

◆ setAPDRMS()

void MonLaserIRedDat::setAPDRMS ( float  rms)
inline

Definition at line 24 of file MonLaserIRedDat.h.

24 { m_apdRMS = rms; }

References m_apdRMS, and SiStripPI::rms.

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

◆ setTaskStatus()

void MonLaserIRedDat::setTaskStatus ( bool  status)
inline

Definition at line 33 of file MonLaserIRedDat.h.

33 { m_taskStatus = status; }

References m_taskStatus, and mps_update::status.

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

◆ writeArrayDB()

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

Definition at line 116 of file MonLaserIRedDat.cc.

116  {
117  this->checkConnection();
118  this->checkPrepare();
119 
120  int iovID = iov->fetchID();
121  if (!iovID) {
122  throw(std::runtime_error("MonLaserIRedDat::writeArrayDB: IOV not in DB"));
123  }
124 
125  int nrows = data->size();
126  int* ids = new int[nrows];
127  int* iovid_vec = new int[nrows];
128  float* xx = new float[nrows];
129  float* yy = new float[nrows];
130  float* zz = new float[nrows];
131  float* ww = new float[nrows];
132  int* st = new int[nrows];
133 
134  ub2* ids_len = new ub2[nrows];
135  ub2* iov_len = new ub2[nrows];
136  ub2* x_len = new ub2[nrows];
137  ub2* y_len = new ub2[nrows];
138  ub2* z_len = new ub2[nrows];
139  ub2* w_len = new ub2[nrows];
140  ub2* st_len = new ub2[nrows];
141 
142  const EcalLogicID* channel;
143  const MonLaserIRedDat* dataitem;
144  int count = 0;
145  typedef map<EcalLogicID, MonLaserIRedDat>::const_iterator CI;
146  for (CI p = data->begin(); p != data->end(); ++p) {
147  channel = &(p->first);
148  int logicID = channel->getLogicID();
149  if (!logicID) {
150  throw(std::runtime_error("MonLaserIRedDat::writeArrayDB: Bad EcalLogicID"));
151  }
152  ids[count] = logicID;
153  iovid_vec[count] = iovID;
154 
155  dataitem = &(p->second);
156  // dataIface.writeDB( channel, dataitem, iov);
157  float x = dataitem->getAPDMean();
158  float y = dataitem->getAPDRMS();
159  float z = dataitem->getAPDOverPNMean();
160  float w = dataitem->getAPDOverPNRMS();
161  int statu = dataitem->getTaskStatus();
162 
163  xx[count] = x;
164  yy[count] = y;
165  zz[count] = z;
166  ww[count] = w;
167  st[count] = statu;
168 
169  ids_len[count] = sizeof(ids[count]);
170  iov_len[count] = sizeof(iovid_vec[count]);
171 
172  x_len[count] = sizeof(xx[count]);
173  y_len[count] = sizeof(yy[count]);
174  z_len[count] = sizeof(zz[count]);
175  w_len[count] = sizeof(ww[count]);
176  st_len[count] = sizeof(st[count]);
177 
178  count++;
179  }
180 
181  try {
182  m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]), iov_len);
183  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
184  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT, sizeof(xx[0]), x_len);
185  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT, sizeof(yy[0]), y_len);
186  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT, sizeof(zz[0]), z_len);
187  m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT, sizeof(ww[0]), w_len);
188  m_writeStmt->setDataBuffer(7, (dvoid*)st, OCCIINT, sizeof(st[0]), st_len);
189 
190  m_writeStmt->executeArrayUpdate(nrows);
191 
192  delete[] ids;
193  delete[] iovid_vec;
194  delete[] xx;
195  delete[] yy;
196  delete[] zz;
197  delete[] ww;
198  delete[] st;
199 
200  delete[] ids_len;
201  delete[] iov_len;
202  delete[] x_len;
203  delete[] y_len;
204  delete[] z_len;
205  delete[] w_len;
206  delete[] st_len;
207 
208  } catch (SQLException& e) {
209  throw(std::runtime_error("MonLaserIRedDat::writeArrayDB(): " + e.getMessage()));
210  }
211 }

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, getAPDMean(), getAPDOverPNMean(), getAPDOverPNRMS(), getAPDRMS(), EcalLogicID::getLogicID(), getTaskStatus(), AlCaHLTBitMon_ParallelJobs::p, w, x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, and geometryCSVtoXML::zz.

◆ writeDB()

void MonLaserIRedDat::writeDB ( const EcalLogicID ecid,
const MonLaserIRedDat item,
MonRunIOV iov 
)
privatenoexcept

Definition at line 40 of file MonLaserIRedDat.cc.

40  {
41  this->checkConnection();
42  this->checkPrepare();
43 
44  int iovID = iov->fetchID();
45  if (!iovID) {
46  throw(std::runtime_error("MonLaserIRedDat::writeDB: IOV not in DB"));
47  }
48 
49  int logicID = ecid->getLogicID();
50  if (!logicID) {
51  throw(std::runtime_error("MonLaserIRedDat::writeDB: Bad EcalLogicID"));
52  }
53 
54  try {
55  m_writeStmt->setInt(1, iovID);
56  m_writeStmt->setInt(2, logicID);
57 
58  m_writeStmt->setFloat(3, item->getAPDMean());
59  m_writeStmt->setFloat(4, item->getAPDRMS());
60  m_writeStmt->setFloat(5, item->getAPDOverPNMean());
61  m_writeStmt->setFloat(6, item->getAPDOverPNRMS());
62  m_writeStmt->setInt(7, item->getTaskStatus());
63 
64  m_writeStmt->executeUpdate();
65  } catch (SQLException& e) {
66  throw(std::runtime_error("MonLaserIRedDat::writeDB(): " + e.getMessage()));
67  }
68 }

References MillePedeFileConverter_cfg::e, and B2GTnPMonitor_cfi::item.

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonLaserIRedDat.h.

Member Data Documentation

◆ m_apdMean

float MonLaserIRedDat::m_apdMean
private

Definition at line 46 of file MonLaserIRedDat.h.

Referenced by getAPDMean(), and setAPDMean().

◆ m_apdOverPNMean

float MonLaserIRedDat::m_apdOverPNMean
private

Definition at line 48 of file MonLaserIRedDat.h.

Referenced by getAPDOverPNMean(), and setAPDOverPNMean().

◆ m_apdOverPNRMS

float MonLaserIRedDat::m_apdOverPNRMS
private

Definition at line 49 of file MonLaserIRedDat.h.

Referenced by getAPDOverPNRMS(), and setAPDOverPNRMS().

◆ m_apdRMS

float MonLaserIRedDat::m_apdRMS
private

Definition at line 47 of file MonLaserIRedDat.h.

Referenced by getAPDRMS(), and setAPDRMS().

◆ m_taskStatus

bool MonLaserIRedDat::m_taskStatus
private

Definition at line 50 of file MonLaserIRedDat.h.

Referenced by getTaskStatus(), and setTaskStatus().

DDAxes::y
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
MonRunIOV::fetchID
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
MonLaserIRedDat::getAPDMean
float getAPDMean() const
Definition: MonLaserIRedDat.h:22
MonLaserIRedDat::setTaskStatus
void setTaskStatus(bool status)
Definition: MonLaserIRedDat.h:33
mps_update.status
status
Definition: mps_update.py:69
MonLaserIRedDat::getAPDOverPNRMS
float getAPDOverPNRMS() const
Definition: MonLaserIRedDat.h:31
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MonLaserIRedDat::m_apdRMS
float m_apdRMS
Definition: MonLaserIRedDat.h:47
MonLaserIRedDat::m_apdMean
float m_apdMean
Definition: MonLaserIRedDat.h:46
MonLaserIRedDat::m_apdOverPNRMS
float m_apdOverPNRMS
Definition: MonLaserIRedDat.h:49
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
DDAxes::x
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
SiStripPI::rms
Definition: SiStripPayloadInspectorHelper.h:169
MonLaserIRedDat::setAPDRMS
void setAPDRMS(float rms)
Definition: MonLaserIRedDat.h:24
MonLaserIRedDat::getAPDRMS
float getAPDRMS() const
Definition: MonLaserIRedDat.h:25
IDataItem::m_writeStmt
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
w
const double w
Definition: UKUtility.cc:23
MonLaserIRedDat::m_apdOverPNMean
float m_apdOverPNMean
Definition: MonLaserIRedDat.h:48
MonLaserIRedDat::getAPDOverPNMean
float getAPDOverPNMean() const
Definition: MonLaserIRedDat.h:28
DDAxes::z
EcalLogicID
Definition: EcalLogicID.h:7
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
MonLaserIRedDat::setAPDMean
void setAPDMean(float mean)
Definition: MonLaserIRedDat.h:21
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
MonLaserIRedDat::m_taskStatus
bool m_taskStatus
Definition: MonLaserIRedDat.h:50
MonLaserIRedDat
Definition: MonLaserIRedDat.h:12
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
MonLaserIRedDat::setAPDOverPNMean
void setAPDOverPNMean(float mean)
Definition: MonLaserIRedDat.h:27
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
MonLaserIRedDat::getTaskStatus
bool getTaskStatus() const
Definition: MonLaserIRedDat.h:34
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
MonLaserIRedDat::setAPDOverPNRMS
void setAPDOverPNRMS(float rms)
Definition: MonLaserIRedDat.h:30
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37