CMS 3D CMS Logo

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

#include <CaliHVScanRatioDat.h>

Inheritance diagram for CaliHVScanRatioDat:
IDataItem IDBObject

Public Member Functions

 CaliHVScanRatioDat ()
 
float getHVRatio () const
 
float getHVRatioRMS () const
 
std::string getTable () override
 
bool getTaskStatus () const
 
void setHVRatio (float c)
 
void setHVRatioRMS (float c)
 
void setTaskStatus (bool s)
 
 ~CaliHVScanRatioDat () 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, CaliHVScanRatioDat > *fillVec, CaliIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB (const EcalLogicID *ecid, const CaliHVScanRatioDat *item, CaliIOV *iov) noexcept(false)
 

Private Attributes

float m_hvratio
 
float m_hvratioRMS
 
bool m_taskStatus
 

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

Constructor & Destructor Documentation

◆ CaliHVScanRatioDat()

CaliHVScanRatioDat::CaliHVScanRatioDat ( )

Definition at line 12 of file CaliHVScanRatioDat.cc.

12  {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16 
17  m_hvratio = 0;
18  m_hvratioRMS = 0;
19  m_taskStatus = false;
20 }

◆ ~CaliHVScanRatioDat()

CaliHVScanRatioDat::~CaliHVScanRatioDat ( )
override

Definition at line 22 of file CaliHVScanRatioDat.cc.

22 {}

Member Function Documentation

◆ fetchData()

void CaliHVScanRatioDat::fetchData ( std::map< EcalLogicID, CaliHVScanRatioDat > *  fillVec,
CaliIOV iov 
)
privatenoexcept

Definition at line 69 of file CaliHVScanRatioDat.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("CaliHVScanRatioDat::writeDB: IOV not in DB"));
77  return;
78  }
79 
80  try {
81  Statement* stmt = m_conn->createStatement();
82  stmt->setSQL(
83  "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
84  "d.hvratio, d.hvratio_rms, d.task_status "
85  "FROM channelview cv JOIN cali_hv_scan_ratio_dat d "
86  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
87  "WHERE d.iov_id = :iov_id");
88  stmt->setInt(1, iovID);
89  ResultSet* rset = stmt->executeQuery();
90 
91  std::pair<EcalLogicID, CaliHVScanRatioDat> p;
93  while (rset->next()) {
94  p.first = EcalLogicID(rset->getString(1), // name
95  rset->getInt(2), // logic_id
96  rset->getInt(3), // id1
97  rset->getInt(4), // id2
98  rset->getInt(5), // id3
99  rset->getString(6)); // maps_to
100 
101  dat.setHVRatio(rset->getFloat(7));
102  dat.setHVRatioRMS(rset->getFloat(8));
103  dat.setTaskStatus(rset->getInt(9));
104 
105  p.second = dat;
106  fillMap->insert(p);
107  }
108  } catch (SQLException& e) {
109  throw(std::runtime_error("CaliHVScanRatioDat::fetchData(): " + e.getMessage()));
110  }
111 }

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setHVRatio(), setHVRatioRMS(), and setTaskStatus().

◆ getHVRatio()

float CaliHVScanRatioDat::getHVRatio ( ) const
inline

Definition at line 22 of file CaliHVScanRatioDat.h.

22 { return m_hvratio; }

References m_hvratio.

◆ getHVRatioRMS()

float CaliHVScanRatioDat::getHVRatioRMS ( ) const
inline

Definition at line 25 of file CaliHVScanRatioDat.h.

25 { return m_hvratioRMS; }

References m_hvratioRMS.

◆ getTable()

std::string CaliHVScanRatioDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file CaliHVScanRatioDat.h.

19 { return "CALI_HV_SCAN_RATIO_DAT"; }

◆ getTaskStatus()

bool CaliHVScanRatioDat::getTaskStatus ( ) const
inline

Definition at line 28 of file CaliHVScanRatioDat.h.

28 { return m_taskStatus; }

References m_taskStatus.

◆ prepareWrite()

void CaliHVScanRatioDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 24 of file CaliHVScanRatioDat.cc.

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

References MillePedeFileConverter_cfg::e.

◆ setHVRatio()

void CaliHVScanRatioDat::setHVRatio ( float  c)
inline

Definition at line 21 of file CaliHVScanRatioDat.h.

21 { m_hvratio = c; }

References HltBtagPostValidation_cff::c, and m_hvratio.

Referenced by fetchData().

◆ setHVRatioRMS()

void CaliHVScanRatioDat::setHVRatioRMS ( float  c)
inline

Definition at line 24 of file CaliHVScanRatioDat.h.

24 { m_hvratioRMS = c; }

References HltBtagPostValidation_cff::c, and m_hvratioRMS.

Referenced by fetchData().

◆ setTaskStatus()

void CaliHVScanRatioDat::setTaskStatus ( bool  s)
inline

Definition at line 27 of file CaliHVScanRatioDat.h.

27 { m_taskStatus = s; }

References m_taskStatus, and alignCSCRings::s.

Referenced by fetchData().

◆ writeDB()

void CaliHVScanRatioDat::writeDB ( const EcalLogicID ecid,
const CaliHVScanRatioDat item,
CaliIOV iov 
)
privatenoexcept

Definition at line 39 of file CaliHVScanRatioDat.cc.

41  {
42  this->checkConnection();
43  this->checkPrepare();
44 
45  int iovID = iov->fetchID();
46  if (!iovID) {
47  throw(std::runtime_error("CaliHVScanRatioDat::writeDB: IOV not in DB"));
48  }
49 
50  int logicID = ecid->getLogicID();
51  if (!logicID) {
52  throw(std::runtime_error("CaliHVScanRatioDat::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->getHVRatio());
60  m_writeStmt->setFloat(4, item->getHVRatioRMS());
61  m_writeStmt->setInt(5, item->getTaskStatus());
62 
63  m_writeStmt->executeUpdate();
64  } catch (SQLException& e) {
65  throw(std::runtime_error("CaliHVScanRatioDat::writeDB(): " + e.getMessage()));
66  }
67 }

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 14 of file CaliHVScanRatioDat.h.

Member Data Documentation

◆ m_hvratio

float CaliHVScanRatioDat::m_hvratio
private

Definition at line 38 of file CaliHVScanRatioDat.h.

Referenced by getHVRatio(), and setHVRatio().

◆ m_hvratioRMS

float CaliHVScanRatioDat::m_hvratioRMS
private

Definition at line 39 of file CaliHVScanRatioDat.h.

Referenced by getHVRatioRMS(), and setHVRatioRMS().

◆ m_taskStatus

bool CaliHVScanRatioDat::m_taskStatus
private

Definition at line 40 of file CaliHVScanRatioDat.h.

Referenced by getTaskStatus(), and setTaskStatus().

CaliHVScanRatioDat::m_taskStatus
bool m_taskStatus
Definition: CaliHVScanRatioDat.h:40
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CaliHVScanRatioDat
Definition: CaliHVScanRatioDat.h:12
CaliIOV::fetchID
int fetchID() noexcept(false) override
Definition: CaliIOV.cc:48
CaliHVScanRatioDat::setHVRatio
void setHVRatio(float c)
Definition: CaliHVScanRatioDat.h:21
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
EcalLogicID::getLogicID
int getLogicID() const
Definition: EcalLogicID.cc:28
CaliHVScanRatioDat::setTaskStatus
void setTaskStatus(bool s)
Definition: CaliHVScanRatioDat.h:27
alignCSCRings.s
s
Definition: alignCSCRings.py:92
CaliHVScanRatioDat::m_hvratio
float m_hvratio
Definition: CaliHVScanRatioDat.h:38
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
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
CaliHVScanRatioDat::m_hvratioRMS
float m_hvratioRMS
Definition: CaliHVScanRatioDat.h:39
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
CaliHVScanRatioDat::setHVRatioRMS
void setHVRatioRMS(float c)
Definition: CaliHVScanRatioDat.h:24
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37