CMS 3D CMS Logo

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

#include <DCUVFETempDat.h>

Inheritance diagram for DCUVFETempDat:
IDataItem IDBObject

Public Member Functions

 DCUVFETempDat ()
 
std::string getTable () override
 
float getVFETemp () const
 
void setVFETemp (float temp)
 
 ~DCUVFETempDat () 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, DCUVFETempDat > *fillVec, DCUIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, DCUVFETempDat > *data, DCUIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const DCUVFETempDat *item, DCUIOV *iov) noexcept(false)
 

Private Attributes

float m_vfeTemp
 

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

Constructor & Destructor Documentation

◆ DCUVFETempDat()

DCUVFETempDat::DCUVFETempDat ( )

Definition at line 12 of file DCUVFETempDat.cc.

12  {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_readStmt = nullptr;
17 
18  m_vfeTemp = 0;
19 }

◆ ~DCUVFETempDat()

DCUVFETempDat::~DCUVFETempDat ( )
override

Definition at line 21 of file DCUVFETempDat.cc.

21 {}

Member Function Documentation

◆ fetchData()

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

Definition at line 64 of file DCUVFETempDat.cc.

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

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, and setVFETemp().

◆ getTable()

std::string DCUVFETempDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file DCUVFETempDat.h.

19 { return "DCU_VFE_TEMP_DAT"; }

◆ getVFETemp()

float DCUVFETempDat::getVFETemp ( ) const
inline

Definition at line 22 of file DCUVFETempDat.h.

22 { return m_vfeTemp; }

References m_vfeTemp.

Referenced by writeArrayDB().

◆ prepareWrite()

void DCUVFETempDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 23 of file DCUVFETempDat.cc.

23  {
24  this->checkConnection();
25 
26  try {
27  m_writeStmt = m_conn->createStatement();
28  m_writeStmt->setSQL(
29  "INSERT INTO dcu_vfe_temp_dat (iov_id, logic_id, "
30  "vfe_temp) "
31  "VALUES (:iov_id, :logic_id, "
32  ":vfe_temp)");
33  } catch (SQLException& e) {
34  throw(std::runtime_error("DCUVFETempDat::prepareWrite(): " + e.getMessage()));
35  }
36 }

References MillePedeFileConverter_cfg::e.

◆ setVFETemp()

void DCUVFETempDat::setVFETemp ( float  temp)
inline

Definition at line 21 of file DCUVFETempDat.h.

21 { m_vfeTemp = temp; }

References m_vfeTemp, and groupFilesInBlocks::temp.

Referenced by fetchData().

◆ writeArrayDB()

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

Definition at line 105 of file DCUVFETempDat.cc.

105  {
106  this->checkConnection();
107  this->checkPrepare();
108 
109  int iovID = iov->fetchID();
110  if (!iovID) {
111  throw(std::runtime_error("DCUVFETempDat::writeArrayDB: IOV not in DB"));
112  }
113 
114  int nrows = data->size();
115  int* ids = new int[nrows];
116  int* iovid_vec = new int[nrows];
117  float* xx = new float[nrows];
118 
119  ub2* ids_len = new ub2[nrows];
120  ub2* iov_len = new ub2[nrows];
121  ub2* x_len = new ub2[nrows];
122 
123  const EcalLogicID* channel;
124  const DCUVFETempDat* dataitem;
125  int count = 0;
126  typedef map<EcalLogicID, DCUVFETempDat>::const_iterator CI;
127  for (CI p = data->begin(); p != data->end(); ++p) {
128  channel = &(p->first);
129  int logicID = channel->getLogicID();
130  if (!logicID) {
131  throw(std::runtime_error("DCUVFETempDat::writeArrayDB: Bad EcalLogicID"));
132  }
133  ids[count] = logicID;
134  iovid_vec[count] = iovID;
135 
136  dataitem = &(p->second);
137  // dataIface.writeDB( channel, dataitem, iov);
138  float x = dataitem->getVFETemp();
139 
140  xx[count] = x;
141 
142  ids_len[count] = sizeof(ids[count]);
143  iov_len[count] = sizeof(iovid_vec[count]);
144 
145  x_len[count] = sizeof(xx[count]);
146 
147  count++;
148  }
149 
150  try {
151  m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT, sizeof(iovid_vec[0]), iov_len);
152  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
153  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT, sizeof(xx[0]), x_len);
154 
155  m_writeStmt->executeArrayUpdate(nrows);
156 
157  delete[] ids;
158  delete[] iovid_vec;
159  delete[] xx;
160 
161  delete[] ids_len;
162  delete[] iov_len;
163  delete[] x_len;
164 
165  } catch (SQLException& e) {
166  throw(std::runtime_error("DCUVFETempDat::writeArrayDB(): " + e.getMessage()));
167  }
168 }

References KineDebug3::count(), std::data(), MillePedeFileConverter_cfg::e, EcalLogicID::getLogicID(), getVFETemp(), AlCaHLTBitMon_ParallelJobs::p, x, and geometryCSVtoXML::xx.

◆ writeDB()

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

Definition at line 38 of file DCUVFETempDat.cc.

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

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 14 of file DCUVFETempDat.h.

Member Data Documentation

◆ m_vfeTemp

float DCUVFETempDat::m_vfeTemp
private

Definition at line 34 of file DCUVFETempDat.h.

Referenced by getVFETemp(), and setVFETemp().

AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
DCUVFETempDat::getVFETemp
float getVFETemp() const
Definition: DCUVFETempDat.h:22
DDAxes::x
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
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
EcalLogicID
Definition: EcalLogicID.h:7
DCUVFETempDat::m_vfeTemp
float m_vfeTemp
Definition: DCUVFETempDat.h:34
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
DCUVFETempDat
Definition: DCUVFETempDat.h:12
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
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
DCUVFETempDat::setVFETemp
void setVFETemp(float temp)
Definition: DCUVFETempDat.h:21
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37