Go to the documentation of this file.00001 #ifndef MONPULSESHAPEDAT_H
00002 #define MONPULSESHAPEDAT_H
00003
00004 #include <vector>
00005 #include <map>
00006 #include <stdexcept>
00007
00008 #include "OnlineDB/EcalCondDB/interface/IDataItem.h"
00009 #include "OnlineDB/EcalCondDB/interface/MonRunTag.h"
00010 #include "OnlineDB/EcalCondDB/interface/MonRunIOV.h"
00011 #include "OnlineDB/EcalCondDB/interface/EcalLogicID.h"
00012
00013 class MonPulseShapeDat : public IDataItem {
00014 public:
00015 friend class EcalCondDBInterface;
00016 MonPulseShapeDat();
00017 ~MonPulseShapeDat();
00018
00019
00020 inline std::string getTable() { return "MON_PULSE_SHAPE_DAT"; }
00021
00022 inline void setSamples( std::vector<float> &samples, int gain )
00023 throw(std::runtime_error)
00024 {
00025 if (samples.size() != 10) {
00026 throw(std::runtime_error("MonPulseShapeDat::setSamples: There should be 10 samples."));
00027 }
00028
00029 if (gain == 1) {
00030 m_samplesG1 = samples;
00031 } else if (gain == 6) {
00032 m_samplesG6 = samples;
00033 } else if (gain == 12) {
00034 m_samplesG12 = samples;
00035 } else {
00036 throw(std::runtime_error("MonPulseShapeDat::setSamples: Gain should be 1, 6 or 12"));
00037 }
00038 }
00039
00040 inline std::vector<float> getSamples(int gain) const
00041 throw(std::runtime_error)
00042 {
00043 if (gain == 1) {
00044 return m_samplesG1;
00045 } else if (gain == 6) {
00046 return m_samplesG6;
00047 } else if (gain == 12) {
00048 return m_samplesG12;
00049 } else {
00050 throw(std::runtime_error("MonPulseShapeDat::getSamples: Gain should be 1, 6 or 12"));
00051 }
00052 }
00053
00054 private:
00055 void prepareWrite()
00056 throw(std::runtime_error);
00057
00058 void writeDB(const EcalLogicID* ecid, const MonPulseShapeDat* item, MonRunIOV* iov)
00059 throw(std::runtime_error);
00060
00061 void fetchData(std::map< EcalLogicID, MonPulseShapeDat >* fillVec, MonRunIOV* iov)
00062 throw(std::runtime_error);
00063
00064
00065 std::vector<float> m_samplesG1;
00066 std::vector<float> m_samplesG6;
00067 std::vector<float> m_samplesG12;
00068 };
00069
00070 #endif