CMS 3D CMS Logo

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

#include <FEConfigLinParamDat.h>

Inheritance diagram for FEConfigLinParamDat:
IDataItem IDBObject

Public Member Functions

 FEConfigLinParamDat ()
 
float getETSat () const
 
std::string getTable () override
 
void setETSat (float x)
 
 ~FEConfigLinParamDat () 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, FEConfigLinParamDat > *fillMap, FEConfigLinInfo *iconf) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigLinParamDat > *data, FEConfigLinInfo *iconf) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const FEConfigLinParamDat *item, FEConfigLinInfo *iconf) noexcept(false)
 

Private Attributes

float m_etsat
 

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

Constructor & Destructor Documentation

FEConfigLinParamDat::FEConfigLinParamDat ( )

Definition at line 11 of file FEConfigLinParamDat.cc.

12 {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_readStmt = nullptr;
17 
18  m_etsat = 0;
19 }
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
FEConfigLinParamDat::~FEConfigLinParamDat ( )
override

Definition at line 23 of file FEConfigLinParamDat.cc.

24 {
25 }

Member Function Documentation

void FEConfigLinParamDat::fetchData ( std::map< EcalLogicID, FEConfigLinParamDat > *  fillMap,
FEConfigLinInfo iconf 
)
privatenoexcept

Definition at line 72 of file FEConfigLinParamDat.cc.

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

Referenced by getETSat().

74 {
75  this->checkConnection();
76  fillMap->clear();
77 
78  iconf->setConnection(m_env, m_conn);
79  int iconfID = iconf->fetchID();
80  if (!iconfID) {
81  // throw(std::runtime_error("FEConfigLinParamDat::writeDB: ICONF not in DB"));
82  return;
83  }
84 
85  try {
86 
87  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
88  " d.etsat "
89  "FROM channelview cv JOIN "+getTable()+" d "
90  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
91  "WHERE lin_conf_id = :lin_conf_id");
92  m_readStmt->setInt(1, iconfID);
93  ResultSet* rset = m_readStmt->executeQuery();
94 
95  std::pair< EcalLogicID, FEConfigLinParamDat > p;
97  while(rset->next()) {
98  p.first = EcalLogicID( getOraString(rset,1), // name
99  rset->getInt(2), // logic_id
100  rset->getInt(3), // id1
101  rset->getInt(4), // id2
102  rset->getInt(5), // id3
103  getOraString(rset,6)); // maps_to
104 
105 
106 
107  dat.setETSat( rset->getFloat(7) );
108 
109  p.second = dat;
110  fillMap->insert(p);
111  }
112  } catch (SQLException &e) {
113  throw(std::runtime_error(std::string("FEConfigLinParamDat::fetchData: ")+getOraMessage(&e)));
114  }
115 }
std::string getTable() override
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
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
float FEConfigLinParamDat::getETSat ( ) const
inline
std::string FEConfigLinParamDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigLinParamDat.h.

18 { return "FE_CONFIG_LINPARAM_DAT"; }
void FEConfigLinParamDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 29 of file FEConfigLinParamDat.cc.

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

Referenced by getETSat().

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

Definition at line 21 of file FEConfigLinParamDat.h.

References m_etsat, and x.

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

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

Definition at line 117 of file FEConfigLinParamDat.cc.

References KineDebug3::count(), data, MillePedeFileConverter_cfg::e, getETSat(), EcalLogicID::getLogicID(), photons_cff::ids, AlCaHLTBitMon_ParallelJobs::p, AlCaHLTBitMon_QueryRunRegistry::string, x, and geometryCSVtoXML::xx.

Referenced by getETSat().

119 {
120  this->checkConnection();
121  this->checkPrepare();
122 
123  int iconfID = iconf->fetchID();
124  if (!iconfID) { throw(std::runtime_error("FEConfigLinParamDat::writeArrayDB: ICONF not in DB")); }
125 
126 
127  int nrows=data->size();
128  int* ids= new int[nrows];
129  int* iov_vec= new int[nrows];
130  float* xx= new float[nrows];
131 
132 
133  ub2* ids_len= new ub2[nrows];
134  ub2* iov_len= new ub2[nrows];
135  ub2* x_len= new ub2[nrows];
136 
137  const EcalLogicID* channel;
138  const FEConfigLinParamDat* dataitem;
139  int count=0;
140  typedef map< EcalLogicID, FEConfigLinParamDat >::const_iterator CI;
141  for (CI p = data->begin(); p != data->end(); ++p) {
142  channel = &(p->first);
143  int logicID = channel->getLogicID();
144  if (!logicID) { throw(std::runtime_error("FEConfigLinParamDat::writeArrayDB: Bad EcalLogicID")); }
145  ids[count]=logicID;
146  iov_vec[count]=iconfID;
147 
148  dataitem = &(p->second);
149  float x=dataitem->getETSat();
150 
151  xx[count]=x;
152 
153  ids_len[count]=sizeof(ids[count]);
154  iov_len[count]=sizeof(iov_vec[count]);
155  x_len[count]=sizeof(xx[count]);
156 
157  count++;
158  }
159 
160 
161  try {
162  m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT, sizeof(iov_vec[0]),iov_len);
163  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
164  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len );
165 
166  m_writeStmt->executeArrayUpdate(nrows);
167 
168  delete [] ids;
169  delete [] iov_vec;
170  delete [] xx;
171 
172  delete [] ids_len;
173  delete [] iov_len;
174  delete [] x_len;
175 
176  } catch (SQLException &e) {
177  throw(std::runtime_error(std::string("FEConfigLinParamDat::writeArrayDB(): ")+getOraMessage(&e)));
178  }
179 }
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 fetchID() noexcept(false)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void FEConfigLinParamDat::writeDB ( const EcalLogicID ecid,
const FEConfigLinParamDat item,
FEConfigLinInfo iconf 
)
privatenoexcept

Definition at line 47 of file FEConfigLinParamDat.cc.

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

Referenced by getETSat().

49 {
50  this->checkConnection();
51  this->checkPrepare();
52 
53  int iconfID = iconf->fetchID();
54  if (!iconfID) { throw(std::runtime_error("FEConfigLinParamDat::writeDB: ICONF not in DB")); }
55 
56  int logicID = ecid->getLogicID();
57  if (!logicID) { throw(std::runtime_error("FEConfigLinParamDat::writeDB: Bad EcalLogicID")); }
58 
59  try {
60  m_writeStmt->setInt(1, iconfID);
61  m_writeStmt->setInt(2, logicID);
62  m_writeStmt->setFloat(3, item->getETSat());
63 
64  m_writeStmt->executeUpdate();
65  } catch (SQLException &e) {
66  throw(std::runtime_error(std::string("FEConfigLinParamDat::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 fetchID() noexcept(false)

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigLinParamDat.h.

Member Data Documentation

float FEConfigLinParamDat::m_etsat
private

Definition at line 37 of file FEConfigLinParamDat.h.

Referenced by getETSat(), and setETSat().