Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:11

0001 #ifndef EcalDQMonitor_H
0002 #define EcalDQMonitor_H
0003 
0004 #include <string>
0005 #include <vector>
0006 
0007 #include "DQWorker.h"
0008 
0009 #include "DQMServices/Core/interface/DQMStore.h"
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011 
0012 namespace edm {
0013   class ParameterSet;
0014   class Run;
0015   class LuminosityBlock;
0016   class EventSetup;
0017 }  // namespace edm
0018 
0019 namespace ecaldqm {
0020   struct EcalLSCache {
0021     std::map<std::string, bool> ByLumiPlotsResetSwitches;
0022     bool lhcStatusSet_;
0023   };
0024 
0025   class EcalDQMonitor {
0026   public:
0027     EcalDQMonitor(edm::ParameterSet const &);
0028     virtual ~EcalDQMonitor() noexcept(false);
0029 
0030     static void fillDescriptions(edm::ParameterSetDescription &);
0031 
0032   protected:
0033     void ecaldqmBeginRun(edm::Run const &, edm::EventSetup const &);
0034     void ecaldqmEndRun(edm::Run const &, edm::EventSetup const &);
0035     void ecaldqmBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const;
0036     void ecaldqmEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &);
0037 
0038     template <typename FuncOnWorker>
0039     void executeOnWorkers_(FuncOnWorker,
0040                            std::string const &,
0041                            std::string const & = "",
0042                            int = 1) const;  // loop over workers and capture exceptions
0043 
0044     std::vector<DQWorker *> workers_;
0045     std::string const moduleName_;
0046     const int verbosity_;
0047   };
0048 
0049   template <typename FuncOnWorker>
0050   void EcalDQMonitor::executeOnWorkers_(FuncOnWorker _func,
0051                                         std::string const &_context,
0052                                         std::string const &_message /* = ""*/,
0053                                         int _verbThreshold /* = 1*/) const {
0054     std::for_each(workers_.begin(), workers_.end(), [&](DQWorker *worker) {
0055       if (verbosity_ > _verbThreshold && !_message.empty())
0056         edm::LogInfo("EcalDQM") << moduleName_ << ": " << _message << " @ " << worker->getName();
0057       try {
0058         _func(worker);
0059       } catch (std::exception &) {
0060         edm::LogError("EcalDQM") << moduleName_ << ": Exception in " << _context << " @ " << worker->getName();
0061         throw;
0062       }
0063     });
0064   }
0065 }  // namespace ecaldqm
0066 
0067 #endif