10 using namespace oracle::occi;
19 m_samplesG1.assign(10, 0);
20 m_samplesG6.assign(10, 0);
21 m_samplesG12.assign(10, 0);
36 this->checkConnection();
39 m_writeStmt = m_conn->createStatement();
40 m_writeStmt->setSQL(
"INSERT INTO mon_pulse_shape_dat (iov_id, logic_id, "
41 "g1_avg_sample_01, g1_avg_sample_02, g1_avg_sample_03, g1_avg_sample_04, g1_avg_sample_05, g1_avg_sample_06, g1_avg_sample_07, g1_avg_sample_08, g1_avg_sample_09, g1_avg_sample_10, "
42 "g6_avg_sample_01, g6_avg_sample_02, g6_avg_sample_03, g6_avg_sample_04, g6_avg_sample_05, g6_avg_sample_06, g6_avg_sample_07, g6_avg_sample_08, g6_avg_sample_09, g6_avg_sample_10, "
43 "g12_avg_sample_01, g12_avg_sample_02, g12_avg_sample_03, g12_avg_sample_04, g12_avg_sample_05, g12_avg_sample_06, g12_avg_sample_07, g12_avg_sample_08, g12_avg_sample_09, g12_avg_sample_10) "
44 "VALUES (:iov_id, :logic_id, "
45 ":g1_avg_sample_01, :g1_avg_sample_02, :g1_avg_sample_03, :g1_avg_sample_04, :g1_avg_sample_05, :g1_avg_sample_06, :g1_avg_sample_07, :g1_avg_sample_08, :g1_avg_sample_09, :g1_avg_sample_10,"
46 ":g6_avg_sample_01, :g6_avg_sample_02, :g6_avg_sample_03, :g6_avg_sample_04, :g6_avg_sample_05, :g6_avg_sample_06, :g6_avg_sample_07, :g6_avg_sample_08, :g6_avg_sample_09, :g6_avg_sample_10,"
47 ":g12_avg_sample_01, :g12_avg_sample_02, :g12_avg_sample_03, :g12_avg_sample_04, :g12_avg_sample_05, :g12_avg_sample_06, :g12_avg_sample_07, :g12_avg_sample_08, :g12_avg_sample_09, :g12_avg_sample_10)"
51 throw(std::runtime_error(
"MonPulseShapeDat::prepareWrite(): "+e.getMessage()));
60 this->checkConnection();
63 int iovID =
iov->fetchID();
64 if (!iovID) {
throw(std::runtime_error(
"MonPulseShapeDat::writeDB: IOV not in DB")); }
66 int logicID = ecid->getLogicID();
67 if (!logicID) {
throw(std::runtime_error(
"MonPulseShapeDat::writeDB: Bad EcalLogicID")); }
70 m_writeStmt->setInt(1, iovID);
71 m_writeStmt->setInt(2, logicID);
73 int gain[] = {1, 6, 12};
74 std::vector<float> samples;
75 for (
int i=0;
i<3;
i++) {
76 samples = item->getSamples(gain[
i]);
77 for (
int j=0;
j<10;
j++) {
78 m_writeStmt->setFloat(3+(10*i)+
j, samples.at(
j));
82 m_writeStmt->executeUpdate();
84 throw(std::runtime_error(
"MonPulseShapeDat::writeDB: "+e.getMessage()));
86 throw(std::runtime_error(
"MonPulseShapeDat::writeDB: " +
string(e.what())));
95 this->checkConnection();
98 iov->setConnection(m_env, m_conn);
99 int iovID =
iov->fetchID();
107 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
108 "d.g1_avg_sample_01, d.g1_avg_sample_02, d.g1_avg_sample_03, d.g1_avg_sample_04, d.g1_avg_sample_05, d.g1_avg_sample_06, d.g1_avg_sample_07, d.g1_avg_sample_08, d.g1_avg_sample_09, d.g1_avg_sample_10, "
109 "d.g6_avg_sample_01, d.g6_avg_sample_02, d.g6_avg_sample_03, d.g6_avg_sample_04, d.g6_avg_sample_05, d.g6_avg_sample_06, d.g6_avg_sample_07, d.g6_avg_sample_08, d.g6_avg_sample_09, d.g6_avg_sample_10, "
110 "d.g12_avg_sample_01, d.g12_avg_sample_02, d.g12_avg_sample_03, d.g12_avg_sample_04, d.g12_avg_sample_05, d.g12_avg_sample_06, d.g12_avg_sample_07, d.g12_avg_sample_08, d.g12_avg_sample_09, d.g12_avg_sample_10 "
111 "FROM channelview cv JOIN mon_pulse_shape_dat d "
112 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
113 "WHERE d.iov_id = :iov_id");
114 m_readStmt->setInt(1, iovID);
115 ResultSet* rset = m_readStmt->executeQuery();
117 std::pair< EcalLogicID, MonPulseShapeDat >
p;
119 while(rset->next()) {
127 int gain[] = {1, 6, 12};
128 std::vector<float> samples(10);
129 for (
int i=0;
i<3;
i++) {
131 for (
int j=0;
j<10;
j++) {
132 samples.push_back( rset->getFloat(7+(10*
i)+
j) );
141 throw(std::runtime_error(
"MonPulseShapeDat::fetchData: "+e.getMessage()));
void setSamples(std::vector< float > &samples, int gain) noexcept(false)
oracle::occi::SQLException SQLException
void fetchData(std::map< EcalLogicID, MonPulseShapeDat > *fillVec, MonRunIOV *iov) noexcept(false)
oracle::occi::ResultSet ResultSet
void prepareWrite() noexcept(false)
void writeDB(const EcalLogicID *ecid, const MonPulseShapeDat *item, MonRunIOV *iov) noexcept(false)
volatile std::atomic< bool > shutdown_flag false