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

Constructor & Destructor Documentation

CaliHVScanRatioDat::CaliHVScanRatioDat ( )

Definition at line 12 of file CaliHVScanRatioDat.cc.

13 {
14  m_env = nullptr;
15  m_conn = nullptr;
16  m_writeStmt = nullptr;
17 
18  m_hvratio = 0;
19  m_hvratioRMS = 0;
20  m_taskStatus = false;
21 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
CaliHVScanRatioDat::~CaliHVScanRatioDat ( )
override

Definition at line 25 of file CaliHVScanRatioDat.cc.

26 {
27 }

Member Function Documentation

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

Definition at line 77 of file CaliHVScanRatioDat.cc.

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

Referenced by getTaskStatus().

79 {
80  this->checkConnection();
81  fillMap->clear();
82 
83  iov->setConnection(m_env, m_conn);
84  int iovID = iov->fetchID();
85  if (!iovID) {
86  // throw(std::runtime_error("CaliHVScanRatioDat::writeDB: IOV not in DB"));
87  return;
88  }
89 
90  try {
91  Statement* stmt = m_conn->createStatement();
92  stmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
93  "d.hvratio, d.hvratio_rms, d.task_status "
94  "FROM channelview cv JOIN cali_hv_scan_ratio_dat d "
95  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
96  "WHERE d.iov_id = :iov_id");
97  stmt->setInt(1, iovID);
98  ResultSet* rset = stmt->executeQuery();
99 
100  std::pair< EcalLogicID, CaliHVScanRatioDat > p;
101  CaliHVScanRatioDat dat;
102  while(rset->next()) {
103  p.first = EcalLogicID( getOraString(rset,1), // name
104  rset->getInt(2), // logic_id
105  rset->getInt(3), // id1
106  rset->getInt(4), // id2
107  rset->getInt(5), // id3
108  getOraString(rset,6)); // maps_to
109 
110  dat.setHVRatio( rset->getFloat(7) );
111  dat.setHVRatioRMS( rset->getFloat(8) );
112  dat.setTaskStatus( rset->getInt(9) );
113 
114  p.second = dat;
115  fillMap->insert(p);
116  }
117  } catch (SQLException &e) {
118  throw(std::runtime_error(std::string("CaliHVScanRatioDat::fetchData(): ")+getOraMessage(&e)));
119  }
120 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setTaskStatus(bool s)
void setHVRatio(float c)
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void setHVRatioRMS(float c)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
int fetchID() noexcept(false) override
Definition: CaliIOV.cc:79
float CaliHVScanRatioDat::getHVRatio ( ) const
inline

Definition at line 22 of file CaliHVScanRatioDat.h.

References m_hvratio.

22 { return m_hvratio; }
float CaliHVScanRatioDat::getHVRatioRMS ( ) const
inline

Definition at line 25 of file CaliHVScanRatioDat.h.

References m_hvratioRMS.

25 { return m_hvratioRMS; }
std::string CaliHVScanRatioDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file CaliHVScanRatioDat.h.

19 { return "CALI_HV_SCAN_RATIO_DAT"; }
bool CaliHVScanRatioDat::getTaskStatus ( ) const
inline

Definition at line 28 of file CaliHVScanRatioDat.h.

References fetchData(), m_taskStatus, noexcept, prepareWrite(), and writeDB().

28 { return m_taskStatus; }
void CaliHVScanRatioDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 31 of file CaliHVScanRatioDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getTaskStatus().

33 {
34  this->checkConnection();
35 
36  try {
37  m_writeStmt = m_conn->createStatement();
38  m_writeStmt->setSQL("INSERT INTO cali_hv_scan_ratio_dat (iov_id, logic_id, "
39  "hvratio, hvratio_rms, task_status) "
40  "VALUES (:iov_id, :logic_id, "
41  ":3, :4, :5)");
42  } catch (SQLException &e) {
43  throw(std::runtime_error(std::string("CaliHVScanRatioDat::prepareWrite(): ")+getOraMessage(&e)));
44  }
45 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void CaliHVScanRatioDat::setHVRatio ( float  c)
inline

Definition at line 21 of file CaliHVScanRatioDat.h.

References EnergyCorrector::c, and m_hvratio.

Referenced by fetchData().

void CaliHVScanRatioDat::setHVRatioRMS ( float  c)
inline

Definition at line 24 of file CaliHVScanRatioDat.h.

References EnergyCorrector::c, and m_hvratioRMS.

Referenced by fetchData().

void CaliHVScanRatioDat::setTaskStatus ( bool  s)
inline

Definition at line 27 of file CaliHVScanRatioDat.h.

References m_taskStatus, and alignCSCRings::s.

Referenced by fetchData().

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

Definition at line 49 of file CaliHVScanRatioDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getTaskStatus().

51 {
52  this->checkConnection();
53  this->checkPrepare();
54 
55  int iovID = iov->fetchID();
56  if (!iovID) { throw(std::runtime_error("CaliHVScanRatioDat::writeDB: IOV not in DB")); }
57 
58  int logicID = ecid->getLogicID();
59  if (!logicID) { throw(std::runtime_error("CaliHVScanRatioDat::writeDB: Bad EcalLogicID")); }
60 
61  try {
62  m_writeStmt->setInt(1, iovID);
63  m_writeStmt->setInt(2, logicID);
64 
65  m_writeStmt->setFloat(3, item->getHVRatio() );
66  m_writeStmt->setFloat(4, item->getHVRatioRMS() );
67  m_writeStmt->setInt(5, item->getTaskStatus() );
68 
69  m_writeStmt->executeUpdate();
70  } catch (SQLException &e) {
71  throw(std::runtime_error(std::string("CaliHVScanRatioDat::writeDB(): ")+getOraMessage(&e)));
72  }
73 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
bool getTaskStatus() const
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int getLogicID() const
Definition: EcalLogicID.cc:41
float getHVRatioRMS() const
float getHVRatio() const
int fetchID() noexcept(false) override
Definition: CaliIOV.cc:79

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file CaliHVScanRatioDat.h.

Member Data Documentation

float CaliHVScanRatioDat::m_hvratio
private

Definition at line 41 of file CaliHVScanRatioDat.h.

Referenced by getHVRatio(), and setHVRatio().

float CaliHVScanRatioDat::m_hvratioRMS
private

Definition at line 42 of file CaliHVScanRatioDat.h.

Referenced by getHVRatioRMS(), and setHVRatioRMS().

bool CaliHVScanRatioDat::m_taskStatus
private

Definition at line 43 of file CaliHVScanRatioDat.h.

Referenced by getTaskStatus(), and setTaskStatus().