CMS 3D CMS Logo

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

#include <MonLaserPulseDat.h>

Inheritance diagram for MonLaserPulseDat:
IDataItem IDBObject

Public Member Functions

float getPulseHeightMean () const
 
float getPulseHeightRMS () const
 
float getPulseWidthMean () const
 
float getPulseWidthRMS () const
 
std::string getTable () override
 
 MonLaserPulseDat ()
 
void setPulseHeightMean (float p)
 
void setPulseHeightRMS (float p)
 
void setPulseWidthMean (float p)
 
void setPulseWidthRMS (float p)
 
 ~MonLaserPulseDat () 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, MonLaserPulseDat > *fillMap, MonRunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, MonLaserPulseDat > *data, MonRunIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const MonLaserPulseDat *item, MonRunIOV *iov) noexcept(false)
 

Private Attributes

float m_pulseHeightMean
 
float m_pulseHeightRMS
 
float m_pulseWidthMean
 
float m_pulseWidthRMS
 

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 11 of file MonLaserPulseDat.h.

Constructor & Destructor Documentation

◆ MonLaserPulseDat()

MonLaserPulseDat::MonLaserPulseDat ( )

Definition at line 10 of file MonLaserPulseDat.cc.

10  {
11  m_env = nullptr;
12  m_conn = nullptr;
13  m_writeStmt = nullptr;
14  m_readStmt = nullptr;
15 
17  m_pulseHeightRMS = 0;
18  m_pulseWidthMean = 0;
19  m_pulseWidthRMS = 0;
20 }

◆ ~MonLaserPulseDat()

MonLaserPulseDat::~MonLaserPulseDat ( )
override

Definition at line 22 of file MonLaserPulseDat.cc.

22 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 68 of file MonLaserPulseDat.cc.

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

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setPulseHeightMean(), setPulseHeightRMS(), setPulseWidthMean(), and setPulseWidthRMS().

◆ getPulseHeightMean()

float MonLaserPulseDat::getPulseHeightMean ( ) const
inline

Definition at line 21 of file MonLaserPulseDat.h.

21 { return m_pulseHeightMean; }

References m_pulseHeightMean.

Referenced by writeArrayDB().

◆ getPulseHeightRMS()

float MonLaserPulseDat::getPulseHeightRMS ( ) const
inline

Definition at line 24 of file MonLaserPulseDat.h.

24 { return m_pulseHeightRMS; }

References m_pulseHeightRMS.

Referenced by writeArrayDB().

◆ getPulseWidthMean()

float MonLaserPulseDat::getPulseWidthMean ( ) const
inline

Definition at line 27 of file MonLaserPulseDat.h.

27 { return m_pulseWidthMean; }

References m_pulseWidthMean.

Referenced by writeArrayDB().

◆ getPulseWidthRMS()

float MonLaserPulseDat::getPulseWidthRMS ( ) const
inline

Definition at line 30 of file MonLaserPulseDat.h.

30 { return m_pulseWidthRMS; }

References m_pulseWidthRMS.

Referenced by writeArrayDB().

◆ getTable()

std::string MonLaserPulseDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file MonLaserPulseDat.h.

18 { return "MON_LASER_PULSE_DAT"; }

◆ prepareWrite()

void MonLaserPulseDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 24 of file MonLaserPulseDat.cc.

24  {
25  this->checkConnection();
26 
27  try {
28  m_writeStmt = m_conn->createStatement();
29  m_writeStmt->setSQL(
30  "INSERT INTO mon_laser_pulse_dat (iov_id, logic_id, "
31  "pulse_height_mean, pulse_height_rms, pulse_width_mean, pulse_width_rms) "
32  "VALUES (:iov_id, :logic_id, "
33  ":3, :4, :5, :6)");
34  } catch (SQLException& e) {
35  throw(std::runtime_error("MonLaserPulseDat::prepareWrite(): " + e.getMessage()));
36  }
37 }

References MillePedeFileConverter_cfg::e.

◆ setPulseHeightMean()

void MonLaserPulseDat::setPulseHeightMean ( float  p)
inline

Definition at line 20 of file MonLaserPulseDat.h.

20 { m_pulseHeightMean = p; }

References m_pulseHeightMean, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by fetchData().

◆ setPulseHeightRMS()

void MonLaserPulseDat::setPulseHeightRMS ( float  p)
inline

Definition at line 23 of file MonLaserPulseDat.h.

23 { m_pulseHeightRMS = p; }

References m_pulseHeightRMS, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by fetchData().

◆ setPulseWidthMean()

void MonLaserPulseDat::setPulseWidthMean ( float  p)
inline

Definition at line 26 of file MonLaserPulseDat.h.

26 { m_pulseWidthMean = p; }

References m_pulseWidthMean, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by fetchData().

◆ setPulseWidthRMS()

void MonLaserPulseDat::setPulseWidthRMS ( float  p)
inline

Definition at line 29 of file MonLaserPulseDat.h.

29 { m_pulseWidthRMS = p; }

References m_pulseWidthRMS, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by fetchData().

◆ writeArrayDB()

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

Definition at line 112 of file MonLaserPulseDat.cc.

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

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, EcalLogicID::getLogicID(), getPulseHeightMean(), getPulseHeightRMS(), getPulseWidthMean(), getPulseWidthRMS(), AlCaHLTBitMon_ParallelJobs::p, w, x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, and geometryCSVtoXML::zz.

◆ writeDB()

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

Definition at line 39 of file MonLaserPulseDat.cc.

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

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file MonLaserPulseDat.h.

Member Data Documentation

◆ m_pulseHeightMean

float MonLaserPulseDat::m_pulseHeightMean
private

Definition at line 42 of file MonLaserPulseDat.h.

Referenced by getPulseHeightMean(), and setPulseHeightMean().

◆ m_pulseHeightRMS

float MonLaserPulseDat::m_pulseHeightRMS
private

Definition at line 43 of file MonLaserPulseDat.h.

Referenced by getPulseHeightRMS(), and setPulseHeightRMS().

◆ m_pulseWidthMean

float MonLaserPulseDat::m_pulseWidthMean
private

Definition at line 44 of file MonLaserPulseDat.h.

Referenced by getPulseWidthMean(), and setPulseWidthMean().

◆ m_pulseWidthRMS

float MonLaserPulseDat::m_pulseWidthRMS
private

Definition at line 45 of file MonLaserPulseDat.h.

Referenced by getPulseWidthRMS(), and setPulseWidthRMS().

DDAxes::y
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
MonRunIOV::fetchID
int fetchID() noexcept(false) override
Definition: MonRunIOV.cc:72
MonLaserPulseDat::m_pulseWidthRMS
float m_pulseWidthRMS
Definition: MonLaserPulseDat.h:45
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
DDAxes::x
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
MonLaserPulseDat::setPulseHeightMean
void setPulseHeightMean(float p)
Definition: MonLaserPulseDat.h:20
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
MonLaserPulseDat::m_pulseHeightMean
float m_pulseHeightMean
Definition: MonLaserPulseDat.h:42
MonLaserPulseDat::getPulseWidthMean
float getPulseWidthMean() const
Definition: MonLaserPulseDat.h:27
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
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
MonLaserPulseDat::getPulseHeightRMS
float getPulseHeightRMS() const
Definition: MonLaserPulseDat.h:24
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
MonLaserPulseDat::setPulseHeightRMS
void setPulseHeightRMS(float p)
Definition: MonLaserPulseDat.h:23
MonLaserPulseDat::m_pulseWidthMean
float m_pulseWidthMean
Definition: MonLaserPulseDat.h:44
MonLaserPulseDat::m_pulseHeightRMS
float m_pulseHeightRMS
Definition: MonLaserPulseDat.h:43
MonLaserPulseDat::setPulseWidthMean
void setPulseWidthMean(float p)
Definition: MonLaserPulseDat.h:26
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
MonLaserPulseDat::getPulseHeightMean
float getPulseHeightMean() const
Definition: MonLaserPulseDat.h:21
MonLaserPulseDat::setPulseWidthRMS
void setPulseWidthRMS(float p)
Definition: MonLaserPulseDat.h:29
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
MonLaserPulseDat
Definition: MonLaserPulseDat.h:11
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
MonLaserPulseDat::getPulseWidthRMS
float getPulseWidthRMS() const
Definition: MonLaserPulseDat.h:30