CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
bool getTaskStatus () const
 
void setHVRatio (float c)
 
void setHVRatioRMS (float c)
 
void setTaskStatus (bool s)
 
 ~CaliHVScanRatioDat ()
 
- 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) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const CaliHVScanRatioDat *item, CaliIOV *iov) throw (std::runtime_error)
 

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 () throw (std::runtime_error)
 
void createReadStatement () throw (std::runtime_error)
 
void setPrefetchRowCount (int ncount) throw (std::runtime_error)
 
void terminateReadStatement () throw (std::runtime_error)
 
void terminateWriteStatement () throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 
- 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.

References NULL.

13 {
14  m_env = NULL;
15  m_conn = NULL;
16  m_writeStmt = NULL;
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
#define NULL
Definition: scimark2.h:8
CaliHVScanRatioDat::~CaliHVScanRatioDat ( )

Definition at line 25 of file CaliHVScanRatioDat.cc.

26 {
27 }

Member Function Documentation

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

Definition at line 77 of file CaliHVScanRatioDat.cc.

References dat, alignCSCRings::e, o2o::iov, AlCaHLTBitMon_ParallelJobs::p, setHVRatio(), setHVRatioRMS(), and setTaskStatus().

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;
102  while(rset->next()) {
103  p.first = EcalLogicID( rset->getString(1), // name
104  rset->getInt(2), // logic_id
105  rset->getInt(3), // id1
106  rset->getInt(4), // id2
107  rset->getInt(5), // id3
108  rset->getString(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("CaliHVScanRatioDat::fetchData(): "+e.getMessage()));
119  }
120 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setTaskStatus(bool s)
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void setHVRatio(float c)
int fetchID()
Definition: CaliIOV.cc:79
static std::vector< std::string > checklist dat
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void setHVRatioRMS(float c)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void checkConnection() const
Definition: IDBObject.h:41
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 ( )
inlinevirtual

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 m_taskStatus.

28 { return m_taskStatus; }
void CaliHVScanRatioDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 31 of file CaliHVScanRatioDat.cc.

References alignCSCRings::e.

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("CaliHVScanRatioDat::prepareWrite(): "+e.getMessage()));
44  }
45 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const
Definition: IDBObject.h:41
void CaliHVScanRatioDat::setHVRatio ( float  c)
inline

Definition at line 21 of file CaliHVScanRatioDat.h.

References trackerHits::c, and m_hvratio.

Referenced by fetchData().

21 { m_hvratio = c; }
void CaliHVScanRatioDat::setHVRatioRMS ( float  c)
inline

Definition at line 24 of file CaliHVScanRatioDat.h.

References trackerHits::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 
)
throw (std::runtime_error
)
private

Definition at line 49 of file CaliHVScanRatioDat.cc.

References alignCSCRings::e, and o2o::iov.

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("CaliHVScanRatioDat::writeDB(): "+e.getMessage()));
72  }
73 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
bool getTaskStatus() const
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
int getLogicID() const
Definition: EcalLogicID.cc:41
int fetchID()
Definition: CaliIOV.cc:79
float getHVRatioRMS() const
void checkPrepare()
Definition: IDataItem.h:31
float getHVRatio() const
void checkConnection() const
Definition: IDBObject.h:41

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().