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

Constructor & Destructor Documentation

ODBadXTDat::ODBadXTDat ( )

Definition at line 10 of file ODBadXTDat.cc.

11 {
12  m_env = nullptr;
13  m_conn = nullptr;
14  m_writeStmt = nullptr;
15  m_readStmt = nullptr;
16 
17  m_sm = 0;
18  m_fed = 0;
19  m_tt = 0;
20  m_xt = 0;
21  m_t1 = 0;
22 
23 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
Statement * m_writeStmt
Definition: IODConfig.h:36
Statement * m_readStmt
Definition: IODConfig.h:37
ODBadXTDat::~ODBadXTDat ( )
override

Definition at line 27 of file ODBadXTDat.cc.

28 {
29 }

Member Function Documentation

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

Definition at line 70 of file ODBadXTDat.cc.

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

Referenced by getStatus().

72 {
73  this->checkConnection();
74 
75  iov->setConnection(m_env, m_conn);
76  int iovID = iov->fetchID();
77  if (!iovID) {
78  // throw(std::runtime_error("ODBadXTDat::writeDB: IOV not in DB"));
79  return;
80  }
81 
82  try {
83  m_readStmt->setSQL("SELECT * FROM " + getTable() + "WHERE rec_id = :rec_id order by sm_id, fed_id, tt_id , xt_id ");
84  m_readStmt->setInt(1, iovID);
85  ResultSet* rset = m_readStmt->executeQuery();
86 
87  // std::vector< ODBadXTDat > p;
88  ODBadXTDat dat;
89  while(rset->next()) {
90  // dat.setId( rset->getInt(1) );
91  dat.setSMId( rset->getInt(2) );
92  dat.setFedId( rset->getInt(3) );
93  dat.setTTId( rset->getInt(4) );
94  dat.setXTId( rset->getInt(5) );
95  dat.setStatus( rset->getInt(6) );
96 
97  p->push_back( dat);
98 
99  }
100  } catch (SQLException &e) {
101  throw(std::runtime_error("ODBadXTDat::fetchData(): "+e.getMessage()));
102  }
103 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setStatus(int dac)
Definition: ODBadXTDat.h:35
int fetchID() noexcept(false)
Definition: ODBadXTInfo.cc:172
void setTTId(int dac)
Definition: ODBadXTDat.h:28
void setXTId(int dac)
Definition: ODBadXTDat.h:31
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
oracle::occi::SQLException SQLException
Definition: IODConfig.h:22
std::string getTable() override
Definition: ODBadXTDat.h:17
void setFedId(int dac)
Definition: ODBadXTDat.h:25
Statement * m_readStmt
Definition: IODConfig.h:37
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void setSMId(int dac)
Definition: ODBadXTDat.h:22
int ODBadXTDat::getFedId ( ) const
inline

Definition at line 26 of file ODBadXTDat.h.

References m_fed.

Referenced by writeArrayDB().

26 { return m_fed; }
int ODBadXTDat::getId ( void  ) const
inline

Definition at line 20 of file ODBadXTDat.h.

References m_ID.

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

Definition at line 23 of file ODBadXTDat.h.

References m_sm.

Referenced by writeArrayDB().

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

Definition at line 36 of file ODBadXTDat.h.

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

Referenced by writeArrayDB().

36 { return m_t1; }
std::string ODBadXTDat::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 17 of file ODBadXTDat.h.

17 { return "BAD_CRYSTALS_DAT"; }
int ODBadXTDat::getTTId ( ) const
inline

Definition at line 29 of file ODBadXTDat.h.

References m_tt.

Referenced by writeArrayDB().

29 { return m_tt; }
int ODBadXTDat::getXTId ( ) const
inline

Definition at line 32 of file ODBadXTDat.h.

References m_xt.

Referenced by writeArrayDB().

32 { return m_xt; }
void ODBadXTDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 33 of file ODBadXTDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getStatus().

35 {
36  this->checkConnection();
37 
38  try {
39  m_writeStmt = m_conn->createStatement();
40  m_writeStmt->setSQL("INSERT INTO "+getTable()+" (rec_id, sm_id, fed_id, tt_id, xt_id, status ) "
41  "VALUES (:1, :2, :3, :4, :5 ,:6 )");
42  } catch (SQLException &e) {
43  throw(std::runtime_error("ODBadXTDat::prepareWrite(): "+e.getMessage()));
44  }
45 }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
Statement * m_writeStmt
Definition: IODConfig.h:36
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
oracle::occi::SQLException SQLException
Definition: IODConfig.h:22
std::string getTable() override
Definition: ODBadXTDat.h:17
void ODBadXTDat::setFedId ( int  dac)
inline

Definition at line 25 of file ODBadXTDat.h.

References m_fed.

Referenced by fetchData().

25 { m_fed = dac; }
void ODBadXTDat::setId ( int  dac)
inline

Definition at line 19 of file ODBadXTDat.h.

References m_ID.

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

Definition at line 22 of file ODBadXTDat.h.

References m_sm.

Referenced by fetchData().

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

Definition at line 35 of file ODBadXTDat.h.

References m_t1.

Referenced by fetchData().

35 { m_t1 = dac; }
void ODBadXTDat::setTTId ( int  dac)
inline

Definition at line 28 of file ODBadXTDat.h.

References m_tt.

Referenced by fetchData().

28 { m_tt = dac; }
void ODBadXTDat::setXTId ( int  dac)
inline

Definition at line 31 of file ODBadXTDat.h.

References m_xt.

Referenced by fetchData().

31 { m_xt = dac; }
void ODBadXTDat::writeArrayDB ( const std::vector< ODBadXTDat > &  data,
ODBadXTInfo iov 
)
privatenoexcept

Definition at line 107 of file ODBadXTDat.cc.

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

Referenced by getStatus().

109 {
110  this->checkConnection();
111 
112  int iovID = iov->fetchID();
113  if (!iovID) { throw(std::runtime_error("ODDelays::writeArrayDB: ODBadXTInfo not in DB")); }
114 
115 
116  int nrows=data.size();
117  int* ids= new int[nrows];
118  int* xx= new int[nrows];
119  int* yy= new int[nrows];
120  int* zz= new int[nrows];
121  int* z1= new int[nrows];
122  int* st= new int[nrows];
123 
124 
125 
126  ub2* ids_len= new ub2[nrows];
127  ub2* x_len= new ub2[nrows];
128  ub2* y_len= new ub2[nrows];
129  ub2* z_len= new ub2[nrows];
130  ub2* z1_len= new ub2[nrows];
131  ub2* st_len= new ub2[nrows];
132 
133 
134  ODBadXTDat dataitem;
135 
136 
137  for (size_t count = 0; count != data.size(); count++) {
138  dataitem=data[count];
139  ids[count]=iovID;
140  xx[count]=dataitem.getSMId();
141  yy[count]=dataitem.getFedId();
142  zz[count]=dataitem.getTTId();
143  z1[count]=dataitem.getXTId();
144  st[count]=dataitem.getStatus();
145 
146 
147  ids_len[count]=sizeof(ids[count]);
148  x_len[count]=sizeof(xx[count]);
149  y_len[count]=sizeof(yy[count]);
150  z_len[count]=sizeof(zz[count]);
151  z1_len[count]=sizeof(z1[count]);
152  st_len[count]=sizeof(st[count]);
153 
154  }
155 
156 
157  try {
158  m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT, sizeof(ids[0]),ids_len);
159  m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len );
160  m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len );
161  m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT , sizeof(zz[0]), z_len );
162  m_writeStmt->setDataBuffer(5, (dvoid*)z1, OCCIINT , sizeof(z1[0]), z1_len );
163  m_writeStmt->setDataBuffer(6, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len );
164 
165  m_writeStmt->executeArrayUpdate(nrows);
166 
167  delete [] ids;
168  delete [] xx;
169  delete [] yy;
170  delete [] zz;
171  delete [] z1;
172  delete [] st;
173 
174  delete [] ids_len;
175  delete [] x_len;
176  delete [] y_len;
177  delete [] z_len;
178  delete [] z1_len;
179  delete [] st_len;
180 
181  } catch (SQLException &e) {
182  throw(std::runtime_error("ODBadXTDat::writeArrayDB(): "+e.getMessage()));
183  }
184 }
Statement * m_writeStmt
Definition: IODConfig.h:36
int getTTId() const
Definition: ODBadXTDat.h:29
int fetchID() noexcept(false)
Definition: ODBadXTInfo.cc:172
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int getSMId() const
Definition: ODBadXTDat.h:23
int getStatus() const
Definition: ODBadXTDat.h:36
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
oracle::occi::SQLException SQLException
Definition: IODConfig.h:22
int getFedId() const
Definition: ODBadXTDat.h:26
int getXTId() const
Definition: ODBadXTDat.h:32
void ODBadXTDat::writeDB ( const ODBadXTDat item,
ODBadXTInfo iov 
)
privatenoexcept

Definition at line 49 of file ODBadXTDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getStatus().

51 {
52  this->checkConnection();
53 
54  try {
55  m_writeStmt->setInt(1, item->getId());
56  m_writeStmt->setInt(2, item->getSMId());
57  m_writeStmt->setInt(3, item->getFedId() );
58  m_writeStmt->setInt(4, item->getTTId() );
59  m_writeStmt->setInt(5, item->getXTId() );
60  m_writeStmt->setInt(6, item->getStatus() );
61 
62  m_writeStmt->executeUpdate();
63  } catch (SQLException &e) {
64  throw(std::runtime_error("ODBadXTDat::writeDB(): "+e.getMessage()));
65  }
66 }
Statement * m_writeStmt
Definition: IODConfig.h:36
int getTTId() const
Definition: ODBadXTDat.h:29
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int getSMId() const
Definition: ODBadXTDat.h:23
int getStatus() const
Definition: ODBadXTDat.h:36
oracle::occi::SQLException SQLException
Definition: IODConfig.h:22
int getFedId() const
Definition: ODBadXTDat.h:26
int getId() const
Definition: ODBadXTDat.h:20
int getXTId() const
Definition: ODBadXTDat.h:32

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 12 of file ODBadXTDat.h.

Member Data Documentation

int ODBadXTDat::m_fed
private

Definition at line 54 of file ODBadXTDat.h.

Referenced by getFedId(), and setFedId().

int ODBadXTDat::m_ID
private

Definition at line 58 of file ODBadXTDat.h.

Referenced by getId(), and setId().

int ODBadXTDat::m_sm
private

Definition at line 53 of file ODBadXTDat.h.

Referenced by getSMId(), and setSMId().

int ODBadXTDat::m_t1
private

Definition at line 57 of file ODBadXTDat.h.

Referenced by getStatus(), and setStatus().

int ODBadXTDat::m_tt
private

Definition at line 55 of file ODBadXTDat.h.

Referenced by getTTId(), and setTTId().

int ODBadXTDat::m_xt
private

Definition at line 56 of file ODBadXTDat.h.

Referenced by getXTId(), and setXTId().