Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-03-17 23:26:23

0001 #ifndef DBWriterWorkers_H
0002 #define DBWriterWorkers_H
0003 
0004 #include "DQM/EcalCommon/interface/MESet.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 
0007 #include "DQMServices/Core/interface/DQMStore.h"
0008 
0009 #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
0010 #include "OnlineDB/EcalCondDB/interface/MonRunDat.h"
0011 
0012 #include "DQM/EcalCommon/interface/DQWorker.h"
0013 
0014 #include <map>
0015 
0016 namespace ecaldqm {
0017 
0018   class DBWriterWorker : public DQWorker {
0019   public:
0020     typedef dqm::legacy::DQMStore DQMStore;
0021     typedef dqm::legacy::MonitorElement MonitorElement;
0022     DBWriterWorker(std::string const &, edm::ParameterSet const &);
0023     ~DBWriterWorker() override {}
0024 
0025     void retrieveSource(DQMStore::IGetter &);
0026     virtual bool run(EcalCondDBInterface *, MonRunIOV &) = 0;
0027 
0028     bool runsOn(std::string const &_runType) const { return runTypes_.find(_runType) != runTypes_.end(); }
0029 
0030     void setVerbosity(int _v) { verbosity_ = _v; }
0031 
0032     std::string const &getName() const { return name_; }
0033     bool isActive() const { return active_; }
0034 
0035   protected:
0036     std::string const name_;
0037     std::set<std::string> runTypes_;
0038     MESetCollection source_;
0039     bool active_;
0040     int verbosity_;
0041   };
0042 
0043   class IntegrityWriter : public DBWriterWorker {
0044   public:
0045     IntegrityWriter(edm::ParameterSet const &_ps) : DBWriterWorker("Integrity", _ps) {}
0046     ~IntegrityWriter() override {}
0047 
0048     bool run(EcalCondDBInterface *, MonRunIOV &) override;
0049   };
0050 
0051   class LaserWriter : public DBWriterWorker {
0052   public:
0053     LaserWriter(edm::ParameterSet const &);
0054     ~LaserWriter() override {}
0055 
0056     bool run(EcalCondDBInterface *, MonRunIOV &) override;
0057 
0058   private:
0059     std::map<int, unsigned> wlToME_;
0060   };
0061 
0062   class PedestalWriter : public DBWriterWorker {
0063   public:
0064     PedestalWriter(edm::ParameterSet const &);
0065     ~PedestalWriter() override {}
0066 
0067     bool run(EcalCondDBInterface *, MonRunIOV &) override;
0068 
0069   private:
0070     std::map<int, unsigned> gainToME_;
0071     std::map<int, unsigned> pnGainToME_;
0072   };
0073 
0074   class PresampleWriter : public DBWriterWorker {
0075   public:
0076     PresampleWriter(edm::ParameterSet const &_ps) : DBWriterWorker("Presample", _ps) {}
0077     ~PresampleWriter() override {}
0078 
0079     bool run(EcalCondDBInterface *, MonRunIOV &) override;
0080   };
0081 
0082   class TestPulseWriter : public DBWriterWorker {
0083   public:
0084     TestPulseWriter(edm::ParameterSet const &);
0085     ~TestPulseWriter() override {}
0086 
0087     bool run(EcalCondDBInterface *, MonRunIOV &) override;
0088 
0089   private:
0090     std::map<int, unsigned> gainToME_;
0091     std::map<int, unsigned> pnGainToME_;
0092   };
0093 
0094   class TimingWriter : public DBWriterWorker {
0095   public:
0096     TimingWriter(edm::ParameterSet const &_ps) : DBWriterWorker("Timing", _ps) {}
0097     ~TimingWriter() override {}
0098 
0099     bool run(EcalCondDBInterface *, MonRunIOV &) override;
0100   };
0101 
0102   class LedWriter : public DBWriterWorker {
0103   public:
0104     LedWriter(edm::ParameterSet const &);
0105     ~LedWriter() override {}
0106 
0107     bool run(EcalCondDBInterface *, MonRunIOV &) override;
0108 
0109   private:
0110     std::map<int, unsigned> wlToME_;
0111   };
0112 
0113   class OccupancyWriter : public DBWriterWorker {
0114   public:
0115     OccupancyWriter(edm::ParameterSet const &_ps) : DBWriterWorker("Occupancy", _ps) {}
0116     ~OccupancyWriter() override {}
0117 
0118     bool run(EcalCondDBInterface *, MonRunIOV &) override;
0119   };
0120 
0121   class SummaryWriter : public DBWriterWorker {
0122   public:
0123     SummaryWriter(edm::ParameterSet const &_ps)
0124         : DBWriterWorker("Summary", _ps), taskList_(0), outcome_(0), processedEvents_(0) {}
0125     ~SummaryWriter() override {}
0126 
0127     void setTaskList(int _list) { taskList_ = _list; }
0128     void setOutcome(int _outcome) { outcome_ = _outcome; }
0129     void setProcessedEvents(unsigned _n) { processedEvents_ = _n; }
0130     bool run(EcalCondDBInterface *, MonRunIOV &) override;
0131 
0132   private:
0133     int taskList_;
0134     int outcome_;
0135     unsigned processedEvents_;
0136   };
0137 }  // namespace ecaldqm
0138 
0139 #endif