CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
DCUCapsuleTempRawDat Class Reference

#include <DCUCapsuleTempRawDat.h>

Inheritance diagram for DCUCapsuleTempRawDat:
IDataItem IDBObject

Public Member Functions

 DCUCapsuleTempRawDat ()
 
float getCapsuleTempADC () const
 
float getCapsuleTempRMS () const
 
std::string getTable () override
 
void setCapsuleTempADC (float adc)
 
void setCapsuleTempRMS (float rms)
 
 ~DCUCapsuleTempRawDat () 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, DCUCapsuleTempRawDat > *fillVec, DCUIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, DCUCapsuleTempRawDat > *data, DCUIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const DCUCapsuleTempRawDat *item, DCUIOV *iov) noexcept(false)
 

Private Attributes

float m_capsuleTempADC
 
float m_capsuleTempRMS
 

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

Constructor & Destructor Documentation

DCUCapsuleTempRawDat::DCUCapsuleTempRawDat ( )

Definition at line 12 of file DCUCapsuleTempRawDat.cc.

12  {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_readStmt = nullptr;
17 
18  m_capsuleTempADC = 0;
19  m_capsuleTempRMS = 0;
20 }
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
DCUCapsuleTempRawDat::~DCUCapsuleTempRawDat ( )
override

Definition at line 22 of file DCUCapsuleTempRawDat.cc.

22 {}

Member Function Documentation

void DCUCapsuleTempRawDat::fetchData ( std::map< EcalLogicID, DCUCapsuleTempRawDat > *  fillVec,
DCUIOV iov 
)
privatenoexcept

Definition at line 68 of file DCUCapsuleTempRawDat.cc.

References dat, alignCSCRings::e, AlCaHLTBitMon_ParallelJobs::p, setCapsuleTempADC(), and setCapsuleTempRMS().

69  {
70  this->checkConnection();
71  fillMap->clear();
72 
73  iov->setConnection(m_env, m_conn);
74  int iovID = iov->fetchID();
75  if (!iovID) {
76  // throw(std::runtime_error("DCUCapsuleTempRawDat::writeDB: IOV not in DB"));
77  return;
78  }
79 
80  try {
81  m_readStmt->setSQL(
82  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
83  "d.capsule_temp_adc, d.capsule_temp_rms "
84  "FROM channelview cv JOIN dcu_capsule_temp_raw_dat d "
85  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
86  "WHERE d.iov_id = :iov_id");
87  m_readStmt->setInt(1, iovID);
88  ResultSet* rset = m_readStmt->executeQuery();
89 
90  std::pair<EcalLogicID, DCUCapsuleTempRawDat> p;
92  while (rset->next()) {
93  p.first = EcalLogicID(rset->getString(1), // name
94  rset->getInt(2), // logic_id
95  rset->getInt(3), // id1
96  rset->getInt(4), // id2
97  rset->getInt(5), // id3
98  rset->getString(6)); // maps_to
99 
100  dat.setCapsuleTempADC(rset->getFloat(7));
101  dat.setCapsuleTempRMS(rset->getFloat(8));
102 
103  p.second = dat;
104  fillMap->insert(p);
105  }
106  } catch (SQLException& e) {
107  throw(std::runtime_error("DCUCapsuleTempRawDat::fetchData(): " + e.getMessage()));
108  }
109 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
static std::vector< std::string > checklist dat
int fetchID() noexcept(false) override
Definition: DCUIOV.cc:48
void setCapsuleTempADC(float adc)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void setCapsuleTempRMS(float rms)
float DCUCapsuleTempRawDat::getCapsuleTempADC ( ) const
inline

Definition at line 22 of file DCUCapsuleTempRawDat.h.

References m_capsuleTempADC.

Referenced by writeArrayDB().

22 { return m_capsuleTempADC; }
float DCUCapsuleTempRawDat::getCapsuleTempRMS ( ) const
inline

Definition at line 25 of file DCUCapsuleTempRawDat.h.

References m_capsuleTempRMS.

Referenced by writeArrayDB().

25 { return m_capsuleTempRMS; }
std::string DCUCapsuleTempRawDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file DCUCapsuleTempRawDat.h.

19 { return "DCU_CAPSULE_TEMP_RAW_DAT"; }
void DCUCapsuleTempRawDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 24 of file DCUCapsuleTempRawDat.cc.

References alignCSCRings::e.

24  {
25  this->checkConnection();
26 
27  try {
28  m_writeStmt = m_conn->createStatement();
29  m_writeStmt->setSQL(
30  "INSERT INTO dcu_capsule_temp_raw_dat (iov_id, logic_id, "
31  "capsule_temp_adc, capsule_temp_rms) "
32  "VALUES (:iov_id, :logic_id, "
33  ":3, :4)");
34  } catch (SQLException& e) {
35  throw(std::runtime_error("DCUCapsuleTempRawDat::prepareWrite(): " + e.getMessage()));
36  }
37 }
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
void DCUCapsuleTempRawDat::setCapsuleTempADC ( float  adc)
inline

Definition at line 21 of file DCUCapsuleTempRawDat.h.

References gpuClustering::adc, and m_capsuleTempADC.

Referenced by fetchData().

21 { m_capsuleTempADC = adc; }
uint16_t *__restrict__ uint16_t const *__restrict__ adc
void DCUCapsuleTempRawDat::setCapsuleTempRMS ( float  rms)
inline
void DCUCapsuleTempRawDat::writeArrayDB ( const std::map< EcalLogicID, DCUCapsuleTempRawDat > *  data,
DCUIOV iov 
)
privatenoexcept

Definition at line 111 of file DCUCapsuleTempRawDat.cc.

References submitPVResolutionJobs::count, data, alignCSCRings::e, getCapsuleTempADC(), getCapsuleTempRMS(), EcalLogicID::getLogicID(), AlCaHLTBitMon_ParallelJobs::p, x, and y.

112  {
113  this->checkConnection();
114  this->checkPrepare();
115 
116  int iovID = iov->fetchID();
117  if (!iovID) {
118  throw(std::runtime_error("DCUCapsuleTempRawDat::writeArrayDB: IOV not in DB"));
119  }
120 
121  int nrows = data->size();
122  int* ids = new int[nrows];
123  int* iovid_vec = new int[nrows];
124  float* xx = new float[nrows];
125  float* yy = new float[nrows];
126 
127  ub2* ids_len = new ub2[nrows];
128  ub2* iov_len = new ub2[nrows];
129  ub2* x_len = new ub2[nrows];
130  ub2* y_len = new ub2[nrows];
131 
132  const EcalLogicID* channel;
133  const DCUCapsuleTempRawDat* dataitem;
134  int count = 0;
135  typedef map<EcalLogicID, DCUCapsuleTempRawDat>::const_iterator CI;
136  for (CI p = data->begin(); p != data->end(); ++p) {
137  channel = &(p->first);
138  int logicID = channel->getLogicID();
139  if (!logicID) {
140  throw(std::runtime_error("DCUCapsuleTempRawDat::writeArrayDB: Bad EcalLogicID"));
141  }
142  ids[count] = logicID;
143  iovid_vec[count] = iovID;
144 
145  dataitem = &(p->second);
146  // dataIface.writeDB( channel, dataitem, iov);
147  float x = dataitem->getCapsuleTempADC();
148  float y = dataitem->getCapsuleTempRMS();
149 
150  xx[count] = x;
151  yy[count] = y;
152 
153  ids_len[count] = sizeof(ids[count]);
154  iov_len[count] = sizeof(iovid_vec[count]);
155 
156  x_len[count] = sizeof(xx[count]);
157  y_len[count] = sizeof(yy[count]);
158 
159  count++;
160  }
161 
162  try {
163  m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]), iov_len);
164  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
165  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT, sizeof(xx[0]), x_len);
166  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT, sizeof(yy[0]), y_len);
167 
168  m_writeStmt->executeArrayUpdate(nrows);
169 
170  delete[] ids;
171  delete[] iovid_vec;
172  delete[] xx;
173  delete[] yy;
174 
175  delete[] ids_len;
176  delete[] iov_len;
177  delete[] x_len;
178  delete[] y_len;
179 
180  } catch (SQLException& e) {
181  throw(std::runtime_error("DCUCapsuleTempRawDat::writeArrayDB(): " + e.getMessage()));
182  }
183 }
float getCapsuleTempADC() const
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
float getCapsuleTempRMS() const
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
int getLogicID() const
Definition: EcalLogicID.cc:28
int fetchID() noexcept(false) override
Definition: DCUIOV.cc:48
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
void DCUCapsuleTempRawDat::writeDB ( const EcalLogicID ecid,
const DCUCapsuleTempRawDat item,
DCUIOV iov 
)
privatenoexcept

Definition at line 39 of file DCUCapsuleTempRawDat.cc.

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

41  {
42  this->checkConnection();
43  this->checkPrepare();
44 
45  int iovID = iov->fetchID();
46  if (!iovID) {
47  throw(std::runtime_error("DCUCapsuleTempRawDat::writeDB: IOV not in DB"));
48  }
49 
50  int logicID = ecid->getLogicID();
51  if (!logicID) {
52  throw(std::runtime_error("DCUCapsuleTempRawDat::writeDB: Bad EcalLogicID"));
53  }
54 
55  try {
56  m_writeStmt->setInt(1, iovID);
57  m_writeStmt->setInt(2, logicID);
58 
59  m_writeStmt->setFloat(3, item->getCapsuleTempADC());
60  m_writeStmt->setFloat(4, item->getCapsuleTempRMS());
61 
62  m_writeStmt->executeUpdate();
63  } catch (SQLException& e) {
64  throw(std::runtime_error("DCUCapsuleTempRawDat::writeDB(): " + e.getMessage()));
65  }
66 }
float getCapsuleTempADC() const
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
float getCapsuleTempRMS() const
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
int getLogicID() const
Definition: EcalLogicID.cc:28
int fetchID() noexcept(false) override
Definition: DCUIOV.cc:48

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file DCUCapsuleTempRawDat.h.

Member Data Documentation

float DCUCapsuleTempRawDat::m_capsuleTempADC
private

Definition at line 37 of file DCUCapsuleTempRawDat.h.

Referenced by getCapsuleTempADC(), and setCapsuleTempADC().

float DCUCapsuleTempRawDat::m_capsuleTempRMS
private

Definition at line 38 of file DCUCapsuleTempRawDat.h.

Referenced by getCapsuleTempRMS(), and setCapsuleTempRMS().