CMS 3D CMS Logo

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