CMS 3D CMS Logo

FEConfigOddWeightModeDat.cc
Go to the documentation of this file.
1 #include <stdexcept>
2 #include <string>
4 
8 
9 using namespace std;
10 using namespace oracle::occi;
11 
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_readStmt = nullptr;
17 
18  m_en_EB_flt = 0;
19  m_en_EE_flt = 0;
20  m_en_EB_pf = 0;
21  m_en_EE_pf = 0;
22  m_dis_EB_even_pf = 0;
23  m_dis_EE_even_pf = 0;
24  m_fe_EB_strout = 0;
25  m_fe_EE_strout = 0;
26  m_fe_EB_strib2 = 0;
27  m_fe_EE_strib2 = 0;
28  m_fe_EB_tcpout = 0;
29  m_fe_EB_tcpib1 = 0;
30  m_fe_EE_tcpout = 0;
31  m_fe_EE_tcpib1 = 0;
32  m_fe_par15 = 0;
33  m_fe_par16 = 0;
34  m_fe_par17 = 0;
35  m_fe_par18 = 0;
36 }
37 
39 
41  this->checkConnection();
42 
43  try {
44  m_writeStmt = m_conn->createStatement();
45  m_writeStmt->setSQL(
46  "INSERT INTO " + getTable() +
47  " (wei2_conf_id, "
48  " enableEBOddFilter, enableEEOddFilter, enableEBOddPeakFinder,enableEEOddPeakFinder, disableEBEvenPeakFinder, "
49  "DISABLEEEEVENPEAKFINDER, fenixEBStripOutput, fenixEEStripOutput, FenixEBStripInfoBit2, fenixEEStripInfobit2, "
50  "EBfenixTcpOutput, EBfenixTCPInfobit1,EEFENIXTCPOUTPUT, EEFENIXTCPINFOBIT1 ,fenixpar15, fenixpar16, "
51  "fenixpar17, fenixpar18 ) "
52  "VALUES (:wei2_conf_id, "
53  " :w1, :w2, :w3, :w4, :w5, :w6, :w7, :w8, :w9, :w10, :w11, :w12, :w13, :w14, :w15 , :w16, :w17, :w18 )");
54  } catch (SQLException& e) {
55  throw cms::Exception("SQLException") << "FEConfigOddWeightModeDat::prepareWrite(): " << e.getMessage();
56  }
57 }
58 
61  FEConfigOddWeightInfo* iconf) noexcept(false) {
62  this->checkConnection();
63  this->checkPrepare();
64 
65  int iconfID = iconf->fetchID();
66  if (!iconfID) {
67  throw(std::runtime_error("FEConfigOddWeightModeDat::writeDB: ICONF not in DB"));
68  }
69 
70  try {
71  m_writeStmt->setInt(1, iconfID);
72 
73  m_writeStmt->setInt(2, item->getFenixPar1());
74  m_writeStmt->setInt(3, item->getFenixPar2());
75  m_writeStmt->setInt(4, item->getFenixPar3());
76  m_writeStmt->setInt(5, item->getFenixPar4());
77  m_writeStmt->setInt(6, item->getFenixPar5());
78  m_writeStmt->setInt(7, item->getFenixPar6());
79  m_writeStmt->setInt(8, item->getFenixPar7());
80  m_writeStmt->setInt(9, item->getFenixPar8());
81  m_writeStmt->setInt(10, item->getFenixPar9());
82  m_writeStmt->setInt(11, item->getFenixPar10());
83  m_writeStmt->setInt(12, item->getFenixPar11());
84  m_writeStmt->setInt(13, item->getFenixPar12());
85  m_writeStmt->setInt(14, item->getFenixPar13());
86  m_writeStmt->setInt(15, item->getFenixPar14());
87  m_writeStmt->setInt(16, item->getFenixPar15());
88  m_writeStmt->setInt(17, item->getFenixPar16());
89  m_writeStmt->setInt(18, item->getFenixPar17());
90  m_writeStmt->setInt(19, item->getFenixPar18());
91 
92  m_writeStmt->executeUpdate();
93  } catch (SQLException& e) {
94  throw cms::Exception("SQLException") << "FEConfigOddWeightModeDat::writeDB(): " << e.getMessage();
95  }
96 }
97 
98 void FEConfigOddWeightModeDat::fetchData(map<EcalLogicID, FEConfigOddWeightModeDat>* fillMap,
99  FEConfigOddWeightInfo* iconf) noexcept(false) {
100  this->checkConnection();
101  fillMap->clear();
102 
103  iconf->setConnection(m_env, m_conn);
104  int iconfID = iconf->fetchID();
105  if (!iconfID) {
106  throw(std::runtime_error("FEConfigOddWeightModeDat::fetchData: ICONF not in DB"));
107  return;
108  }
109 
110  try {
111  m_readStmt->setSQL(
112  "SELECT enableEBOddFilter, enableEEOddFilter, enableEBOddPeakFinder,enableEEOddPeakFinder, "
113  "disableEBEvenPeakFinder, DISABLEEEEVENPEAKFINDER, fenixEBStripOutput, fenixEBStripOutput, "
114  "FenixEBStripInfoBit2, fenixEEStripInfobit2, EBfenixTcpOutput, EBfenixTCPInfobit1,EEFENIXTCPOUTPUT, "
115  "EEFENIXTCPINFOBIT1 ,fenixpar15, fenixpar16, fenixpar17, fenixpar18 "
116  "FROM " +
117  getTable() +
118  " d "
119  "WHERE wei2_conf_id = :wei2_conf_id ");
120  m_readStmt->setInt(1, iconfID);
121  ResultSet* rset = m_readStmt->executeQuery();
122 
123  std::pair<EcalLogicID, FEConfigOddWeightModeDat> p;
125  int ig = -1;
126  while (rset->next()) {
127  ig++; // we create a dummy logic_id
128  p.first = EcalLogicID("Group_id", // name
129  ig); // logic_id
130 
131  dat.setFenixPar1(rset->getInt(1));
132  dat.setFenixPar2(rset->getInt(2));
133  dat.setFenixPar3(rset->getInt(3));
134  dat.setFenixPar4(rset->getInt(4));
135  dat.setFenixPar5(rset->getInt(5));
136  dat.setFenixPar6(rset->getInt(6));
137  dat.setFenixPar7(rset->getInt(7));
138  dat.setFenixPar8(rset->getInt(8));
139  dat.setFenixPar9(rset->getInt(9));
140  dat.setFenixPar10(rset->getInt(10));
141  dat.setFenixPar11(rset->getInt(11));
142  dat.setFenixPar12(rset->getInt(12));
143  dat.setFenixPar13(rset->getInt(13));
144  dat.setFenixPar14(rset->getInt(14));
145  dat.setFenixPar15(rset->getInt(15));
146  dat.setFenixPar16(rset->getInt(16));
147  dat.setFenixPar17(rset->getInt(17));
148  dat.setFenixPar18(rset->getInt(18));
149 
150  p.second = dat;
151  fillMap->insert(p);
152  }
153  } catch (SQLException& e) {
154  throw cms::Exception("SQLException") << "FEConfigOddWeightModeDat::fetchData: " << e.getMessage();
155  }
156 }
157 
158 void FEConfigOddWeightModeDat::writeArrayDB(const std::map<EcalLogicID, FEConfigOddWeightModeDat>* data,
159  FEConfigOddWeightInfo* iconf) noexcept(false) {
160  const EcalLogicID* channel;
161  const FEConfigOddWeightModeDat* dataitem;
162 
163  typedef map<EcalLogicID, FEConfigOddWeightModeDat>::const_iterator CI;
164  for (CI p = data->begin(); p != data->end(); ++p) {
165  channel = &(p->first);
166  dataitem = &(p->second);
167  writeDB(channel, dataitem, iconf);
168  }
169 }
void writeArrayDB(const std::map< EcalLogicID, FEConfigOddWeightModeDat > *data, FEConfigOddWeightInfo *iconf) noexcept(false)
void fetchData(std::map< EcalLogicID, FEConfigOddWeightModeDat > *fillMap, FEConfigOddWeightInfo *iconf) noexcept(false)
void prepareWrite() noexcept(false) override
void writeDB(const EcalLogicID *ecid, const FEConfigOddWeightModeDat *item, FEConfigOddWeightInfo *iconf) noexcept(false)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80