CMS 3D CMS Logo

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

#include <MonPNPedDat.h>

Inheritance diagram for MonPNPedDat:
IDataItem IDBObject

Public Member Functions

float getPedMeanG1 () const
 
float getPedMeanG16 () const
 
float getPedRMSG1 () const
 
float getPedRMSG16 () const
 
std::string getTable () override
 
bool getTaskStatus () const
 
 MonPNPedDat ()
 
void setPedMeanG1 (float mean)
 
void setPedMeanG16 (float mean)
 
void setPedRMSG1 (float mean)
 
void setPedRMSG16 (float mean)
 
void setTaskStatus (bool status)
 
 ~MonPNPedDat () 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, MonPNPedDat > *fillVec, MonRunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, MonPNPedDat > *data, MonRunIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const MonPNPedDat *item, MonRunIOV *iov) noexcept(false)
 

Private Attributes

float m_pedMeanG1
 
float m_pedMeanG16
 
float m_pedRMSG1
 
float m_pedRMSG16
 
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 MonPNPedDat.h.

Constructor & Destructor Documentation

◆ MonPNPedDat()

MonPNPedDat::MonPNPedDat ( )

Definition at line 12 of file MonPNPedDat.cc.

12  {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_readStmt = nullptr;
17 
18  m_pedMeanG1 = 0;
19  m_pedRMSG1 = 0;
20  m_pedMeanG16 = 0;
21  m_pedRMSG16 = 0;
22  m_taskStatus = false;
23 }

◆ ~MonPNPedDat()

MonPNPedDat::~MonPNPedDat ( )
override

Definition at line 25 of file MonPNPedDat.cc.

25 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 72 of file MonPNPedDat.cc.

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

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setPedMeanG1(), setPedMeanG16(), setPedRMSG1(), setPedRMSG16(), and setTaskStatus().

◆ getPedMeanG1()

float MonPNPedDat::getPedMeanG1 ( ) const
inline

Definition at line 22 of file MonPNPedDat.h.

22 { return m_pedMeanG1; }

References m_pedMeanG1.

Referenced by writeArrayDB().

◆ getPedMeanG16()

float MonPNPedDat::getPedMeanG16 ( ) const
inline

Definition at line 28 of file MonPNPedDat.h.

28 { return m_pedMeanG16; }

References m_pedMeanG16.

Referenced by writeArrayDB().

◆ getPedRMSG1()

float MonPNPedDat::getPedRMSG1 ( ) const
inline

Definition at line 25 of file MonPNPedDat.h.

25 { return m_pedRMSG1; }

References m_pedRMSG1.

Referenced by writeArrayDB().

◆ getPedRMSG16()

float MonPNPedDat::getPedRMSG16 ( ) const
inline

Definition at line 31 of file MonPNPedDat.h.

31 { return m_pedRMSG16; }

References m_pedRMSG16.

Referenced by writeArrayDB().

◆ getTable()

std::string MonPNPedDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file MonPNPedDat.h.

19 { return "MON_PN_PED_DAT"; }

◆ getTaskStatus()

bool MonPNPedDat::getTaskStatus ( ) const
inline

Definition at line 34 of file MonPNPedDat.h.

34 { return m_taskStatus; }

References m_taskStatus.

Referenced by writeArrayDB().

◆ prepareWrite()

void MonPNPedDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 27 of file MonPNPedDat.cc.

27  {
28  this->checkConnection();
29 
30  try {
31  m_writeStmt = m_conn->createStatement();
32  m_writeStmt->setSQL(
33  "INSERT INTO mon_pn_ped_dat (iov_id, logic_id, "
34  "ped_mean_g1, ped_rms_g1, ped_mean_g16, ped_rms_g16, task_status) "
35  "VALUES (:iov_id, :logic_id, "
36  ":3, :4, :5, :6, :7)");
37  } catch (SQLException& e) {
38  throw(std::runtime_error("MonPNPedDat::prepareWrite(): " + e.getMessage()));
39  }
40 }

References MillePedeFileConverter_cfg::e.

◆ setPedMeanG1()

void MonPNPedDat::setPedMeanG1 ( float  mean)
inline

Definition at line 21 of file MonPNPedDat.h.

21 { m_pedMeanG1 = mean; }

References m_pedMeanG1, and SiStripPI::mean.

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

◆ setPedMeanG16()

void MonPNPedDat::setPedMeanG16 ( float  mean)
inline

Definition at line 27 of file MonPNPedDat.h.

27 { m_pedMeanG16 = mean; }

References m_pedMeanG16, and SiStripPI::mean.

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

◆ setPedRMSG1()

void MonPNPedDat::setPedRMSG1 ( float  mean)
inline

Definition at line 24 of file MonPNPedDat.h.

24 { m_pedRMSG1 = mean; }

References m_pedRMSG1, and SiStripPI::mean.

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

◆ setPedRMSG16()

void MonPNPedDat::setPedRMSG16 ( float  mean)
inline

Definition at line 30 of file MonPNPedDat.h.

30 { m_pedRMSG16 = mean; }

References m_pedRMSG16, and SiStripPI::mean.

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

◆ setTaskStatus()

void MonPNPedDat::setTaskStatus ( bool  status)
inline

Definition at line 33 of file MonPNPedDat.h.

33 { m_taskStatus = status; }

References m_taskStatus, and mps_update::status.

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

◆ writeArrayDB()

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

Definition at line 116 of file MonPNPedDat.cc.

116  {
117  this->checkConnection();
118  this->checkPrepare();
119 
120  int iovID = iov->fetchID();
121  if (!iovID) {
122  throw(std::runtime_error("MonPNPedDat::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 
141  ub2* st_len = new ub2[nrows];
142 
143  const EcalLogicID* channel;
144  const MonPNPedDat* dataitem;
145  int count = 0;
146  typedef map<EcalLogicID, MonPNPedDat>::const_iterator CI;
147  for (CI p = data->begin(); p != data->end(); ++p) {
148  channel = &(p->first);
149  int logicID = channel->getLogicID();
150  if (!logicID) {
151  throw(std::runtime_error("MonPNPedDat::writeArrayDB: Bad EcalLogicID"));
152  }
153  ids[count] = logicID;
154  iovid_vec[count] = iovID;
155 
156  dataitem = &(p->second);
157  // dataIface.writeDB( channel, dataitem, iov);
158  float x = dataitem->getPedMeanG1();
159  float y = dataitem->getPedRMSG1();
160  float z = dataitem->getPedMeanG16();
161  float w = dataitem->getPedRMSG16();
162  int statu = dataitem->getTaskStatus();
163 
164  xx[count] = x;
165  yy[count] = y;
166  zz[count] = z;
167  ww[count] = w;
168 
169  st[count] = statu;
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  z_len[count] = sizeof(zz[count]);
177  w_len[count] = sizeof(ww[count]);
178 
179  st_len[count] = sizeof(st[count]);
180 
181  count++;
182  }
183 
184  try {
185  m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]), iov_len);
186  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
187  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT, sizeof(xx[0]), x_len);
188  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT, sizeof(yy[0]), y_len);
189  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT, sizeof(zz[0]), z_len);
190  m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT, sizeof(ww[0]), w_len);
191  m_writeStmt->setDataBuffer(7, (dvoid*)st, OCCIINT, sizeof(st[0]), st_len);
192 
193  m_writeStmt->executeArrayUpdate(nrows);
194 
195  delete[] ids;
196  delete[] iovid_vec;
197  delete[] xx;
198  delete[] yy;
199  delete[] zz;
200  delete[] ww;
201 
202  delete[] st;
203 
204  delete[] ids_len;
205  delete[] iov_len;
206  delete[] x_len;
207  delete[] y_len;
208  delete[] z_len;
209  delete[] w_len;
210 
211  delete[] st_len;
212 
213  } catch (SQLException& e) {
214  throw(std::runtime_error("MonPNPedDat::writeArrayDB(): " + e.getMessage()));
215  }
216 }

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, EcalLogicID::getLogicID(), getPedMeanG1(), getPedMeanG16(), getPedRMSG1(), getPedRMSG16(), getTaskStatus(), AlCaHLTBitMon_ParallelJobs::p, w, x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, and geometryCSVtoXML::zz.

◆ writeDB()

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

Definition at line 42 of file MonPNPedDat.cc.

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

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonPNPedDat.h.

Member Data Documentation

◆ m_pedMeanG1

float MonPNPedDat::m_pedMeanG1
private

Definition at line 46 of file MonPNPedDat.h.

Referenced by getPedMeanG1(), and setPedMeanG1().

◆ m_pedMeanG16

float MonPNPedDat::m_pedMeanG16
private

Definition at line 48 of file MonPNPedDat.h.

Referenced by getPedMeanG16(), and setPedMeanG16().

◆ m_pedRMSG1

float MonPNPedDat::m_pedRMSG1
private

Definition at line 47 of file MonPNPedDat.h.

Referenced by getPedRMSG1(), and setPedRMSG1().

◆ m_pedRMSG16

float MonPNPedDat::m_pedRMSG16
private

Definition at line 49 of file MonPNPedDat.h.

Referenced by getPedRMSG16(), and setPedRMSG16().

◆ m_taskStatus

bool MonPNPedDat::m_taskStatus
private

Definition at line 50 of file MonPNPedDat.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
mps_update.status
status
Definition: mps_update.py:68
MonPNPedDat::setPedMeanG1
void setPedMeanG1(float mean)
Definition: MonPNPedDat.h:21
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
MonPNPedDat::m_pedRMSG16
float m_pedRMSG16
Definition: MonPNPedDat.h:49
DDAxes::x
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
MonPNPedDat::m_pedRMSG1
float m_pedRMSG1
Definition: MonPNPedDat.h:47
MonPNPedDat::setPedRMSG16
void setPedRMSG16(float mean)
Definition: MonPNPedDat.h:30
MonPNPedDat::getPedMeanG16
float getPedMeanG16() const
Definition: MonPNPedDat.h:28
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
MonPNPedDat::setPedMeanG16
void setPedMeanG16(float mean)
Definition: MonPNPedDat.h:27
DDAxes::z
MonPNPedDat::setPedRMSG1
void setPedRMSG1(float mean)
Definition: MonPNPedDat.h:24
EcalLogicID
Definition: EcalLogicID.h:7
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
MonPNPedDat::m_pedMeanG16
float m_pedMeanG16
Definition: MonPNPedDat.h:48
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MonPNPedDat::getPedRMSG1
float getPedRMSG1() const
Definition: MonPNPedDat.h:25
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
MonPNPedDat::getPedMeanG1
float getPedMeanG1() const
Definition: MonPNPedDat.h:22
MonPNPedDat::getPedRMSG16
float getPedRMSG16() const
Definition: MonPNPedDat.h:31
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
MonPNPedDat::setTaskStatus
void setTaskStatus(bool status)
Definition: MonPNPedDat.h:33
MonPNPedDat::getTaskStatus
bool getTaskStatus() const
Definition: MonPNPedDat.h:34
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
MonPNPedDat::m_pedMeanG1
float m_pedMeanG1
Definition: MonPNPedDat.h:46
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
MonPNPedDat::m_taskStatus
bool m_taskStatus
Definition: MonPNPedDat.h:50
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MonPNPedDat
Definition: MonPNPedDat.h:12
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37