CMS 3D CMS Logo

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

#include <ODBadTTDat.h>

Inheritance diagram for ODBadTTDat:
IODConfig IDBObject

Public Member Functions

int getFedId () const
 
int getId () const
 
int getSMId () const
 
int getStatus () const
 
std::string getTable () override
 
int getTRId () const
 
int getTTId () const
 
 ODBadTTDat ()
 
void setFedId (int dac)
 
void setId (int dac)
 
void setSMId (int dac)
 
void setStatus (int dac)
 
void setTRId (int dac)
 
void setTTId (int dac)
 
 ~ODBadTTDat () 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< ODBadTTDat > *fillMap, ODBadTTInfo *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::vector< ODBadTTDat > &data, ODBadTTInfo *iov) noexcept(false)
 
void writeDB (const ODBadTTDat *item, ODBadTTInfo *iov) noexcept(false)
 

Private Attributes

int m_fed
 
int m_ID
 
int m_sm
 
int m_t1
 
int m_tt
 

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 int const 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 ODBadTTDat.h.

Constructor & Destructor Documentation

ODBadTTDat::ODBadTTDat ( )

Definition at line 10 of file ODBadTTDat.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_t1 = 0;
20 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
Statement * m_writeStmt
Definition: IODConfig.h:33
Statement * m_readStmt
Definition: IODConfig.h:34
ODBadTTDat::~ODBadTTDat ( )
override

Definition at line 22 of file ODBadTTDat.cc.

22 {}

Member Function Documentation

void ODBadTTDat::fetchData ( std::vector< ODBadTTDat > *  fillMap,
ODBadTTInfo iov 
)
privatenoexcept

Definition at line 53 of file ODBadTTDat.cc.

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

Referenced by getStatus().

53  {
54  this->checkConnection();
55 
56  iov->setConnection(m_env, m_conn);
57  int iovID = iov->fetchID();
58  if (!iovID) {
59  // throw(std::runtime_error("ODBadTTDat::writeDB: IOV not in DB"));
60  return;
61  }
62 
63  try {
64  m_readStmt->setSQL("SELECT * FROM " + getTable() + " WHERE rec_id = :rec_id order by tr_id, fed_id, tt_id ");
65  m_readStmt->setInt(1, iovID);
66  ResultSet* rset = m_readStmt->executeQuery();
67 
68  // std::vector< ODBadTTDat > p;
69  ODBadTTDat dat;
70  while (rset->next()) {
71  // dat.setId( rset->getInt(1) );
72  dat.setTRId(rset->getInt(2));
73  dat.setFedId(rset->getInt(3));
74  dat.setTTId(rset->getInt(4));
75  dat.setStatus(rset->getInt(5));
76 
77  p->push_back(dat);
78  }
79  } catch (SQLException& e) {
80  throw(std::runtime_error("ODBadTTDat::fetchData(): " + e.getMessage()));
81  }
82 }
void setFedId(int dac)
Definition: ODBadTTDat.h:28
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void setTRId(int dac)
Definition: ODBadTTDat.h:25
void setTTId(int dac)
Definition: ODBadTTDat.h:31
std::string getTable() override
Definition: ODBadTTDat.h:17
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void setStatus(int dac)
Definition: ODBadTTDat.h:34
int fetchID() noexcept(false)
Definition: ODBadTTInfo.cc:142
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
Statement * m_readStmt
Definition: IODConfig.h:34
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
int ODBadTTDat::getFedId ( ) const
inline

Definition at line 29 of file ODBadTTDat.h.

References m_fed.

Referenced by writeArrayDB().

29 { return m_fed; }
int ODBadTTDat::getId ( void  ) const
inline

Definition at line 20 of file ODBadTTDat.h.

References m_ID.

20 { return m_ID; }
int ODBadTTDat::getSMId ( ) const
inline

Definition at line 23 of file ODBadTTDat.h.

References m_sm.

23 { return m_sm; }
int ODBadTTDat::getStatus ( ) const
inline

Definition at line 35 of file ODBadTTDat.h.

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

Referenced by writeArrayDB().

35 { return m_t1; }
std::string ODBadTTDat::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 17 of file ODBadTTDat.h.

17 { return "BAD_TT_DAT"; }
int ODBadTTDat::getTRId ( ) const
inline

Definition at line 26 of file ODBadTTDat.h.

References m_sm.

Referenced by writeArrayDB().

26 { return m_sm; }
int ODBadTTDat::getTTId ( ) const
inline

Definition at line 32 of file ODBadTTDat.h.

References m_tt.

Referenced by writeArrayDB().

32 { return m_tt; }
void ODBadTTDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 24 of file ODBadTTDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getStatus().

24  {
25  this->checkConnection();
26 
27  try {
28  m_writeStmt = m_conn->createStatement();
29  m_writeStmt->setSQL("INSERT INTO " + getTable() +
30  " (rec_id, tr_id, fed_id, tt_id, status ) "
31  "VALUES (:1, :2, :3, :4, :5 )");
32  } catch (SQLException& e) {
33  throw(std::runtime_error("ODBadTTDat::prepareWrite(): " + e.getMessage()));
34  }
35 }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
Statement * m_writeStmt
Definition: IODConfig.h:33
std::string getTable() override
Definition: ODBadTTDat.h:17
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
void ODBadTTDat::setFedId ( int  dac)
inline

Definition at line 28 of file ODBadTTDat.h.

References m_fed.

Referenced by fetchData().

28 { m_fed = dac; }
void ODBadTTDat::setId ( int  dac)
inline

Definition at line 19 of file ODBadTTDat.h.

References m_ID.

19 { m_ID = dac; }
void ODBadTTDat::setSMId ( int  dac)
inline

Definition at line 22 of file ODBadTTDat.h.

References m_sm.

22 { m_sm = dac; }
void ODBadTTDat::setStatus ( int  dac)
inline

Definition at line 34 of file ODBadTTDat.h.

References m_t1.

Referenced by fetchData().

34 { m_t1 = dac; }
void ODBadTTDat::setTRId ( int  dac)
inline

Definition at line 25 of file ODBadTTDat.h.

References m_sm.

Referenced by fetchData().

25 { m_sm = dac; }
void ODBadTTDat::setTTId ( int  dac)
inline

Definition at line 31 of file ODBadTTDat.h.

References m_tt.

Referenced by fetchData().

31 { m_tt = dac; }
void ODBadTTDat::writeArrayDB ( const std::vector< ODBadTTDat > &  data,
ODBadTTInfo iov 
)
privatenoexcept

Definition at line 86 of file ODBadTTDat.cc.

References KineDebug3::count(), data, MillePedeFileConverter_cfg::e, getFedId(), getStatus(), getTRId(), getTTId(), photons_cff::ids, geometryCSVtoXML::xx, geometryCSVtoXML::yy, and geometryCSVtoXML::zz.

Referenced by getStatus().

86  {
87  this->checkConnection();
88 
89  int iovID = iov->fetchID();
90  if (!iovID) {
91  throw(std::runtime_error("ODDelays::writeArrayDB: ODBadTTInfo not in DB"));
92  }
93 
94  int nrows = data.size();
95  int* ids = new int[nrows];
96  int* xx = new int[nrows];
97  int* yy = new int[nrows];
98  int* zz = new int[nrows];
99  int* st = new int[nrows];
100 
101  ub2* ids_len = new ub2[nrows];
102  ub2* x_len = new ub2[nrows];
103  ub2* y_len = new ub2[nrows];
104  ub2* z_len = new ub2[nrows];
105  ub2* st_len = new ub2[nrows];
106 
107  ODBadTTDat dataitem;
108 
109  for (size_t count = 0; count != data.size(); count++) {
110  dataitem = data[count];
111  ids[count] = iovID;
112  xx[count] = dataitem.getTRId();
113  yy[count] = dataitem.getFedId();
114  zz[count] = dataitem.getTTId();
115  st[count] = dataitem.getStatus();
116 
117  ids_len[count] = sizeof(ids[count]);
118  x_len[count] = sizeof(xx[count]);
119  y_len[count] = sizeof(yy[count]);
120  z_len[count] = sizeof(zz[count]);
121  st_len[count] = sizeof(st[count]);
122  }
123 
124  try {
125  m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
126  m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len);
127  m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT, sizeof(yy[0]), y_len);
128  m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT, sizeof(zz[0]), z_len);
129  m_writeStmt->setDataBuffer(5, (dvoid*)st, OCCIINT, sizeof(st[0]), st_len);
130 
131  m_writeStmt->executeArrayUpdate(nrows);
132 
133  delete[] ids;
134  delete[] xx;
135  delete[] yy;
136  delete[] zz;
137  delete[] st;
138 
139  delete[] ids_len;
140  delete[] x_len;
141  delete[] y_len;
142  delete[] z_len;
143  delete[] st_len;
144 
145  } catch (SQLException& e) {
146  throw(std::runtime_error("ODBadTTDat::writeArrayDB(): " + e.getMessage()));
147  }
148 }
int getTTId() const
Definition: ODBadTTDat.h:32
Statement * m_writeStmt
Definition: IODConfig.h:33
int getTRId() const
Definition: ODBadTTDat.h:26
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
int fetchID() noexcept(false)
Definition: ODBadTTInfo.cc:142
int getStatus() const
Definition: ODBadTTDat.h:35
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
int getFedId() const
Definition: ODBadTTDat.h:29
void ODBadTTDat::writeDB ( const ODBadTTDat item,
ODBadTTInfo iov 
)
privatenoexcept

Definition at line 37 of file ODBadTTDat.cc.

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

Referenced by getStatus().

37  {
38  this->checkConnection();
39 
40  try {
41  m_writeStmt->setInt(1, item->getId());
42  m_writeStmt->setInt(2, item->getTRId());
43  m_writeStmt->setInt(3, item->getFedId());
44  m_writeStmt->setInt(4, item->getTTId());
45  m_writeStmt->setInt(5, item->getStatus());
46 
47  m_writeStmt->executeUpdate();
48  } catch (SQLException& e) {
49  throw(std::runtime_error("ODBadTTDat::writeDB(): " + e.getMessage()));
50  }
51 }
int getTTId() const
Definition: ODBadTTDat.h:32
Statement * m_writeStmt
Definition: IODConfig.h:33
int getTRId() const
Definition: ODBadTTDat.h:26
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
int getId() const
Definition: ODBadTTDat.h:20
int getStatus() const
Definition: ODBadTTDat.h:35
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
int getFedId() const
Definition: ODBadTTDat.h:29

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 12 of file ODBadTTDat.h.

Member Data Documentation

int ODBadTTDat::m_fed
private

Definition at line 48 of file ODBadTTDat.h.

Referenced by getFedId(), and setFedId().

int ODBadTTDat::m_ID
private

Definition at line 51 of file ODBadTTDat.h.

Referenced by getId(), and setId().

int ODBadTTDat::m_sm
private

Definition at line 47 of file ODBadTTDat.h.

Referenced by getSMId(), getTRId(), setSMId(), and setTRId().

int ODBadTTDat::m_t1
private

Definition at line 50 of file ODBadTTDat.h.

Referenced by getStatus(), and setStatus().

int ODBadTTDat::m_tt
private

Definition at line 49 of file ODBadTTDat.h.

Referenced by getTTId(), and setTTId().