CMS 3D CMS Logo

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

#include <FEConfigTimingDat.h>

Inheritance diagram for FEConfigTimingDat:
IDataItem IDBObject

Public Member Functions

 FEConfigTimingDat ()
 
std::string getTable () override
 
int getTimingPar1 () const
 
int getTimingPar2 () const
 
void setTimingPar1 (int x)
 
void setTimingPar2 (int x)
 
 ~FEConfigTimingDat () override
 
- 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, FEConfigTimingDat > *fillMap, FEConfigTimingInfo *iconf) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigTimingDat > *data, FEConfigTimingInfo *iconf) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const FEConfigTimingDat *item, FEConfigTimingInfo *iconf) noexcept(false)
 

Private Attributes

int m_par1
 
int m_par2
 

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 () noexcept(false)
 
void createReadStatement () 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 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 11 of file FEConfigTimingDat.h.

Constructor & Destructor Documentation

FEConfigTimingDat::FEConfigTimingDat ( )

Definition at line 11 of file FEConfigTimingDat.cc.

12 {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_readStmt = nullptr;
17 
18  m_par1 = 0;
19  m_par2 = 0;
20 
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
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
FEConfigTimingDat::~FEConfigTimingDat ( )
override

Definition at line 25 of file FEConfigTimingDat.cc.

26 {
27 }

Member Function Documentation

void FEConfigTimingDat::fetchData ( std::map< EcalLogicID, FEConfigTimingDat > *  fillMap,
FEConfigTimingInfo iconf 
)
privatenoexcept

Definition at line 72 of file FEConfigTimingDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setTimingPar1(), setTimingPar2(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getTimingPar2().

74 {
75  this->checkConnection();
76  fillMap->clear();
77 
78  iconf->setConnection(m_env, m_conn);
79  int iconfID = iconf->fetchID();
80  if (!iconfID) {
81  return;
82  }
83 
84  try {
85 
86  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
87  "d.time_par1, d.time_par2 "
88  "FROM channelview cv JOIN " +getTable() + " d ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
89  "WHERE tim_conf_id = :tim_conf_id");
90  m_readStmt->setInt(1, iconfID);
91  ResultSet* rset = m_readStmt->executeQuery();
92 
93  std::pair< EcalLogicID, FEConfigTimingDat > p;
95  while(rset->next()) {
96  p.first = EcalLogicID( getOraString(rset,1), // name
97  rset->getInt(2), // logic_id
98  rset->getInt(3), // id1
99  rset->getInt(4), // id2
100  rset->getInt(5), // id3
101  getOraString(rset,6)); // maps_to
102 
103  dat.setTimingPar1( rset->getInt(7) );
104  dat.setTimingPar2( rset->getInt(8) );
105 
106  p.second = dat;
107  fillMap->insert(p);
108  }
109  } catch (SQLException &e) {
110  throw(std::runtime_error(std::string("FEConfigTimingDat::fetchData: ")+getOraMessage(&e)));
111  }
112 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setTimingPar2(int x)
std::string getTable() override
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void setTimingPar1(int x)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
int fetchID() noexcept(false)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
std::string FEConfigTimingDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigTimingDat.h.

18 { return "FE_CONFIG_Time_DAT"; }
int FEConfigTimingDat::getTimingPar1 ( ) const
inline

Definition at line 21 of file FEConfigTimingDat.h.

References m_par1.

Referenced by writeArrayDB().

21 { return m_par1; }
int FEConfigTimingDat::getTimingPar2 ( ) const
inline

Definition at line 23 of file FEConfigTimingDat.h.

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

Referenced by writeArrayDB().

23 { return m_par2; }
void FEConfigTimingDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 31 of file FEConfigTimingDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getTimingPar2().

33 {
34  this->checkConnection();
35 
36  try {
37  m_writeStmt = m_conn->createStatement();
38  m_writeStmt->setSQL("INSERT INTO "+getTable()+" (tim_conf_id, logic_id, "
39  "time_par1, time_par2 ) VALUES (:tim_conf_id, :logic_id, :time_par1, :time_par2 )" );
40  } catch (SQLException &e) {
41  throw(std::runtime_error(std::string("FEConfigTimingDat::prepareWrite(): ")+getOraMessage(&e)));
42  }
43 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string getTable() override
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void FEConfigTimingDat::setTimingPar1 ( int  x)
inline

Definition at line 20 of file FEConfigTimingDat.h.

References m_par1, and x.

Referenced by EcalTPGParamBuilder::analyze(), and fetchData().

void FEConfigTimingDat::setTimingPar2 ( int  x)
inline

Definition at line 22 of file FEConfigTimingDat.h.

References m_par2, and x.

Referenced by EcalTPGParamBuilder::analyze(), and fetchData().

void FEConfigTimingDat::writeArrayDB ( const std::map< EcalLogicID, FEConfigTimingDat > *  data,
FEConfigTimingInfo iconf 
)
privatenoexcept

Definition at line 114 of file FEConfigTimingDat.cc.

References KineDebug3::count(), data, MillePedeFileConverter_cfg::e, EcalLogicID::getLogicID(), getTimingPar1(), getTimingPar2(), AlCaHLTBitMon_ParallelJobs::p, AlCaHLTBitMon_QueryRunRegistry::string, x, geometryCSVtoXML::xx, y, and geometryCSVtoXML::yy.

Referenced by getTimingPar2().

116 {
117  this->checkConnection();
118  this->checkPrepare();
119 
120  int iconfID = iconf->fetchID();
121  if (!iconfID) { throw(std::runtime_error("FEConfigTimingDat::writeArrayDB: tim_conf_id not in DB")); }
122 
123 
124  int nrows=data->size();
125  int* ids= new int[nrows];
126  int* iconfid_vec= new int[nrows];
127  int* xx= new int[nrows];
128  int* yy= new int[nrows];
129 
130  ub2* ids_len= new ub2[nrows];
131  ub2* iconf_len= new ub2[nrows];
132  ub2* x_len= new ub2[nrows];
133  ub2* y_len= new ub2[nrows];
134 
135  const EcalLogicID* channel;
136  const FEConfigTimingDat* dataitem;
137  int count=0;
138  typedef map< EcalLogicID, FEConfigTimingDat >::const_iterator CI;
139  for (CI p = data->begin(); p != data->end(); ++p) {
140  channel = &(p->first);
141  int logicID = channel->getLogicID();
142  if (!logicID) { throw(std::runtime_error("FEConfigTimingDat::writeArrayDB: Bad EcalLogicID")); }
143  ids[count]=logicID;
144  iconfid_vec[count]=iconfID;
145 
146  dataitem = &(p->second);
147  // dataIface.writeDB( channel, dataitem, iconf);
148  int x=dataitem->getTimingPar1();
149  int y=dataitem->getTimingPar2();
150 
151  xx[count]=x;
152  yy[count]=y;
153 
154  ids_len[count]=sizeof(ids[count]);
155  iconf_len[count]=sizeof(iconfid_vec[count]);
156 
157  x_len[count]=sizeof(xx[count]);
158  y_len[count]=sizeof(yy[count]);
159 
160  count++;
161  }
162 
163 
164  try {
165  m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len);
166  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
167  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len );
168  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len );
169 
170  m_writeStmt->executeArrayUpdate(nrows);
171 
172  delete [] ids;
173  delete [] iconfid_vec;
174  delete [] xx;
175  delete [] yy;
176 
177  delete [] ids_len;
178  delete [] iconf_len;
179  delete [] x_len;
180  delete [] y_len;
181 
182  } catch (SQLException &e) {
183  throw(std::runtime_error(std::string("FEConfigTimingDat::writeArrayDB(): ")+getOraMessage(&e)));
184  }
185 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int getLogicID() const
Definition: EcalLogicID.cc:41
int getTimingPar2() const
int getTimingPar1() const
int fetchID() noexcept(false)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void FEConfigTimingDat::writeDB ( const EcalLogicID ecid,
const FEConfigTimingDat item,
FEConfigTimingInfo iconf 
)
privatenoexcept

Definition at line 46 of file FEConfigTimingDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getTimingPar2().

48 {
49  this->checkConnection();
50  this->checkPrepare();
51 
52  int iconfID = iconf->fetchID();
53  if (!iconfID) { throw(std::runtime_error("FEConfigTimingDat::writeDB: ICONF not in DB")); }
54 
55  int logicID = ecid->getLogicID();
56  if (!logicID) { throw(std::runtime_error("FEConfigTimingDat::writeDB: Bad EcalLogicID")); }
57 
58  try {
59  m_writeStmt->setInt(1, iconfID);
60  m_writeStmt->setInt(2, logicID);
61  m_writeStmt->setInt(3, item->getTimingPar1());
62  m_writeStmt->setInt(4, item->getTimingPar2());
63 
64  m_writeStmt->executeUpdate();
65  } catch (SQLException &e) {
66  throw(std::runtime_error(std::string("FEConfigTimingDat::writeDB(): ")+getOraMessage(&e)));
67  }
68 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int getLogicID() const
Definition: EcalLogicID.cc:41
int getTimingPar2() const
int getTimingPar1() const
int fetchID() noexcept(false)

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigTimingDat.h.

Member Data Documentation

int FEConfigTimingDat::m_par1
private

Definition at line 35 of file FEConfigTimingDat.h.

Referenced by getTimingPar1(), and setTimingPar1().

int FEConfigTimingDat::m_par2
private

Definition at line 36 of file FEConfigTimingDat.h.

Referenced by getTimingPar2(), and setTimingPar2().