CMS 3D CMS Logo

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

Constructor & Destructor Documentation

◆ DCUCapsuleTempRawDat()

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 }

◆ ~DCUCapsuleTempRawDat()

DCUCapsuleTempRawDat::~DCUCapsuleTempRawDat ( )
override

Definition at line 22 of file DCUCapsuleTempRawDat.cc.

22 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 68 of file DCUCapsuleTempRawDat.cc.

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 }

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

◆ getCapsuleTempADC()

float DCUCapsuleTempRawDat::getCapsuleTempADC ( ) const
inline

Definition at line 22 of file DCUCapsuleTempRawDat.h.

22 { return m_capsuleTempADC; }

References m_capsuleTempADC.

Referenced by writeArrayDB().

◆ getCapsuleTempRMS()

float DCUCapsuleTempRawDat::getCapsuleTempRMS ( ) const
inline

Definition at line 25 of file DCUCapsuleTempRawDat.h.

25 { return m_capsuleTempRMS; }

References m_capsuleTempRMS.

Referenced by writeArrayDB().

◆ getTable()

std::string DCUCapsuleTempRawDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file DCUCapsuleTempRawDat.h.

19 { return "DCU_CAPSULE_TEMP_RAW_DAT"; }

◆ prepareWrite()

void DCUCapsuleTempRawDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 24 of file DCUCapsuleTempRawDat.cc.

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 }

References MillePedeFileConverter_cfg::e.

◆ setCapsuleTempADC()

void DCUCapsuleTempRawDat::setCapsuleTempADC ( float  adc)
inline

Definition at line 21 of file DCUCapsuleTempRawDat.h.

21 { m_capsuleTempADC = adc; }

References gpuClustering::adc, and m_capsuleTempADC.

Referenced by fetchData().

◆ setCapsuleTempRMS()

void DCUCapsuleTempRawDat::setCapsuleTempRMS ( float  rms)
inline

Definition at line 24 of file DCUCapsuleTempRawDat.h.

24 { m_capsuleTempRMS = rms; }

References m_capsuleTempRMS, and SiStripPI::rms.

Referenced by fetchData().

◆ writeArrayDB()

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

Definition at line 111 of file DCUCapsuleTempRawDat.cc.

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 }

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, getCapsuleTempADC(), getCapsuleTempRMS(), EcalLogicID::getLogicID(), AlCaHLTBitMon_ParallelJobs::p, x, geometryCSVtoXML::xx, y, and geometryCSVtoXML::yy.

◆ writeDB()

void DCUCapsuleTempRawDat::writeDB ( const EcalLogicID ecid,
const DCUCapsuleTempRawDat item,
DCUIOV iov 
)
privatenoexcept

Definition at line 39 of file DCUCapsuleTempRawDat.cc.

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 }

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 14 of file DCUCapsuleTempRawDat.h.

Member Data Documentation

◆ m_capsuleTempADC

float DCUCapsuleTempRawDat::m_capsuleTempADC
private

Definition at line 37 of file DCUCapsuleTempRawDat.h.

Referenced by getCapsuleTempADC(), and setCapsuleTempADC().

◆ m_capsuleTempRMS

float DCUCapsuleTempRawDat::m_capsuleTempRMS
private

Definition at line 38 of file DCUCapsuleTempRawDat.h.

Referenced by getCapsuleTempRMS(), and setCapsuleTempRMS().

DDAxes::y
DCUCapsuleTempRawDat::m_capsuleTempRMS
float m_capsuleTempRMS
Definition: DCUCapsuleTempRawDat.h:38
DCUCapsuleTempRawDat::m_capsuleTempADC
float m_capsuleTempADC
Definition: DCUCapsuleTempRawDat.h:37
gpuClustering::adc
uint16_t *__restrict__ uint16_t const *__restrict__ adc
Definition: gpuClusterChargeCut.h:20
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
DCUIOV::fetchID
int fetchID() noexcept(false) override
Definition: DCUIOV.cc:48
IDataItem::m_writeStmt
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
DCUCapsuleTempRawDat::getCapsuleTempADC
float getCapsuleTempADC() const
Definition: DCUCapsuleTempRawDat.h:22
EcalLogicID
Definition: EcalLogicID.h:7
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
DCUCapsuleTempRawDat::getCapsuleTempRMS
float getCapsuleTempRMS() const
Definition: DCUCapsuleTempRawDat.h:25
DCUCapsuleTempRawDat::setCapsuleTempADC
void setCapsuleTempADC(float adc)
Definition: DCUCapsuleTempRawDat.h:21
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
DCUCapsuleTempRawDat::setCapsuleTempRMS
void setCapsuleTempRMS(float rms)
Definition: DCUCapsuleTempRawDat.h:24
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
DCUCapsuleTempRawDat
Definition: DCUCapsuleTempRawDat.h:12
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37