CMS 3D CMS Logo

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

#include <FEConfigFgrEETowerDat.h>

Inheritance diagram for FEConfigFgrEETowerDat:
IDataItem IDBObject

Public Member Functions

 FEConfigFgrEETowerDat ()
 
int getLUTValue () const
 
int getLutValue () const
 
std::string getTable ()
 
void setLUTValue (int mean)
 
void setLutValue (int mean)
 
 ~FEConfigFgrEETowerDat ()
 
- 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, FEConfigFgrEETowerDat > *fillMap, FEConfigFgrInfo *iconf) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigFgrEETowerDat > *data, FEConfigFgrInfo *iconf) throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const FEConfigFgrEETowerDat *item, FEConfigFgrInfo *iconf) throw (std::runtime_error)
 

Private Attributes

int m_lut
 

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 () throw (std::runtime_error)
 
void createReadStatement () throw (std::runtime_error)
 
void setPrefetchRowCount (int ncount) throw (std::runtime_error)
 
void terminateReadStatement () throw (std::runtime_error)
 
void terminateWriteStatement () throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 
- 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 FEConfigFgrEETowerDat.h.

Constructor & Destructor Documentation

FEConfigFgrEETowerDat::FEConfigFgrEETowerDat ( )

Definition at line 11 of file FEConfigFgrEETowerDat.cc.

References NULL.

12 {
13  m_env = NULL;
14  m_conn = NULL;
15  m_writeStmt = NULL;
16  m_readStmt = NULL;
17 
18  m_lut = 0;
19 
20 }
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
#define NULL
Definition: scimark2.h:8
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
FEConfigFgrEETowerDat::~FEConfigFgrEETowerDat ( )

Definition at line 24 of file FEConfigFgrEETowerDat.cc.

25 {
26 }

Member Function Documentation

void FEConfigFgrEETowerDat::fetchData ( std::map< EcalLogicID, FEConfigFgrEETowerDat > *  fillMap,
FEConfigFgrInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 73 of file FEConfigFgrEETowerDat.cc.

References dat, alignCSCRings::e, AlCaHLTBitMon_ParallelJobs::p, and setLutValue().

75 {
76  this->checkConnection();
77  fillMap->clear();
78 
79  iconf->setConnection(m_env, m_conn);
80  int iconfID = iconf->fetchID();
81  if (!iconfID) {
82  // throw(std::runtime_error("FEConfigFgrEETowerDat::writeDB: ICONF not in DB"));
83  return;
84  }
85 
86  try {
87 
88  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
89  "d.lut_value "
90  "FROM channelview cv JOIN "+getTable()+" d "
91  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
92  "WHERE fgr_conf_id = :fgr_conf_id");
93  m_readStmt->setInt(1, iconfID);
94  ResultSet* rset = m_readStmt->executeQuery();
95 
96  std::pair< EcalLogicID, FEConfigFgrEETowerDat > p;
98  while(rset->next()) {
99  p.first = EcalLogicID( rset->getString(1), // name
100  rset->getInt(2), // logic_id
101  rset->getInt(3), // id1
102  rset->getInt(4), // id2
103  rset->getInt(5), // id3
104  rset->getString(6)); // maps_to
105 
106  dat.setLutValue( rset->getInt(7) );
107 
108  p.second = dat;
109  fillMap->insert(p);
110  }
111  } catch (SQLException &e) {
112  throw(std::runtime_error("FEConfigFgrEETowerDat::fetchData: "+e.getMessage()));
113  }
114 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
static std::vector< std::string > checklist dat
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void checkConnection() const
Definition: IDBObject.h:41
int FEConfigFgrEETowerDat::getLUTValue ( ) const
inline

Definition at line 21 of file FEConfigFgrEETowerDat.h.

References m_lut.

Referenced by popcon::EcalTPGFineGrainTowerEEHandler::getNewObjects().

21 { return m_lut; }
int FEConfigFgrEETowerDat::getLutValue ( ) const
inline

Definition at line 23 of file FEConfigFgrEETowerDat.h.

References m_lut.

Referenced by writeArrayDB().

23 { return m_lut; }
std::string FEConfigFgrEETowerDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigFgrEETowerDat.h.

18 { return "FE_CONFIG_FGREETT_DAT"; }
void FEConfigFgrEETowerDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 30 of file FEConfigFgrEETowerDat.cc.

References alignCSCRings::e.

32 {
33  this->checkConnection();
34 
35  try {
36  m_writeStmt = m_conn->createStatement();
37  m_writeStmt->setSQL("INSERT INTO "+getTable()+" (fgr_conf_id, logic_id, "
38  "lut_value ) "
39  "VALUES (:fgr_conf_id, :logic_id, "
40  ":lut_value )" );
41  } catch (SQLException &e) {
42  throw(std::runtime_error("FEConfigFgrEETowerDat::prepareWrite(): "+e.getMessage()));
43  }
44 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const
Definition: IDBObject.h:41
void FEConfigFgrEETowerDat::setLUTValue ( int  mean)
inline

Definition at line 20 of file FEConfigFgrEETowerDat.h.

References m_lut, and timingPdfMaker::mean.

void FEConfigFgrEETowerDat::setLutValue ( int  mean)
inline
void FEConfigFgrEETowerDat::writeArrayDB ( const std::map< EcalLogicID, FEConfigFgrEETowerDat > *  data,
FEConfigFgrInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 116 of file FEConfigFgrEETowerDat.cc.

References prof2calltree::count, data, alignCSCRings::e, EcalLogicID::getLogicID(), getLutValue(), AlCaHLTBitMon_ParallelJobs::p, and x.

118 {
119  this->checkConnection();
120  this->checkPrepare();
121 
122  int iconfID = iconf->fetchID();
123  if (!iconfID) { throw(std::runtime_error("FEConfigFgrEETowerDat::writeArrayDB: ICONF not in DB")); }
124 
125 
126  int nrows=data->size();
127  int* ids= new int[nrows];
128  int* iconfid_vec= new int[nrows];
129  int* xx= new int[nrows];
130 
131 
132  ub2* ids_len= new ub2[nrows];
133  ub2* iconf_len= new ub2[nrows];
134  ub2* x_len= new ub2[nrows];
135 
136 
137  const EcalLogicID* channel;
138  const FEConfigFgrEETowerDat* dataitem;
139  int count=0;
140  typedef map< EcalLogicID, FEConfigFgrEETowerDat >::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("FEConfigFgrEETowerDat::writeArrayDB: Bad EcalLogicID")); }
145  ids[count]=logicID;
146  iconfid_vec[count]=iconfID;
147 
148  dataitem = &(p->second);
149  // dataIface.writeDB( channel, dataitem, iconf);
150  int x=dataitem->getLutValue();
151 
152  xx[count]=x;
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 
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 
169  m_writeStmt->executeArrayUpdate(nrows);
170 
171  delete [] ids;
172  delete [] iconfid_vec;
173  delete [] xx;
174 
175  delete [] ids_len;
176  delete [] iconf_len;
177  delete [] x_len;
178 
179  } catch (SQLException &e) {
180  throw(std::runtime_error("FEConfigFgrEETowerDat::writeArrayDB(): "+e.getMessage()));
181  }
182 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
int getLogicID() const
Definition: EcalLogicID.cc:41
void checkPrepare()
Definition: IDataItem.h:31
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Definition: DDAxes.h:10
void checkConnection() const
Definition: IDBObject.h:41
void FEConfigFgrEETowerDat::writeDB ( const EcalLogicID ecid,
const FEConfigFgrEETowerDat item,
FEConfigFgrInfo iconf 
)
throw (std::runtime_error
)
private

Definition at line 48 of file FEConfigFgrEETowerDat.cc.

References alignCSCRings::e.

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

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigFgrEETowerDat.h.

Member Data Documentation

int FEConfigFgrEETowerDat::m_lut
private

Definition at line 42 of file FEConfigFgrEETowerDat.h.

Referenced by getLUTValue(), getLutValue(), setLUTValue(), and setLutValue().