CMS 3D CMS Logo

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

#include <FEConfigLinDat.h>

Inheritance diagram for FEConfigLinDat:
IDataItem IDBObject

Public Member Functions

 FEConfigLinDat ()
 
int getMultX1 () const
 
int getMultX12 () const
 
int getMultX6 () const
 
int getShift1 () const
 
int getShift12 () const
 
int getShift6 () const
 
std::string getTable ()
 
void setMultX1 (int x)
 
void setMultX12 (int x)
 
void setMultX6 (int x)
 
void setShift1 (int x)
 
void setShift12 (int x)
 
void setShift6 (int x)
 
 ~FEConfigLinDat ()
 
- 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, FEConfigLinDat > *fillMap, FEConfigLinInfo *iconf) noexcept(false)
 
void prepareWrite () noexcept(false)
 
void writeArrayDB (const std::map< EcalLogicID, FEConfigLinDat > *data, FEConfigLinInfo *iconf) noexcept(false)
 
void writeDB (const EcalLogicID *ecid, const FEConfigLinDat *item, FEConfigLinInfo *iconf) noexcept(false)
 

Private Attributes

int m_multx1
 
int m_multx12
 
int m_multx6
 
int m_shift1
 
int m_shift12
 
int m_shift6
 

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

Constructor & Destructor Documentation

FEConfigLinDat::FEConfigLinDat ( )

Definition at line 11 of file FEConfigLinDat.cc.

References NULL.

12 {
13  m_env = NULL;
14  m_conn = NULL;
15  m_writeStmt = NULL;
16  m_readStmt = NULL;
17 
18  m_multx12 = 0;
19  m_multx6 = 0;
20  m_multx1 = 0;
21  m_shift12 = 0;
22  m_shift6 = 0;
23  m_shift1 = 0;
24 
25 
26 }
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
FEConfigLinDat::~FEConfigLinDat ( )

Definition at line 30 of file FEConfigLinDat.cc.

31 {
32 }

Member Function Documentation

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

Definition at line 84 of file FEConfigLinDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setMultX1(), setMultX12(), setMultX6(), setShift1(), setShift12(), and setShift6().

Referenced by getShift1().

86 {
87  this->checkConnection();
88  fillMap->clear();
89 
90  iconf->setConnection(m_env, m_conn);
91  int iconfID = iconf->fetchID();
92  if (!iconfID) {
93  // throw(std::runtime_error("FEConfigLinDat::writeDB: ICONF not in DB"));
94  return;
95  }
96 
97  try {
98 
99  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
100  "d.multx12, d.multx6, d.multx1, d.shift12, d.shift6, d.shift1 "
101  "FROM channelview cv JOIN fe_config_lin_dat d "
102  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
103  "WHERE lin_conf_id = :lin_conf_id");
104  m_readStmt->setInt(1, iconfID);
105  ResultSet* rset = m_readStmt->executeQuery();
106 
107  std::pair< EcalLogicID, FEConfigLinDat > p;
108  FEConfigLinDat dat;
109  while(rset->next()) {
110  p.first = EcalLogicID( rset->getString(1), // name
111  rset->getInt(2), // logic_id
112  rset->getInt(3), // id1
113  rset->getInt(4), // id2
114  rset->getInt(5), // id3
115  rset->getString(6)); // maps_to
116 
117  dat.setMultX12( rset->getInt(7) );
118  dat.setMultX6( rset->getInt(8) );
119  dat.setMultX1( rset->getInt(9) );
120  dat.setShift12( rset->getInt(10) );
121  dat.setShift6( rset->getInt(11) );
122  dat.setShift1( rset->getInt(12) );
123 
124  p.second = dat;
125  fillMap->insert(p);
126  }
127  } catch (SQLException &e) {
128  throw(std::runtime_error("FEConfigLinDat::fetchData: "+e.getMessage()));
129  }
130 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setShift12(int x)
void setMultX1(int x)
void setShift6(int x)
void setShift1(int x)
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
void setMultX6(int x)
int fetchID() noexcept(false)
void setMultX12(int x)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
int FEConfigLinDat::getMultX1 ( ) const
inline

Definition at line 30 of file FEConfigLinDat.h.

References m_multx1.

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

30 { return m_multx1; }
int FEConfigLinDat::getMultX12 ( ) const
inline

Definition at line 28 of file FEConfigLinDat.h.

References m_multx12.

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

28 { return m_multx12; }
int FEConfigLinDat::getMultX6 ( ) const
inline

Definition at line 29 of file FEConfigLinDat.h.

References m_multx6.

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

29 { return m_multx6; }
int FEConfigLinDat::getShift1 ( ) const
inline
int FEConfigLinDat::getShift12 ( ) const
inline

Definition at line 31 of file FEConfigLinDat.h.

References m_shift12.

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

31 { return m_shift12; }
int FEConfigLinDat::getShift6 ( ) const
inline

Definition at line 32 of file FEConfigLinDat.h.

References m_shift6.

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

32 { return m_shift6; }
std::string FEConfigLinDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 18 of file FEConfigLinDat.h.

18 { return "FE_CONFIG_LIN_DAT"; }
void FEConfigLinDat::prepareWrite ( )
privatevirtualnoexcept

Implements IDataItem.

Definition at line 36 of file FEConfigLinDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getShift1().

38 {
39  this->checkConnection();
40 
41  try {
42  m_writeStmt = m_conn->createStatement();
43  m_writeStmt->setSQL("INSERT INTO fe_config_lin_dat (lin_conf_id, logic_id, "
44  " multx12, multx6, multx1, shift12, shift6, shift1 ) "
45  "VALUES (:lin_conf_id, :logic_id, "
46  ":multx12, :multx6, :multx1, :shift12, :shift6, :shift1 )" );
47  } catch (SQLException &e) {
48  throw(std::runtime_error("FEConfigLinDat::prepareWrite(): "+e.getMessage()));
49  }
50 }
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 FEConfigLinDat::setMultX1 ( int  x)
inline

Definition at line 22 of file FEConfigLinDat.h.

References m_multx1, and x.

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

void FEConfigLinDat::setMultX12 ( int  x)
inline

Definition at line 20 of file FEConfigLinDat.h.

References m_multx12, and x.

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

void FEConfigLinDat::setMultX6 ( int  x)
inline

Definition at line 21 of file FEConfigLinDat.h.

References m_multx6, and x.

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

void FEConfigLinDat::setShift1 ( int  x)
inline

Definition at line 25 of file FEConfigLinDat.h.

References m_shift1, and x.

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

void FEConfigLinDat::setShift12 ( int  x)
inline

Definition at line 23 of file FEConfigLinDat.h.

References m_shift12, and x.

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

void FEConfigLinDat::setShift6 ( int  x)
inline

Definition at line 24 of file FEConfigLinDat.h.

References m_shift6, and x.

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

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

Definition at line 132 of file FEConfigLinDat.cc.

References KineDebug3::count(), data, MillePedeFileConverter_cfg::e, EcalLogicID::getLogicID(), getMultX1(), getMultX12(), getMultX6(), getShift1(), getShift12(), getShift6(), AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, findQualityFiles::rr, alignCSCRings::s, w, x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, and geometryCSVtoXML::zz.

Referenced by getShift1().

134 {
135  this->checkConnection();
136  this->checkPrepare();
137 
138  int iconfID = iconf->fetchID();
139  if (!iconfID) { throw(std::runtime_error("FEConfigLinDat::writeArrayDB: ICONF not in DB")); }
140 
141 
142  int nrows=data->size();
143  int* ids= new int[nrows];
144  int* iconfid_vec= new int[nrows];
145  int* xx= new int[nrows];
146  int* yy= new int[nrows];
147  int* zz= new int[nrows];
148  int* ww= new int[nrows];
149  int* rr= new int[nrows];
150  int* ss= new int[nrows];
151 
152  ub2* ids_len= new ub2[nrows];
153  ub2* iconf_len= new ub2[nrows];
154  ub2* x_len= new ub2[nrows];
155  ub2* y_len= new ub2[nrows];
156  ub2* z_len= new ub2[nrows];
157  ub2* w_len= new ub2[nrows];
158  ub2* r_len= new ub2[nrows];
159  ub2* s_len= new ub2[nrows];
160 
161 
162  const EcalLogicID* channel;
163  const FEConfigLinDat* dataitem;
164  int count=0;
165  typedef map< EcalLogicID, FEConfigLinDat >::const_iterator CI;
166  for (CI p = data->begin(); p != data->end(); ++p) {
167  channel = &(p->first);
168  int logicID = channel->getLogicID();
169  if (!logicID) { throw(std::runtime_error("FEConfigLinDat::writeArrayDB: Bad EcalLogicID")); }
170  ids[count]=logicID;
171  iconfid_vec[count]=iconfID;
172 
173  dataitem = &(p->second);
174  // dataIface.writeDB( channel, dataitem, iconf);
175  int x=dataitem->getMultX12();
176  int y=dataitem->getMultX6();
177  int z=dataitem->getMultX1();
178  int w=dataitem->getShift12();
179  int r=dataitem->getShift6();
180  int s=dataitem->getShift1();
181 
182  xx[count]=x;
183  yy[count]=y;
184  zz[count]=z;
185  ww[count]=w;
186  rr[count]=r;
187  ss[count]=s;
188 
189  ids_len[count]=sizeof(ids[count]);
190  iconf_len[count]=sizeof(iconfid_vec[count]);
191 
192  x_len[count]=sizeof(xx[count]);
193  y_len[count]=sizeof(yy[count]);
194  z_len[count]=sizeof(zz[count]);
195  w_len[count]=sizeof(ww[count]);
196  r_len[count]=sizeof(rr[count]);
197  s_len[count]=sizeof(ss[count]);
198 
199  count++;
200  }
201 
202 
203  try {
204  m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len);
205  m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len );
206  m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len );
207  m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len );
208  m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIINT , sizeof(zz[0]), z_len );
209  m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIINT , sizeof(ww[0]), w_len );
210  m_writeStmt->setDataBuffer(7, (dvoid*)rr, OCCIINT , sizeof(rr[0]), r_len );
211  m_writeStmt->setDataBuffer(8, (dvoid*)ss, OCCIINT , sizeof(ss[0]), s_len );
212 
213  m_writeStmt->executeArrayUpdate(nrows);
214 
215  delete [] ids;
216  delete [] iconfid_vec;
217  delete [] xx;
218  delete [] yy;
219  delete [] zz;
220  delete [] ww;
221  delete [] rr;
222  delete [] ss;
223 
224  delete [] ids_len;
225  delete [] iconf_len;
226  delete [] x_len;
227  delete [] y_len;
228  delete [] z_len;
229  delete [] w_len;
230  delete [] r_len;
231  delete [] s_len;
232 
233  } catch (SQLException &e) {
234  throw(std::runtime_error("FEConfigLinDat::writeArrayDB(): "+e.getMessage()));
235  }
236 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
const double w
Definition: UKUtility.cc:23
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
int getMultX12() const
int getMultX1() const
int getShift6() const
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int getShift12() const
int getMultX6() const
int getLogicID() const
Definition: EcalLogicID.cc:41
int fetchID() noexcept(false)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int getShift1() const
void FEConfigLinDat::writeDB ( const EcalLogicID ecid,
const FEConfigLinDat item,
FEConfigLinInfo iconf 
)
privatenoexcept

Definition at line 54 of file FEConfigLinDat.cc.

References MillePedeFileConverter_cfg::e.

Referenced by getShift1().

56 {
57  this->checkConnection();
58  this->checkPrepare();
59 
60  int iconfID = iconf->fetchID();
61  if (!iconfID) { throw(std::runtime_error("FEConfigLinDat::writeDB: ICONF not in DB")); }
62 
63  int logicID = ecid->getLogicID();
64  if (!logicID) { throw(std::runtime_error("FEConfigLinDat::writeDB: Bad EcalLogicID")); }
65 
66  try {
67  m_writeStmt->setInt(1, iconfID);
68  m_writeStmt->setInt(2, logicID);
69  m_writeStmt->setInt(3, item->getMultX12());
70  m_writeStmt->setInt(4, item->getMultX6());
71  m_writeStmt->setInt(5, item->getMultX1());
72  m_writeStmt->setInt(6, item->getShift12());
73  m_writeStmt->setInt(7, item->getShift6());
74  m_writeStmt->setInt(8, item->getShift1());
75 
76  m_writeStmt->executeUpdate();
77  } catch (SQLException &e) {
78  throw(std::runtime_error("FEConfigLinDat::writeDB(): "+e.getMessage()));
79  }
80 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
int getMultX12() const
int getMultX1() const
int getShift6() const
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int getShift12() const
int getMultX6() const
int getLogicID() const
Definition: EcalLogicID.cc:41
int fetchID() noexcept(false)
int getShift1() const

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file FEConfigLinDat.h.

Member Data Documentation

int FEConfigLinDat::m_multx1
private

Definition at line 49 of file FEConfigLinDat.h.

Referenced by getMultX1(), and setMultX1().

int FEConfigLinDat::m_multx12
private

Definition at line 47 of file FEConfigLinDat.h.

Referenced by getMultX12(), and setMultX12().

int FEConfigLinDat::m_multx6
private

Definition at line 48 of file FEConfigLinDat.h.

Referenced by getMultX6(), and setMultX6().

int FEConfigLinDat::m_shift1
private

Definition at line 52 of file FEConfigLinDat.h.

Referenced by getShift1(), and setShift1().

int FEConfigLinDat::m_shift12
private

Definition at line 50 of file FEConfigLinDat.h.

Referenced by getShift12(), and setShift12().

int FEConfigLinDat::m_shift6
private

Definition at line 51 of file FEConfigLinDat.h.

Referenced by getShift6(), and setShift6().