CMS 3D CMS Logo

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

#include <ODBadXTDat.h>

Inheritance diagram for ODBadXTDat:
IODConfig IDBObject

Public Member Functions

int getFedId () const
 
int getId () const
 
int getSMId () const
 
int getStatus () const
 
std::string getTable () override
 
int getTTId () const
 
int getXTId () const
 
 ODBadXTDat ()
 
void setFedId (int dac)
 
void setId (int dac)
 
void setSMId (int dac)
 
void setStatus (int dac)
 
void setTTId (int dac)
 
void setXTId (int dac)
 
 ~ODBadXTDat () override
 
- Public Member Functions inherited from IODConfig
std::string getConfigTag ()
 
void setConfigTag (std::string x)
 
- 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::vector< ODBadXTDat > *fillMap, ODBadXTInfo *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::vector< ODBadXTDat > &data, ODBadXTInfo *iov) noexcept(false)
 
void writeDB (const ODBadXTDat *item, ODBadXTInfo *iov) noexcept(false)
 

Private Attributes

int m_fed
 
int m_ID
 
int m_sm
 
int m_t1
 
int m_tt
 
int m_xt
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Public Types inherited from IODConfig
typedef oracle::occi::Clob Clob
 
typedef oracle::occi::SQLException SQLException
 
typedef oracle::occi::Statement Statement
 
typedef oracle::occi::Stream Stream
 
- Public Attributes inherited from IODConfig
std::string m_config_tag
 
- Static Public Attributes inherited from IDBObject
static const int ECALDB_NROWS = 1024
 
- Protected Member Functions inherited from IODConfig
void checkPrepare () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void populateClob (Clob &clob, std::string fname, unsigned int bufsize) noexcept(false)
 
unsigned char * readClob (Clob &clob, int size) 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 IODConfig
Statementm_readStmt
 
Statementm_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 10 of file ODBadXTDat.h.

Constructor & Destructor Documentation

◆ ODBadXTDat()

ODBadXTDat::ODBadXTDat ( )

Definition at line 10 of file ODBadXTDat.cc.

10  {
11  m_env = nullptr;
12  m_conn = nullptr;
13  m_writeStmt = nullptr;
14  m_readStmt = nullptr;
15 
16  m_sm = 0;
17  m_fed = 0;
18  m_tt = 0;
19  m_xt = 0;
20  m_t1 = 0;
21 }

◆ ~ODBadXTDat()

ODBadXTDat::~ODBadXTDat ( )
override

Definition at line 23 of file ODBadXTDat.cc.

23 {}

Member Function Documentation

◆ fetchData()

void ODBadXTDat::fetchData ( std::vector< ODBadXTDat > *  fillMap,
ODBadXTInfo iov 
)
privatenoexcept

Definition at line 55 of file ODBadXTDat.cc.

55  {
56  this->checkConnection();
57 
58  iov->setConnection(m_env, m_conn);
59  int iovID = iov->fetchID();
60  if (!iovID) {
61  // throw(std::runtime_error("ODBadXTDat::writeDB: IOV not in DB"));
62  return;
63  }
64 
65  try {
66  m_readStmt->setSQL("SELECT * FROM " + getTable() + "WHERE rec_id = :rec_id order by sm_id, fed_id, tt_id , xt_id ");
67  m_readStmt->setInt(1, iovID);
68  ResultSet* rset = m_readStmt->executeQuery();
69 
70  // std::vector< ODBadXTDat > p;
71  ODBadXTDat dat;
72  while (rset->next()) {
73  // dat.setId( rset->getInt(1) );
74  dat.setSMId(rset->getInt(2));
75  dat.setFedId(rset->getInt(3));
76  dat.setTTId(rset->getInt(4));
77  dat.setXTId(rset->getInt(5));
78  dat.setStatus(rset->getInt(6));
79 
80  p->push_back(dat);
81  }
82  } catch (SQLException& e) {
83  throw(std::runtime_error("ODBadXTDat::fetchData(): " + e.getMessage()));
84  }
85 }

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setFedId(), setSMId(), setStatus(), setTTId(), and setXTId().

◆ getFedId()

int ODBadXTDat::getFedId ( ) const
inline

Definition at line 26 of file ODBadXTDat.h.

26 { return m_fed; }

References m_fed.

Referenced by writeArrayDB().

◆ getId()

int ODBadXTDat::getId ( void  ) const
inline

Definition at line 20 of file ODBadXTDat.h.

20 { return m_ID; }

References m_ID.

◆ getSMId()

int ODBadXTDat::getSMId ( ) const
inline

Definition at line 23 of file ODBadXTDat.h.

23 { return m_sm; }

References m_sm.

Referenced by writeArrayDB().

◆ getStatus()

int ODBadXTDat::getStatus ( ) const
inline

Definition at line 35 of file ODBadXTDat.h.

35 { return m_t1; }

References m_t1.

Referenced by writeArrayDB().

◆ getTable()

std::string ODBadXTDat::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 17 of file ODBadXTDat.h.

17 { return "BAD_CRYSTALS_DAT"; }

◆ getTTId()

int ODBadXTDat::getTTId ( ) const
inline

Definition at line 29 of file ODBadXTDat.h.

29 { return m_tt; }

References m_tt.

Referenced by writeArrayDB().

◆ getXTId()

int ODBadXTDat::getXTId ( ) const
inline

Definition at line 32 of file ODBadXTDat.h.

32 { return m_xt; }

References m_xt.

Referenced by writeArrayDB().

◆ prepareWrite()

void ODBadXTDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 25 of file ODBadXTDat.cc.

25  {
26  this->checkConnection();
27 
28  try {
29  m_writeStmt = m_conn->createStatement();
30  m_writeStmt->setSQL("INSERT INTO " + getTable() +
31  " (rec_id, sm_id, fed_id, tt_id, xt_id, status ) "
32  "VALUES (:1, :2, :3, :4, :5 ,:6 )");
33  } catch (SQLException& e) {
34  throw(std::runtime_error("ODBadXTDat::prepareWrite(): " + e.getMessage()));
35  }
36 }

References MillePedeFileConverter_cfg::e.

◆ setFedId()

void ODBadXTDat::setFedId ( int  dac)
inline

Definition at line 25 of file ODBadXTDat.h.

25 { m_fed = dac; }

References m_fed.

Referenced by fetchData().

◆ setId()

void ODBadXTDat::setId ( int  dac)
inline

Definition at line 19 of file ODBadXTDat.h.

19 { m_ID = dac; }

References m_ID.

◆ setSMId()

void ODBadXTDat::setSMId ( int  dac)
inline

Definition at line 22 of file ODBadXTDat.h.

22 { m_sm = dac; }

References m_sm.

Referenced by fetchData().

◆ setStatus()

void ODBadXTDat::setStatus ( int  dac)
inline

Definition at line 34 of file ODBadXTDat.h.

34 { m_t1 = dac; }

References m_t1.

Referenced by fetchData().

◆ setTTId()

void ODBadXTDat::setTTId ( int  dac)
inline

Definition at line 28 of file ODBadXTDat.h.

28 { m_tt = dac; }

References m_tt.

Referenced by fetchData().

◆ setXTId()

void ODBadXTDat::setXTId ( int  dac)
inline

Definition at line 31 of file ODBadXTDat.h.

31 { m_xt = dac; }

References m_xt.

Referenced by fetchData().

◆ writeArrayDB()

void ODBadXTDat::writeArrayDB ( const std::vector< ODBadXTDat > &  data,
ODBadXTInfo iov 
)
privatenoexcept

Definition at line 89 of file ODBadXTDat.cc.

89  {
90  this->checkConnection();
91 
92  int iovID = iov->fetchID();
93  if (!iovID) {
94  throw(std::runtime_error("ODDelays::writeArrayDB: ODBadXTInfo not in DB"));
95  }
96 
97  int nrows = data.size();
98  int* ids = new int[nrows];
99  int* xx = new int[nrows];
100  int* yy = new int[nrows];
101  int* zz = new int[nrows];
102  int* z1 = new int[nrows];
103  int* st = new int[nrows];
104 
105  ub2* ids_len = new ub2[nrows];
106  ub2* x_len = new ub2[nrows];
107  ub2* y_len = new ub2[nrows];
108  ub2* z_len = new ub2[nrows];
109  ub2* z1_len = new ub2[nrows];
110  ub2* st_len = new ub2[nrows];
111 
112  ODBadXTDat dataitem;
113 
114  for (size_t count = 0; count != data.size(); count++) {
115  dataitem = data[count];
116  ids[count] = iovID;
117  xx[count] = dataitem.getSMId();
118  yy[count] = dataitem.getFedId();
119  zz[count] = dataitem.getTTId();
120  z1[count] = dataitem.getXTId();
121  st[count] = dataitem.getStatus();
122 
123  ids_len[count] = sizeof(ids[count]);
124  x_len[count] = sizeof(xx[count]);
125  y_len[count] = sizeof(yy[count]);
126  z_len[count] = sizeof(zz[count]);
127  z1_len[count] = sizeof(z1[count]);
128  st_len[count] = sizeof(st[count]);
129  }
130 
131  try {
132  m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
133  m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len);
134  m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT, sizeof(yy[0]), y_len);
135  m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT, sizeof(zz[0]), z_len);
136  m_writeStmt->setDataBuffer(5, (dvoid*)z1, OCCIINT, sizeof(z1[0]), z1_len);
137  m_writeStmt->setDataBuffer(6, (dvoid*)st, OCCIINT, sizeof(st[0]), st_len);
138 
139  m_writeStmt->executeArrayUpdate(nrows);
140 
141  delete[] ids;
142  delete[] xx;
143  delete[] yy;
144  delete[] zz;
145  delete[] z1;
146  delete[] st;
147 
148  delete[] ids_len;
149  delete[] x_len;
150  delete[] y_len;
151  delete[] z_len;
152  delete[] z1_len;
153  delete[] st_len;
154 
155  } catch (SQLException& e) {
156  throw(std::runtime_error("ODBadXTDat::writeArrayDB(): " + e.getMessage()));
157  }
158 }

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, getFedId(), getSMId(), getStatus(), getTTId(), getXTId(), geometryCSVtoXML::xx, geometryCSVtoXML::yy, and geometryCSVtoXML::zz.

◆ writeDB()

void ODBadXTDat::writeDB ( const ODBadXTDat item,
ODBadXTInfo iov 
)
privatenoexcept

Definition at line 38 of file ODBadXTDat.cc.

38  {
39  this->checkConnection();
40 
41  try {
42  m_writeStmt->setInt(1, item->getId());
43  m_writeStmt->setInt(2, item->getSMId());
44  m_writeStmt->setInt(3, item->getFedId());
45  m_writeStmt->setInt(4, item->getTTId());
46  m_writeStmt->setInt(5, item->getXTId());
47  m_writeStmt->setInt(6, item->getStatus());
48 
49  m_writeStmt->executeUpdate();
50  } catch (SQLException& e) {
51  throw(std::runtime_error("ODBadXTDat::writeDB(): " + e.getMessage()));
52  }
53 }

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 12 of file ODBadXTDat.h.

Member Data Documentation

◆ m_fed

int ODBadXTDat::m_fed
private

Definition at line 48 of file ODBadXTDat.h.

Referenced by getFedId(), and setFedId().

◆ m_ID

int ODBadXTDat::m_ID
private

Definition at line 52 of file ODBadXTDat.h.

Referenced by getId(), and setId().

◆ m_sm

int ODBadXTDat::m_sm
private

Definition at line 47 of file ODBadXTDat.h.

Referenced by getSMId(), and setSMId().

◆ m_t1

int ODBadXTDat::m_t1
private

Definition at line 51 of file ODBadXTDat.h.

Referenced by getStatus(), and setStatus().

◆ m_tt

int ODBadXTDat::m_tt
private

Definition at line 49 of file ODBadXTDat.h.

Referenced by getTTId(), and setTTId().

◆ m_xt

int ODBadXTDat::m_xt
private

Definition at line 50 of file ODBadXTDat.h.

Referenced by getXTId(), and setXTId().

ODBadXTDat::getXTId
int getXTId() const
Definition: ODBadXTDat.h:32
ODBadXTDat::setSMId
void setSMId(int dac)
Definition: ODBadXTDat.h:22
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
ODBadXTDat::m_t1
int m_t1
Definition: ODBadXTDat.h:51
ODBadXTDat::m_xt
int m_xt
Definition: ODBadXTDat.h:50
ODBadXTDat
Definition: ODBadXTDat.h:10
ODBadXTDat::getSMId
int getSMId() const
Definition: ODBadXTDat.h:23
ODBadXTDat::getId
int getId() const
Definition: ODBadXTDat.h:20
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ODBadXTDat::getTable
std::string getTable() override
Definition: ODBadXTDat.h:17
ODBadXTDat::getTTId
int getTTId() const
Definition: ODBadXTDat.h:29
IODConfig::SQLException
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
ODBadXTDat::getStatus
int getStatus() const
Definition: ODBadXTDat.h:35
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
ODBadXTDat::setFedId
void setFedId(int dac)
Definition: ODBadXTDat.h:25
ODBadXTDat::m_ID
int m_ID
Definition: ODBadXTDat.h:52
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
ODBadXTDat::m_sm
int m_sm
Definition: ODBadXTDat.h:47
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
IODConfig::m_readStmt
Statement * m_readStmt
Definition: IODConfig.h:34
ODBadXTDat::setXTId
void setXTId(int dac)
Definition: ODBadXTDat.h:31
ODBadXTDat::m_fed
int m_fed
Definition: ODBadXTDat.h:48
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
ODBadXTDat::m_tt
int m_tt
Definition: ODBadXTDat.h:49
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
IODConfig::m_writeStmt
Statement * m_writeStmt
Definition: IODConfig.h:33
ODBadXTDat::getFedId
int getFedId() const
Definition: ODBadXTDat.h:26
ODBadXTDat::setTTId
void setTTId(int dac)
Definition: ODBadXTDat.h:28
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
ODBadXTInfo::fetchID
int fetchID() noexcept(false)
Definition: ODBadXTInfo.cc:142
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
ODBadXTDat::setStatus
void setStatus(int dac)
Definition: ODBadXTDat.h:34