CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
FEConfigBadTTDat Class Reference

#include <FEConfigBadTTDat.h>

Inheritance diagram for FEConfigBadTTDat:
IODConfig IDBObject

Public Member Functions

 FEConfigBadTTDat ()
 
int getFedId () const
 
int getId () const
 
int getStatus () const
 
std::string getTable () override
 
int getTCCId () const
 
int getTTId () const
 
void setFedId (int x)
 
void setId (int dac)
 
void setStatus (int dac)
 
void setTCCId (int dac)
 
void setTTId (int dac)
 
 ~FEConfigBadTTDat () 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< FEConfigBadTTDat > *fillMap, FEConfigBadTTInfo *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::vector< FEConfigBadTTDat > &data, FEConfigBadTTInfo *iov) noexcept(false)
 
void writeDB (const FEConfigBadTTDat *item, FEConfigBadTTInfo *iov) noexcept(false)
 

Private Attributes

int m_fed
 
int m_ID
 
int m_t1
 
int m_tcc
 
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 FEConfigBadTTDat.h.

Constructor & Destructor Documentation

◆ FEConfigBadTTDat()

FEConfigBadTTDat::FEConfigBadTTDat ( )

Definition at line 10 of file FEConfigBadTTDat.cc.

10  {
11  m_env = nullptr;
12  m_conn = nullptr;
13  m_writeStmt = nullptr;
14  m_readStmt = nullptr;
15 
16  m_tcc = 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

◆ ~FEConfigBadTTDat()

FEConfigBadTTDat::~FEConfigBadTTDat ( )
override

Definition at line 22 of file FEConfigBadTTDat.cc.

22 {}

Member Function Documentation

◆ fetchData()

void FEConfigBadTTDat::fetchData ( std::vector< FEConfigBadTTDat > *  fillMap,
FEConfigBadTTInfo iov 
)
privatenoexcept

Definition at line 53 of file FEConfigBadTTDat.cc.

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

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("FEConfigBadTTDat::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 tcc_id, fed_id, tt_id ");
65  m_readStmt->setInt(1, iovID);
66  ResultSet* rset = m_readStmt->executeQuery();
67 
68  // std::vector< FEConfigBadTTDat > p;
69  FEConfigBadTTDat dat;
70  while (rset->next()) {
71  // dat.setId( rset->getInt(1) );
72  dat.setTCCId(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("FEConfigBadTTDat::fetchData(): " + e.getMessage()));
81  }
82 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void setTCCId(int dac)
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void setFedId(int x)
std::string getTable() override
void setStatus(int dac)
void setTTId(int dac)
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 fetchID() noexcept(false)

◆ getFedId()

int FEConfigBadTTDat::getFedId ( ) const
inline

Definition at line 23 of file FEConfigBadTTDat.h.

References m_fed.

Referenced by writeArrayDB().

23 { return m_fed; }

◆ getId()

int FEConfigBadTTDat::getId ( void  ) const
inline

Definition at line 20 of file FEConfigBadTTDat.h.

References m_ID.

20 { return m_ID; }

◆ getStatus()

int FEConfigBadTTDat::getStatus ( ) const
inline

Definition at line 32 of file FEConfigBadTTDat.h.

References m_t1.

Referenced by popcon::EcalTPGBadTTHandler::getNewObjects(), and writeArrayDB().

32 { return m_t1; }

◆ getTable()

std::string FEConfigBadTTDat::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 17 of file FEConfigBadTTDat.h.

17 { return "FE_CONFIG_BadTT_DAT"; }

◆ getTCCId()

int FEConfigBadTTDat::getTCCId ( ) const
inline

Definition at line 26 of file FEConfigBadTTDat.h.

References m_tcc.

Referenced by popcon::EcalTPGBadTTHandler::getNewObjects(), and writeArrayDB().

26 { return m_tcc; }

◆ getTTId()

int FEConfigBadTTDat::getTTId ( ) const
inline

Definition at line 29 of file FEConfigBadTTDat.h.

References m_tt.

Referenced by popcon::EcalTPGBadTTHandler::getNewObjects(), and writeArrayDB().

29 { return m_tt; }

◆ prepareWrite()

void FEConfigBadTTDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 24 of file FEConfigBadTTDat.cc.

References MillePedeFileConverter_cfg::e.

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

◆ setFedId()

void FEConfigBadTTDat::setFedId ( int  x)
inline

Definition at line 22 of file FEConfigBadTTDat.h.

References m_fed, and x.

Referenced by fetchData().

◆ setId()

void FEConfigBadTTDat::setId ( int  dac)
inline

Definition at line 19 of file FEConfigBadTTDat.h.

References m_ID.

19 { m_ID = dac; }

◆ setStatus()

void FEConfigBadTTDat::setStatus ( int  dac)
inline

Definition at line 31 of file FEConfigBadTTDat.h.

References m_t1.

Referenced by fetchData().

31 { m_t1 = dac; }

◆ setTCCId()

void FEConfigBadTTDat::setTCCId ( int  dac)
inline

Definition at line 25 of file FEConfigBadTTDat.h.

References m_tcc.

Referenced by fetchData().

25 { m_tcc = dac; }

◆ setTTId()

void FEConfigBadTTDat::setTTId ( int  dac)
inline

Definition at line 28 of file FEConfigBadTTDat.h.

References m_tt.

Referenced by fetchData().

28 { m_tt = dac; }

◆ writeArrayDB()

void FEConfigBadTTDat::writeArrayDB ( const std::vector< FEConfigBadTTDat > &  data,
FEConfigBadTTInfo iov 
)
privatenoexcept

Definition at line 86 of file FEConfigBadTTDat.cc.

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

86  {
87  this->checkConnection();
88 
89  int iovID = iov->fetchID();
90  if (!iovID) {
91  throw(std::runtime_error("FEConfigDelays::writeArrayDB: FEConfigBadTTInfo 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  FEConfigBadTTDat dataitem;
108 
109  for (size_t count = 0; count != data.size(); count++) {
110  dataitem = data[count];
111  ids[count] = iovID;
112  xx[count] = dataitem.getTCCId();
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("FEConfigBadTTDat::writeArrayDB(): " + e.getMessage()));
147  }
148 }
int getStatus() const
int getFedId() const
Statement * m_writeStmt
Definition: IODConfig.h:33
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
int getTTId() const
int getTCCId() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
int fetchID() noexcept(false)

◆ writeDB()

void FEConfigBadTTDat::writeDB ( const FEConfigBadTTDat item,
FEConfigBadTTInfo iov 
)
privatenoexcept

Definition at line 37 of file FEConfigBadTTDat.cc.

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

37  {
38  this->checkConnection();
39 
40  try {
41  m_writeStmt->setInt(1, item->getId());
42  m_writeStmt->setInt(2, item->getTCCId());
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("FEConfigBadTTDat::writeDB(): " + e.getMessage()));
50  }
51 }
Statement * m_writeStmt
Definition: IODConfig.h:33
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 12 of file FEConfigBadTTDat.h.

Member Data Documentation

◆ m_fed

int FEConfigBadTTDat::m_fed
private

Definition at line 45 of file FEConfigBadTTDat.h.

Referenced by getFedId(), and setFedId().

◆ m_ID

int FEConfigBadTTDat::m_ID
private

Definition at line 48 of file FEConfigBadTTDat.h.

Referenced by getId(), and setId().

◆ m_t1

int FEConfigBadTTDat::m_t1
private

Definition at line 47 of file FEConfigBadTTDat.h.

Referenced by getStatus(), and setStatus().

◆ m_tcc

int FEConfigBadTTDat::m_tcc
private

Definition at line 44 of file FEConfigBadTTDat.h.

Referenced by getTCCId(), and setTCCId().

◆ m_tt

int FEConfigBadTTDat::m_tt
private

Definition at line 46 of file FEConfigBadTTDat.h.

Referenced by getTTId(), and setTTId().