File indexing completed on 2021-02-14 13:10:22
0001
0002 #include <string>
0003 #include <cstring>
0004
0005
0006 #include <boost/regex.hpp>
0007
0008
0009 #include <TH1F.h>
0010
0011
0012 #include "FWCore/Framework/interface/Frameworkfwd.h"
0013 #include "FWCore/Framework/interface/Event.h"
0014 #include "FWCore/Framework/interface/Run.h"
0015 #include "FWCore/Framework/interface/LuminosityBlock.h"
0016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0017 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0018 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0019 #include "FWCore/ParameterSet/interface/Registry.h"
0020 #include "DQMServices/Core/interface/DQMStore.h"
0021 #include "DQMServices/Core/interface/DQMEDHarvester.h"
0022
0023 struct MEPSet {
0024 std::string name;
0025 std::string folder;
0026 };
0027
0028 class PSMonitorClient : public DQMEDHarvester {
0029 public:
0030 explicit PSMonitorClient(edm::ParameterSet const &);
0031 ~PSMonitorClient() override = default;
0032
0033 static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0034 static void fillMePSetDescription(edm::ParameterSetDescription &pset);
0035
0036 private:
0037 static MEPSet getHistoPSet(edm::ParameterSet pset);
0038
0039 std::string m_dqm_path;
0040
0041 void dqmEndLuminosityBlock(DQMStore::IBooker &booker,
0042 DQMStore::IGetter &getter,
0043 edm::LuminosityBlock const &,
0044 edm::EventSetup const &) override;
0045 void dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) override;
0046
0047 void check(DQMStore::IBooker &booker, DQMStore::IGetter &getter);
0048
0049 MEPSet psColumnVSlumiPSet;
0050 };
0051
0052 PSMonitorClient::PSMonitorClient(edm::ParameterSet const &config)
0053 : m_dqm_path(config.getUntrackedParameter<std::string>("dqmPath")),
0054 psColumnVSlumiPSet(getHistoPSet(config.getParameter<edm::ParameterSet>("me"))) {}
0055
0056 MEPSet PSMonitorClient::getHistoPSet(edm::ParameterSet pset) {
0057 return MEPSet{
0058 pset.getParameter<std::string>("name"),
0059 pset.getParameter<std::string>("folder"),
0060 };
0061 }
0062
0063 void PSMonitorClient::fillMePSetDescription(edm::ParameterSetDescription &pset) {
0064 pset.add<std::string>("folder", "HLT/PSMonitoring");
0065 pset.add<std::string>("name", "psColumnVSlumi");
0066 }
0067
0068 void PSMonitorClient::dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) { check(booker, getter); }
0069
0070 void PSMonitorClient::dqmEndLuminosityBlock(DQMStore::IBooker &booker,
0071 DQMStore::IGetter &getter,
0072 edm::LuminosityBlock const &lumi,
0073 edm::EventSetup const &setup) {
0074 check(booker, getter);
0075 }
0076
0077 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0078 void PSMonitorClient::check(DQMStore::IBooker &booker, DQMStore::IGetter &getter) {
0079 std::string folder = psColumnVSlumiPSet.folder;
0080 std::string name = psColumnVSlumiPSet.name;
0081
0082 getter.setCurrentFolder(folder);
0083 MonitorElement *psColumnVSlumi = getter.get(psColumnVSlumiPSet.folder + "/" + psColumnVSlumiPSet.name);
0084
0085 if (!psColumnVSlumi) {
0086 edm::LogWarning("PSMonitorClient") << "no " << psColumnVSlumiPSet.name << " ME is available in "
0087 << psColumnVSlumiPSet.folder << std::endl;
0088 return;
0089 }
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102 }
0103
0104 void PSMonitorClient::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
0105
0106
0107 edm::ParameterSetDescription desc;
0108 desc.addUntracked<std::string>("dqmPath", "HLT/PSMonitoring");
0109
0110 edm::ParameterSetDescription mePSet;
0111 fillMePSetDescription(mePSet);
0112 desc.add<edm::ParameterSetDescription>("me", mePSet);
0113
0114 descriptions.add("psMonitorClient", desc);
0115 }
0116
0117
0118 #include "FWCore/Framework/interface/MakerMacros.h"
0119 DEFINE_FWK_MODULE(PSMonitorClient);