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 )
23  noexcept(false)
24  {
25  if (samples.size() != 10) {
26  throw(std::runtime_error("MonPulseShapeDat::setSamples: There should be 10 samples."));
27  }
28 
29  if (gain == 1) {
31  } else if (gain == 6) {
33  } else if (gain == 12) {
35  } else {
36  throw(std::runtime_error("MonPulseShapeDat::setSamples: Gain should be 1, 6 or 12"));
37  }
38  }
39 
40  inline std::vector<float> getSamples(int gain) const
41  noexcept(false)
42  {
43  if (gain == 1) {
44  return m_samplesG1;
45  } else if (gain == 6) {
46  return m_samplesG6;
47  } else if (gain == 12) {
48  return m_samplesG12;
49  } else {
50  throw(std::runtime_error("MonPulseShapeDat::getSamples: Gain should be 1, 6 or 12"));
51  }
52  }
53 
54  private:
55  void prepareWrite()
56  noexcept(false) override;
57 
58  void writeDB(const EcalLogicID* ecid, const MonPulseShapeDat* item, MonRunIOV* iov)
59  noexcept(false);
60 
61  void fetchData(std::map< EcalLogicID, MonPulseShapeDat >* fillVec, MonRunIOV* iov)
62  noexcept(false);
63 
64  // User data
65  std::vector<float> m_samplesG1;
66  std::vector<float> m_samplesG6;
67  std::vector<float> m_samplesG12;
68 };
69 
70 #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