CMS 3D CMS Logo

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

#include <DCULVRTempsDat.h>

Inheritance diagram for DCULVRTempsDat:
IDataItem IDBObject

Public Member Functions

 DCULVRTempsDat ()
 
float getT1 () const
 
float getT2 () const
 
float getT3 () const
 
std::string getTable () override
 
void setT1 (float temp)
 
void setT2 (float temp)
 
void setT3 (float temp)
 
 ~DCULVRTempsDat () 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, DCULVRTempsDat > *fillVec, DCUIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, DCULVRTempsDat > *data, DCUIOV *iov) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const DCULVRTempsDat *item, DCUIOV *iov) noexcept(false)
 

Private Attributes

float m_t1
 
float m_t2
 
float m_t3
 

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

Constructor & Destructor Documentation

DCULVRTempsDat::DCULVRTempsDat ( )

Definition at line 12 of file DCULVRTempsDat.cc.

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

Definition at line 23 of file DCULVRTempsDat.cc.

23 {}

Member Function Documentation

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

Definition at line 68 of file DCULVRTempsDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setT1(), setT2(), and setT3().

Referenced by getT3().

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("DCULVRTempsDat::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.t1, d.t2, d.t3 "
83  "FROM channelview cv JOIN dcu_lvr_temps_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, DCULVRTempsDat> p;
90  DCULVRTempsDat 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.setT1(rset->getFloat(7));
100  dat.setT2(rset->getFloat(8));
101  dat.setT3(rset->getFloat(9));
102 
103  p.second = dat;
104  fillMap->insert(p);
105  }
106  } catch (SQLException& e) {
107  throw(std::runtime_error("DCULVRTempsDat::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
void setT3(float temp)
int fetchID() noexcept(false) override
Definition: DCUIOV.cc:48
void setT1(float temp)
void setT2(float temp)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
float DCULVRTempsDat::getT1 ( ) const
inline

Definition at line 22 of file DCULVRTempsDat.h.

References m_t1.

22 { return m_t1; }
float DCULVRTempsDat::getT2 ( ) const
inline

Definition at line 25 of file DCULVRTempsDat.h.

References m_t2.

25 { return m_t2; }
float DCULVRTempsDat::getT3 ( ) const
inline

Definition at line 28 of file DCULVRTempsDat.h.

References data, fetchData(), B2GTnPMonitor_cfi::item, m_t3, noexcept, prepareWrite(), writeArrayDB(), and writeDB().

28 { return m_t3; }
std::string DCULVRTempsDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file DCULVRTempsDat.h.

19 { return "DCU_LVR_TEMPS_DAT"; }
void DCULVRTempsDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 25 of file DCULVRTempsDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getT3().

25  {
26  this->checkConnection();
27 
28  try {
29  m_writeStmt = m_conn->createStatement();
30  m_writeStmt->setSQL(
31  "INSERT INTO dcu_lvr_temps_dat (iov_id, logic_id, "
32  "t1, t2, t3) "
33  "VALUES (:iov_id, :logic_id, "
34  ":3, :4, :5)");
35  } catch (SQLException& e) {
36  throw(std::runtime_error("DCULVRTempsDat::prepareWrite(): " + e.getMessage()));
37  }
38 }
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 DCULVRTempsDat::setT1 ( float  temp)
inline

Definition at line 21 of file DCULVRTempsDat.h.

References m_t1, and groupFilesInBlocks::temp.

Referenced by fetchData().

void DCULVRTempsDat::setT2 ( float  temp)
inline

Definition at line 24 of file DCULVRTempsDat.h.

References m_t2, and groupFilesInBlocks::temp.

Referenced by fetchData().

void DCULVRTempsDat::setT3 ( float  temp)
inline

Definition at line 27 of file DCULVRTempsDat.h.

References m_t3, and groupFilesInBlocks::temp.

Referenced by fetchData().

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

Referenced by getT3().

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

Definition at line 40 of file DCULVRTempsDat.cc.

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

Referenced by getT3().

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

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file DCULVRTempsDat.h.

Member Data Documentation

float DCULVRTempsDat::m_t1
private

Definition at line 40 of file DCULVRTempsDat.h.

Referenced by getT1(), and setT1().

float DCULVRTempsDat::m_t2
private

Definition at line 41 of file DCULVRTempsDat.h.

Referenced by getT2(), and setT2().

float DCULVRTempsDat::m_t3
private

Definition at line 42 of file DCULVRTempsDat.h.

Referenced by getT3(), and setT3().