CMS 3D CMS Logo

MonPulseShapeDat.h
Go to the documentation of this file.
1 #ifndef MONPULSESHAPEDAT_H
2 #define MONPULSESHAPEDAT_H
3 
4 #include <vector>
5 #include <map>
6 #include <stdexcept>
7 
12 
13 class MonPulseShapeDat : public IDataItem {
14 public:
15  friend class EcalCondDBInterface;
17  ~MonPulseShapeDat() override;
18 
19  // User data methods
20  inline std::string getTable() override { return "MON_PULSE_SHAPE_DAT"; }
21 
22  inline void setSamples(std::vector<float>& samples, int gain) noexcept(false) {
23  if (samples.size() != 10) {
24  throw(std::runtime_error("MonPulseShapeDat::setSamples: There should be 10 samples."));
25  }
26 
27  if (gain == 1) {
29  } else if (gain == 6) {
31  } else if (gain == 12) {
33  } else {
34  throw(std::runtime_error("MonPulseShapeDat::setSamples: Gain should be 1, 6 or 12"));
35  }
36  }
37 
38  inline std::vector<float> getSamples(int gain) const noexcept(false) {
39  if (gain == 1) {
40  return m_samplesG1;
41  } else if (gain == 6) {
42  return m_samplesG6;
43  } else if (gain == 12) {
44  return m_samplesG12;
45  } else {
46  throw(std::runtime_error("MonPulseShapeDat::getSamples: Gain should be 1, 6 or 12"));
47  }
48  }
49 
50 private:
51  void prepareWrite() noexcept(false) override;
52 
53  void writeDB(const EcalLogicID* ecid, const MonPulseShapeDat* item, MonRunIOV* iov) noexcept(false);
54 
55  void fetchData(std::map<EcalLogicID, MonPulseShapeDat>* fillVec, MonRunIOV* iov) noexcept(false);
56 
57  // User data
58  std::vector<float> m_samplesG1;
59  std::vector<float> m_samplesG6;
60  std::vector<float> m_samplesG12;
61 };
62 
63 #endif
std::string getTable() override
std::vector< float > m_samplesG1
std::vector< float > getSamples(int gain) const noexcept(false)
std::vector< float > m_samplesG6
void setSamples(std::vector< float > &samples, int gain) noexcept(false)
void prepareWrite() noexcept(false) override
void fetchData(std::map< EcalLogicID, MonPulseShapeDat > *fillVec, MonRunIOV *iov) noexcept(false)
std::vector< float > m_samplesG12
#define noexcept
void writeDB(const EcalLogicID *ecid, const MonPulseShapeDat *item, MonRunIOV *iov) noexcept(false)
~MonPulseShapeDat() override