CMS 3D CMS Logo

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

#include <MonTestPulseDat.h>

Inheritance diagram for MonTestPulseDat:
IDataItem IDBObject

Public Member Functions

float getADCMeanG1 () const
 
float getADCMeanG12 () const
 
float getADCMeanG6 () const
 
float getADCRMSG1 () const
 
float getADCRMSG12 () const
 
float getADCRMSG6 () const
 
std::string getTable () override
 
bool getTaskStatus () const
 
 MonTestPulseDat ()
 
void setADCMeanG1 (float mean)
 
void setADCMeanG12 (float mean)
 
void setADCMeanG6 (float mean)
 
void setADCRMSG1 (float rms)
 
void setADCRMSG12 (float rms)
 
void setADCRMSG6 (float rms)
 
void setTaskStatus (bool status)
 
 ~MonTestPulseDat () 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, MonTestPulseDat > *fillMap, MonRunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, MonTestPulseDat > *data, MonRunIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const MonTestPulseDat *item, MonRunIOV *iov) noexcept(false)
 

Private Attributes

float m_adcMeanG1
 
float m_adcMeanG12
 
float m_adcMeanG6
 
float m_adcRMSG1
 
float m_adcRMSG12
 
float m_adcRMSG6
 
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 MonTestPulseDat.h.

Constructor & Destructor Documentation

◆ MonTestPulseDat()

MonTestPulseDat::MonTestPulseDat ( )

Definition at line 12 of file MonTestPulseDat.cc.

12  {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_readStmt = nullptr;
17 
18  m_adcMeanG1 = 0;
19  m_adcRMSG1 = 0;
20  m_adcMeanG6 = 0;
21  m_adcRMSG6 = 0;
22  m_adcMeanG12 = 0;
23  m_adcRMSG12 = 0;
24  m_taskStatus = false;
25 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24

◆ ~MonTestPulseDat()

MonTestPulseDat::~MonTestPulseDat ( )
override

Definition at line 27 of file MonTestPulseDat.cc.

27 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 75 of file MonTestPulseDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setADCMeanG1(), setADCMeanG12(), setADCMeanG6(), setADCRMSG1(), setADCRMSG12(), setADCRMSG6(), and setTaskStatus().

75  {
76  this->checkConnection();
77  fillMap->clear();
78 
79  iov->setConnection(m_env, m_conn);
80  int iovID = iov->fetchID();
81  if (!iovID) {
82  // throw(std::runtime_error("MonTestPulseDat::writeDB: IOV not in DB"));
83  return;
84  }
85 
86  try {
87  m_readStmt->setSQL(
88  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
89  "d.adc_mean_g1, d.adc_rms_g1, d.adc_mean_g6, d.adc_rms_g6, d.adc_mean_g12, d.adc_rms_g12, d.task_status "
90  "FROM channelview cv JOIN mon_test_pulse_dat d "
91  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
92  "WHERE d.iov_id = :iov_id");
93  m_readStmt->setInt(1, iovID);
94  ResultSet* rset = m_readStmt->executeQuery();
95 
96  std::pair<EcalLogicID, MonTestPulseDat> p;
97  MonTestPulseDat dat;
98  while (rset->next()) {
99  p.first = EcalLogicID(rset->getString(1), // name
100  rset->getInt(2), // logic_id
101  rset->getInt(3), // id1
102  rset->getInt(4), // id2
103  rset->getInt(5), // id3
104  rset->getString(6)); // maps_to
105 
106  dat.setADCMeanG1(rset->getFloat(7));
107  dat.setADCRMSG1(rset->getFloat(8));
108  dat.setADCMeanG6(rset->getFloat(9));
109  dat.setADCRMSG6(rset->getFloat(10));
110  dat.setADCMeanG12(rset->getFloat(11));
111  dat.setADCRMSG12(rset->getFloat(12));
112  dat.setTaskStatus(rset->getInt(13));
113 
114  p.second = dat;
115  fillMap->insert(p);
116  }
117  } catch (SQLException& e) {
118  throw(std::runtime_error("MonTestPulseDat::fetchData(): " + e.getMessage()));
119  }
120 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void setADCRMSG1(float rms)
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void setADCMeanG1(float mean)
void setADCMeanG6(float mean)
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
void setADCMeanG12(float mean)
void setTaskStatus(bool status)
void setADCRMSG12(float rms)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
void setADCRMSG6(float rms)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23

◆ getADCMeanG1()

float MonTestPulseDat::getADCMeanG1 ( ) const
inline

Definition at line 22 of file MonTestPulseDat.h.

References m_adcMeanG1.

Referenced by writeArrayDB().

22 { return m_adcMeanG1; }

◆ getADCMeanG12()

float MonTestPulseDat::getADCMeanG12 ( ) const
inline

Definition at line 34 of file MonTestPulseDat.h.

References m_adcMeanG12.

Referenced by writeArrayDB().

34 { return m_adcMeanG12; }

◆ getADCMeanG6()

float MonTestPulseDat::getADCMeanG6 ( ) const
inline

Definition at line 28 of file MonTestPulseDat.h.

References m_adcMeanG6.

Referenced by writeArrayDB().

28 { return m_adcMeanG6; }

◆ getADCRMSG1()

float MonTestPulseDat::getADCRMSG1 ( ) const
inline

Definition at line 25 of file MonTestPulseDat.h.

References m_adcRMSG1.

Referenced by writeArrayDB().

25 { return m_adcRMSG1; }

◆ getADCRMSG12()

float MonTestPulseDat::getADCRMSG12 ( ) const
inline

Definition at line 37 of file MonTestPulseDat.h.

References m_adcRMSG12.

Referenced by writeArrayDB().

37 { return m_adcRMSG12; }

◆ getADCRMSG6()

float MonTestPulseDat::getADCRMSG6 ( ) const
inline

Definition at line 31 of file MonTestPulseDat.h.

References m_adcRMSG6.

Referenced by writeArrayDB().

31 { return m_adcRMSG6; }

◆ getTable()

std::string MonTestPulseDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file MonTestPulseDat.h.

19 { return "MON_TEST_PULSE_DAT"; }

◆ getTaskStatus()

bool MonTestPulseDat::getTaskStatus ( ) const
inline

Definition at line 40 of file MonTestPulseDat.h.

References m_taskStatus.

Referenced by writeArrayDB().

40 { return m_taskStatus; }

◆ prepareWrite()

void MonTestPulseDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 29 of file MonTestPulseDat.cc.

References MillePedeFileConverter_cfg::e.

29  {
30  this->checkConnection();
31 
32  try {
33  m_writeStmt = m_conn->createStatement();
34  m_writeStmt->setSQL(
35  "INSERT INTO mon_test_pulse_dat (iov_id, logic_id, "
36  "adc_mean_g1, adc_rms_g1, adc_mean_g6, adc_rms_g6, adc_mean_g12, adc_rms_g12, task_status) "
37  "VALUES (:iov_id, :logic_id, "
38  ":adc_mean_g1, :adc_rms_g1, :adc_rms_g6, :adc_rms_g6, :adc_mean_g12, :adc_rms_g12, :task_status)");
39  } catch (SQLException& e) {
40  throw(std::runtime_error("MonTestPulseDat::prepareWrite(): " + e.getMessage()));
41  }
42 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36

◆ setADCMeanG1()

void MonTestPulseDat::setADCMeanG1 ( float  mean)
inline

◆ setADCMeanG12()

void MonTestPulseDat::setADCMeanG12 ( float  mean)
inline

◆ setADCMeanG6()

void MonTestPulseDat::setADCMeanG6 ( float  mean)
inline

◆ setADCRMSG1()

void MonTestPulseDat::setADCRMSG1 ( float  rms)
inline

◆ setADCRMSG12()

void MonTestPulseDat::setADCRMSG12 ( float  rms)
inline

◆ setADCRMSG6()

void MonTestPulseDat::setADCRMSG6 ( float  rms)
inline

◆ setTaskStatus()

void MonTestPulseDat::setTaskStatus ( bool  status)
inline

Definition at line 39 of file MonTestPulseDat.h.

References m_taskStatus, and mps_update::status.

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

◆ writeArrayDB()

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

Definition at line 122 of file MonTestPulseDat.cc.

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, getADCMeanG1(), getADCMeanG12(), getADCMeanG6(), getADCRMSG1(), getADCRMSG12(), getADCRMSG6(), EcalLogicID::getLogicID(), getTaskStatus(), AlCaHLTBitMon_ParallelJobs::p, submitPVValidationJobs::t, groupFilesInBlocks::tt, w(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::ww, x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, and geometryCSVtoXML::zz.

122  {
123  this->checkConnection();
124  this->checkPrepare();
125 
126  int iovID = iov->fetchID();
127  if (!iovID) {
128  throw(std::runtime_error("MonTestPulseDat::writeArrayDB: IOV not in DB"));
129  }
130 
131  int nrows = data->size();
132  int* ids = new int[nrows];
133  int* iovid_vec = new int[nrows];
134  float* xx = new float[nrows];
135  float* yy = new float[nrows];
136  float* zz = new float[nrows];
137  float* ww = new float[nrows];
138  float* uu = new float[nrows];
139  float* tt = new float[nrows];
140  int* st = new int[nrows];
141 
142  ub2* ids_len = new ub2[nrows];
143  ub2* iov_len = new ub2[nrows];
144  ub2* x_len = new ub2[nrows];
145  ub2* y_len = new ub2[nrows];
146  ub2* z_len = new ub2[nrows];
147  ub2* w_len = new ub2[nrows];
148  ub2* u_len = new ub2[nrows];
149  ub2* t_len = new ub2[nrows];
150  ub2* st_len = new ub2[nrows];
151 
152  const EcalLogicID* channel;
153  const MonTestPulseDat* dataitem;
154  int count = 0;
155  typedef map<EcalLogicID, MonTestPulseDat>::const_iterator CI;
156  for (CI p = data->begin(); p != data->end(); ++p) {
157  channel = &(p->first);
158  int logicID = channel->getLogicID();
159  if (!logicID) {
160  throw(std::runtime_error("MonTestPulseDat::writeArrayDB: Bad EcalLogicID"));
161  }
162  ids[count] = logicID;
163  iovid_vec[count] = iovID;
164 
165  dataitem = &(p->second);
166  // dataIface.writeDB( channel, dataitem, iov);
167  float x = dataitem->getADCMeanG1();
168  float y = dataitem->getADCRMSG1();
169  float z = dataitem->getADCMeanG6();
170  float w = dataitem->getADCRMSG6();
171  float u = dataitem->getADCMeanG12();
172  float t = dataitem->getADCRMSG12();
173  int statu = dataitem->getTaskStatus();
174 
175  xx[count] = x;
176  yy[count] = y;
177  zz[count] = z;
178  ww[count] = w;
179  uu[count] = u;
180  tt[count] = t;
181  st[count] = statu;
182 
183  ids_len[count] = sizeof(ids[count]);
184  iov_len[count] = sizeof(iovid_vec[count]);
185 
186  x_len[count] = sizeof(xx[count]);
187  y_len[count] = sizeof(yy[count]);
188  z_len[count] = sizeof(zz[count]);
189  w_len[count] = sizeof(ww[count]);
190  u_len[count] = sizeof(uu[count]);
191  t_len[count] = sizeof(tt[count]);
192  st_len[count] = sizeof(st[count]);
193 
194  count++;
195  }
196 
197  try {
198  m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]), iov_len);
199  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
200  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT, sizeof(xx[0]), x_len);
201  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT, sizeof(yy[0]), y_len);
202  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT, sizeof(zz[0]), z_len);
203  m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT, sizeof(ww[0]), w_len);
204  m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIFLOAT, sizeof(uu[0]), u_len);
205  m_writeStmt->setDataBuffer(8, (dvoid*)tt, OCCIFLOAT, sizeof(tt[0]), t_len);
206  m_writeStmt->setDataBuffer(9, (dvoid*)st, OCCIINT, sizeof(st[0]), st_len);
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[] uu;
217  delete[] tt;
218  delete[] st;
219 
220  delete[] ids_len;
221  delete[] iov_len;
222  delete[] x_len;
223  delete[] y_len;
224  delete[] z_len;
225  delete[] w_len;
226  delete[] u_len;
227  delete[] t_len;
228  delete[] st_len;
229 
230  } catch (SQLException& e) {
231  throw(std::runtime_error("MonTestPulseDat::writeArrayDB(): " + e.getMessage()));
232  }
233 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
T w() const
float getADCMeanG1() const
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
bool getTaskStatus() const
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
float getADCRMSG12() const
Definition: TTTypes.h:54
int getLogicID() const
Definition: EcalLogicID.cc:28
float getADCRMSG1() const
float getADCMeanG6() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
float getADCRMSG6() const
float getADCMeanG12() const

◆ writeDB()

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

Definition at line 44 of file MonTestPulseDat.cc.

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

44  {
45  this->checkConnection();
46  this->checkPrepare();
47 
48  int iovID = iov->fetchID();
49  if (!iovID) {
50  throw(std::runtime_error("MonTestPulseDat::writeDB: IOV not in DB"));
51  }
52 
53  int logicID = ecid->getLogicID();
54  if (!logicID) {
55  throw(std::runtime_error("MonTestPulseDat::writeDB: Bad EcalLogicID"));
56  }
57 
58  try {
59  m_writeStmt->setInt(1, iovID);
60  m_writeStmt->setInt(2, logicID);
61  m_writeStmt->setFloat(3, item->getADCMeanG1());
62  m_writeStmt->setFloat(4, item->getADCRMSG1());
63  m_writeStmt->setFloat(5, item->getADCMeanG6());
64  m_writeStmt->setFloat(6, item->getADCRMSG6());
65  m_writeStmt->setFloat(7, item->getADCMeanG12());
66  m_writeStmt->setFloat(8, item->getADCRMSG12());
67  m_writeStmt->setInt(9, item->getTaskStatus());
68 
69  m_writeStmt->executeUpdate();
70  } catch (SQLException& e) {
71  throw(std::runtime_error("MonTestPulseDat::writeDB(): " + e.getMessage()));
72  }
73 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
int getLogicID() const
Definition: EcalLogicID.cc:28

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonTestPulseDat.h.

Member Data Documentation

◆ m_adcMeanG1

float MonTestPulseDat::m_adcMeanG1
private

Definition at line 52 of file MonTestPulseDat.h.

Referenced by getADCMeanG1(), and setADCMeanG1().

◆ m_adcMeanG12

float MonTestPulseDat::m_adcMeanG12
private

Definition at line 56 of file MonTestPulseDat.h.

Referenced by getADCMeanG12(), and setADCMeanG12().

◆ m_adcMeanG6

float MonTestPulseDat::m_adcMeanG6
private

Definition at line 54 of file MonTestPulseDat.h.

Referenced by getADCMeanG6(), and setADCMeanG6().

◆ m_adcRMSG1

float MonTestPulseDat::m_adcRMSG1
private

Definition at line 53 of file MonTestPulseDat.h.

Referenced by getADCRMSG1(), and setADCRMSG1().

◆ m_adcRMSG12

float MonTestPulseDat::m_adcRMSG12
private

Definition at line 57 of file MonTestPulseDat.h.

Referenced by getADCRMSG12(), and setADCRMSG12().

◆ m_adcRMSG6

float MonTestPulseDat::m_adcRMSG6
private

Definition at line 55 of file MonTestPulseDat.h.

Referenced by getADCRMSG6(), and setADCRMSG6().

◆ m_taskStatus

bool MonTestPulseDat::m_taskStatus
private

Definition at line 58 of file MonTestPulseDat.h.

Referenced by getTaskStatus(), and setTaskStatus().