Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-03 02:53:41

0001 #include "FWCore/Framework/interface/Frameworkfwd.h"
0002 #include "FWCore/Framework/interface/Event.h"
0003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0005 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 #include "DQMServices/Core/interface/DQMStore.h"
0009 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0010 #include "DQMOffline/Trigger/plugins/TriggerDQMBase.h"
0011 #include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h"
0012 #include "CommonTools/Utils/interface/StringCutObjectSelector.h"
0013 #include "DataFormats/METReco/interface/PFMET.h"
0014 #include "DataFormats/METReco/interface/PFMETCollection.h"
0015 #include "DataFormats/JetReco/interface/PFJet.h"
0016 #include "DataFormats/JetReco/interface/PFJetCollection.h"
0017 #include "DataFormats/MuonReco/interface/Muon.h"
0018 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0019 #include "DataFormats/TrackReco/interface/Track.h"
0020 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0021 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0022 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
0023 #include "DataFormats/VertexReco/interface/Vertex.h"
0024 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0025 #include "DataFormats/Math/interface/deltaPhi.h"
0026 
0027 class METMonitor : public DQMEDAnalyzer, public TriggerDQMBase {
0028 public:
0029   typedef dqm::reco::MonitorElement MonitorElement;
0030   typedef dqm::reco::DQMStore DQMStore;
0031 
0032   METMonitor(const edm::ParameterSet&);
0033   ~METMonitor() throw() override;
0034   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0035 
0036 protected:
0037   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0038   void analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) override;
0039 
0040 private:
0041   const std::string folderName_;
0042 
0043   const bool requireValidHLTPaths_;
0044   bool hltPathsAreValid_;
0045   const bool enableFullMonitoring_;
0046 
0047   edm::InputTag metInputTag_;
0048   edm::InputTag jetInputTag_;
0049   edm::InputTag eleInputTag_;
0050   edm::InputTag muoInputTag_;
0051   edm::InputTag vtxInputTag_;
0052 
0053   edm::EDGetTokenT<reco::PFMETCollection> metToken_;
0054   edm::EDGetTokenT<reco::PFJetCollection> jetToken_;
0055   edm::EDGetTokenT<reco::GsfElectronCollection> eleToken_;
0056   edm::EDGetTokenT<reco::MuonCollection> muoToken_;
0057   edm::EDGetTokenT<reco::VertexCollection> vtxToken_;
0058 
0059   std::vector<double> met_variable_binning_;
0060   std::vector<double> jetptBinning_;
0061   MEbinning met_binning_;
0062   MEbinning ls_binning_;
0063 
0064   ObjME metME_;
0065   ObjME metME_variableBinning_;
0066   ObjME metVsLS_;
0067   ObjME metPhiME_;
0068   ObjME deltaphimetj1ME_;
0069   ObjME deltaphij1j2ME_;
0070   ObjME phij1ME_;
0071   ObjME phij2ME_;
0072   ObjME jetPhiME_;
0073   ObjME etaj1ME_;
0074   ObjME etaj2ME_;
0075   ObjME jetEtaME_;
0076   ObjME jetpt1ME_;
0077   ObjME jetpt2ME_;
0078   ObjME jetPtME_;
0079   ObjME nJetsME_;
0080 
0081   std::unique_ptr<GenericTriggerEventFlag> num_genTriggerEventFlag_;
0082   std::unique_ptr<GenericTriggerEventFlag> den_genTriggerEventFlag_;
0083 
0084   StringCutObjectSelector<reco::MET, true> metSelection_;
0085   StringCutObjectSelector<reco::PFJet, true> jetSelection_;
0086   StringCutObjectSelector<reco::GsfElectron, true> eleSelection_;
0087   StringCutObjectSelector<reco::Muon, true> muoSelection_;
0088 
0089   unsigned njets_;
0090   unsigned nelectrons_;
0091   unsigned nmuons_;
0092 
0093   static constexpr double MAX_PHI = 3.2;
0094   static constexpr int N_PHI = 64;
0095   static constexpr MEbinning phi_binning_{N_PHI, -MAX_PHI, MAX_PHI};
0096   // Define Eta Bining
0097   static constexpr double MAX_ETA = 5.0;
0098   static constexpr int N_ETA = 50;
0099   static constexpr MEbinning eta_binning{N_ETA, -MAX_ETA, MAX_ETA};
0100   //Define nJets Binning general selection Pt>0
0101   static constexpr int MIN_NJETS = 0;
0102   static constexpr int MAX_NJETS = 200;
0103   static constexpr int N_BIN_NJETS = 200;
0104   static constexpr MEbinning nJets_binning{N_BIN_NJETS, MIN_NJETS, MAX_NJETS};
0105 
0106   std::vector<bool> warningPrinted4token_;
0107 };
0108 
0109 METMonitor::METMonitor(const edm::ParameterSet& iConfig)
0110     : folderName_(iConfig.getParameter<std::string>("FolderName")),
0111       requireValidHLTPaths_(iConfig.getParameter<bool>("requireValidHLTPaths")),
0112       hltPathsAreValid_(false),
0113       enableFullMonitoring_(iConfig.getParameter<bool>("enableFullMonitoring")),
0114       metInputTag_(iConfig.getParameter<edm::InputTag>("met")),
0115       jetInputTag_(iConfig.getParameter<edm::InputTag>("jets")),
0116       eleInputTag_(iConfig.getParameter<edm::InputTag>("electrons")),
0117       muoInputTag_(iConfig.getParameter<edm::InputTag>("muons")),
0118       vtxInputTag_(iConfig.getParameter<edm::InputTag>("vertices")),
0119       metToken_(consumes<reco::PFMETCollection>(metInputTag_)),
0120       jetToken_(mayConsume<reco::PFJetCollection>(jetInputTag_)),
0121       eleToken_(mayConsume<reco::GsfElectronCollection>(eleInputTag_)),
0122       muoToken_(mayConsume<reco::MuonCollection>(muoInputTag_)),
0123       vtxToken_(mayConsume<reco::VertexCollection>(vtxInputTag_)),
0124       met_variable_binning_(
0125           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double> >("metBinning")),
0126       jetptBinning_(
0127           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double> >("jetptBinning")),
0128       met_binning_(getHistoPSet(
0129           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("metPSet"))),
0130       ls_binning_(
0131           getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("lsPSet"))),
0132       num_genTriggerEventFlag_(new GenericTriggerEventFlag(
0133           iConfig.getParameter<edm::ParameterSet>("numGenericTriggerEventPSet"), consumesCollector(), *this)),
0134       den_genTriggerEventFlag_(new GenericTriggerEventFlag(
0135           iConfig.getParameter<edm::ParameterSet>("denGenericTriggerEventPSet"), consumesCollector(), *this)),
0136       metSelection_(iConfig.getParameter<std::string>("metSelection")),
0137       jetSelection_(iConfig.getParameter<std::string>("jetSelection")),
0138       eleSelection_(iConfig.getParameter<std::string>("eleSelection")),
0139       muoSelection_(iConfig.getParameter<std::string>("muoSelection")),
0140       njets_(iConfig.getParameter<unsigned>("njets")),
0141       nelectrons_(iConfig.getParameter<unsigned>("nelectrons")),
0142       nmuons_(iConfig.getParameter<unsigned>("nmuons")) {
0143   // this vector has to be alligned to the the number of Tokens accessed by this module
0144   warningPrinted4token_.push_back(false);  // PFMETCollection
0145   warningPrinted4token_.push_back(false);  // JetCollection
0146   warningPrinted4token_.push_back(false);  // GsfElectronCollection
0147   warningPrinted4token_.push_back(false);  // MuonCollection
0148   warningPrinted4token_.push_back(false);  // VertexCollection
0149 }
0150 
0151 METMonitor::~METMonitor() throw() {
0152   if (num_genTriggerEventFlag_) {
0153     num_genTriggerEventFlag_.reset();
0154   }
0155   if (den_genTriggerEventFlag_) {
0156     den_genTriggerEventFlag_.reset();
0157   }
0158 }
0159 
0160 void METMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) {
0161   // Initialize the GenericTriggerEventFlag
0162   if (num_genTriggerEventFlag_ && num_genTriggerEventFlag_->on()) {
0163     num_genTriggerEventFlag_->initRun(iRun, iSetup);
0164   }
0165   if (den_genTriggerEventFlag_ && den_genTriggerEventFlag_->on()) {
0166     den_genTriggerEventFlag_->initRun(iRun, iSetup);
0167   }
0168 
0169   // check if every HLT path specified in numerator and denominator has a valid match in the HLT Menu
0170   hltPathsAreValid_ = (num_genTriggerEventFlag_ && den_genTriggerEventFlag_ && num_genTriggerEventFlag_->on() &&
0171                        den_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->allHLTPathsAreValid() &&
0172                        den_genTriggerEventFlag_->allHLTPathsAreValid());
0173 
0174   // if valid HLT paths are required,
0175   // create DQM outputs only if all paths are valid
0176   if (requireValidHLTPaths_ and (not hltPathsAreValid_)) {
0177     return;
0178   }
0179 
0180   std::string histname, histtitle;
0181 
0182   std::string currentFolder = folderName_;
0183   ibooker.setCurrentFolder(currentFolder);
0184 
0185   histname = "deltaphi_metjet1";
0186   histtitle = "DPHI_METJ1";
0187   bookME(ibooker, deltaphimetj1ME_, histname, histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
0188   setMETitle(deltaphimetj1ME_, "delta phi (met, j1)", "events / 0.1 rad");
0189 
0190   histname = "deltaphi_jet1jet2";
0191   histtitle = "DPHI_J1J2";
0192   bookME(ibooker, deltaphij1j2ME_, histname, histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
0193   setMETitle(deltaphij1j2ME_, "delta phi (j1, j2)", "events / 0.1 rad");
0194 
0195   histname = "met";
0196   histtitle = "PFMET";
0197   bookME(ibooker, metME_, histname, histtitle, met_binning_.nbins, met_binning_.xmin, met_binning_.xmax);
0198   setMETitle(metME_, "PF MET [GeV]", "events / [GeV]");
0199 
0200   histname = "met_variable";
0201   histtitle = "PFMET";
0202   bookME(ibooker, metME_variableBinning_, histname, histtitle, met_variable_binning_);
0203   setMETitle(metME_variableBinning_, "PF MET [GeV]", "events / [GeV]");
0204 
0205   histname = "metVsLS";
0206   histtitle = "PFMET vs LS";
0207   bookME(ibooker,
0208          metVsLS_,
0209          histname,
0210          histtitle,
0211          ls_binning_.nbins,
0212          ls_binning_.xmin,
0213          ls_binning_.xmax,
0214          met_binning_.xmin,
0215          met_binning_.xmax);
0216   setMETitle(metVsLS_, "LS", "PF MET [GeV]");
0217 
0218   histname = "metPhi";
0219   histtitle = "PFMET phi";
0220   bookME(ibooker, metPhiME_, histname, histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
0221   setMETitle(metPhiME_, "PF MET #phi", "events / 0.1 rad");
0222 
0223   histname = "jetEta";
0224   histtitle = "Jet eta";
0225   bookME(ibooker, jetEtaME_, histname, histtitle, eta_binning.nbins, eta_binning.xmin, eta_binning.xmax);
0226   setMETitle(jetEtaME_, "Jet #eta", "events");
0227 
0228   histname = "jetPhi";
0229   histtitle = "Jet phi";
0230   bookME(ibooker, jetPhiME_, histname, histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
0231   setMETitle(jetPhiME_, "Jet #phi", "events / 0.1 rad");
0232 
0233   histname = "jetPt";
0234   histtitle = "Jet Pt";
0235   bookME(ibooker, jetPtME_, histname, histtitle, jetptBinning_);
0236   setMETitle(jetPtME_, "jet Pt[GeV]", "events");
0237 
0238   histname = "NJets";
0239   histtitle = "number of Jets";
0240   bookME(ibooker, nJetsME_, histname, histtitle, nJets_binning.nbins, nJets_binning.xmin, nJets_binning.xmax);
0241   setMETitle(nJetsME_, "number of Jets", "events");
0242 
0243   //check the flag
0244   if (!enableFullMonitoring_) {
0245     return;
0246   }
0247 
0248   histname = "jetEta_1";
0249   histtitle = "leading Jet eta";
0250   bookME(ibooker, etaj1ME_, histname, histtitle, eta_binning.nbins, eta_binning.xmin, eta_binning.xmax);
0251   setMETitle(etaj1ME_, "Jet_1 #eta", "events");
0252 
0253   histname = "jetEta_2";
0254   histtitle = "subleading Jet eta";
0255   bookME(ibooker, etaj2ME_, histname, histtitle, eta_binning.nbins, eta_binning.xmin, eta_binning.xmax);
0256   setMETitle(etaj2ME_, "Jet_2 #eta", "events");
0257 
0258   histname = "jetPhi_1";
0259   histtitle = "leading Jet phi";
0260   bookME(ibooker, phij1ME_, histname, histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
0261   setMETitle(phij1ME_, "Jet_1 #phi", "events / 0.1 rad");
0262 
0263   histname = "jetPhi_2";
0264   histtitle = "subleading Jet phi";
0265   bookME(ibooker, phij2ME_, histname, histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
0266   setMETitle(phij2ME_, "Jet_2 #phi", "events / 0.1 rad");
0267 
0268   histname = "jetPt_1";
0269   histtitle = "leading Jet Pt";
0270   bookME(ibooker, jetpt1ME_, histname, histtitle, jetptBinning_);
0271   setMETitle(jetpt1ME_, "Pt_1 [GeV]", "events");
0272 
0273   histname = "jetPt_2";
0274   histtitle = "second leading Jet Pt";
0275   bookME(ibooker, jetpt2ME_, histname, histtitle, jetptBinning_);
0276   setMETitle(jetpt2ME_, "Pt_2 [GeV]", "events");
0277 }
0278 
0279 void METMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) {
0280   // if valid HLT paths are required,
0281   // analyze event only if all paths are valid
0282   if (requireValidHLTPaths_ and (not hltPathsAreValid_)) {
0283     return;
0284   }
0285 
0286   // Filter out events if Trigger Filtering is requested
0287   if (den_genTriggerEventFlag_->on() && !den_genTriggerEventFlag_->accept(iEvent, iSetup))
0288     return;
0289 
0290   edm::Handle<reco::PFMETCollection> metHandle;
0291   iEvent.getByToken(metToken_, metHandle);
0292   if (!metHandle.isValid()) {
0293     if (!warningPrinted4token_[0]) {
0294       edm::LogWarning("METMonitor") << "skipping events because the collection " << metInputTag_.label().c_str()
0295                                     << " is not available";
0296       warningPrinted4token_[0] = true;
0297     }
0298     return;
0299   }
0300   reco::PFMET pfmet = metHandle->front();
0301   if (!metSelection_(pfmet))
0302     return;
0303 
0304   const float met = pfmet.pt();
0305   const float phi = pfmet.phi();
0306 
0307   std::vector<reco::PFJet> jets;
0308   edm::Handle<reco::PFJetCollection> jetHandle;
0309   iEvent.getByToken(jetToken_, jetHandle);
0310   if (jetHandle.isValid()) {
0311     if (jetHandle->size() < njets_)
0312       return;
0313     for (auto const& j : *jetHandle) {
0314       if (jetSelection_(j)) {
0315         jets.push_back(j);
0316       }
0317     }
0318   } else {
0319     if (!warningPrinted4token_[1]) {
0320       if (jetInputTag_.label().empty())
0321         edm::LogWarning("METMonitor") << "JetCollection not set";
0322       else
0323         edm::LogWarning("METMonitor") << "skipping events because the collection " << jetInputTag_.label().c_str()
0324                                       << " is not available";
0325       warningPrinted4token_[1] = true;
0326     }
0327     // if Handle is not valid, because the InputTag has been mis-configured, then skip the event
0328     if (!jetInputTag_.label().empty())
0329       return;
0330   }
0331   const float deltaPhi_met_j1 = !jets.empty() ? fabs(deltaPhi(pfmet.phi(), jets[0].phi())) : -10.0;
0332   const float deltaPhi_j1_j2 = jets.size() >= 2 ? fabs(deltaPhi(jets[0].phi(), jets[1].phi())) : -10.0;
0333   const int nJetsSel = jets.size();
0334   const float Pt_J1 = !jets.empty() ? jets[0].pt() : -10.;
0335   const float Pt_J2 = jets.size() >= 2 ? jets[1].pt() : -10.0;
0336   const float Phi_J1 = !jets.empty() ? jets[0].phi() : -10.0;
0337   const float Phi_J2 = jets.size() >= 2 ? jets[1].phi() : -10.0;
0338   const float Eta_J1 = !jets.empty() ? jets[0].p4().eta() : -10.0;
0339   const float Eta_J2 = jets.size() >= 2 ? jets[1].p4().eta() : -10.0;
0340 
0341   std::vector<reco::GsfElectron> electrons;
0342   edm::Handle<reco::GsfElectronCollection> eleHandle;
0343   iEvent.getByToken(eleToken_, eleHandle);
0344   if (eleHandle.isValid()) {
0345     if (eleHandle->size() < nelectrons_)
0346       return;
0347     for (auto const& e : *eleHandle) {
0348       if (eleSelection_(e))
0349         electrons.push_back(e);
0350     }
0351     if (electrons.size() < nelectrons_)
0352       return;
0353   } else {
0354     if (!warningPrinted4token_[2]) {
0355       warningPrinted4token_[2] = true;
0356       if (eleInputTag_.label().empty())
0357         edm::LogWarning("METMonitor") << "GsfElectronCollection not set";
0358       else
0359         edm::LogWarning("METMonitor") << "skipping events because the collection " << eleInputTag_.label().c_str()
0360                                       << " is not available";
0361     }
0362     if (!eleInputTag_.label().empty())
0363       return;
0364   }
0365 
0366   reco::Vertex vtx;
0367   edm::Handle<reco::VertexCollection> vtxHandle;
0368   iEvent.getByToken(vtxToken_, vtxHandle);
0369   if (vtxHandle.isValid()) {
0370     for (auto const& v : *vtxHandle) {
0371       bool isFake = v.isFake();
0372 
0373       if (!isFake) {
0374         vtx = v;
0375         break;
0376       }
0377     }
0378   } else {
0379     if (!warningPrinted4token_[3]) {
0380       warningPrinted4token_[3] = true;
0381       if (vtxInputTag_.label().empty())
0382         edm::LogWarning("METMonitor") << "VertexCollection is not set";
0383       else
0384         edm::LogWarning("METMonitor") << "skipping events because the collection " << vtxInputTag_.label().c_str()
0385                                       << " is not available";
0386     }
0387     if (!vtxInputTag_.label().empty())
0388       return;
0389   }
0390 
0391   std::vector<reco::Muon> muons;
0392   edm::Handle<reco::MuonCollection> muoHandle;
0393   iEvent.getByToken(muoToken_, muoHandle);
0394   if (muoHandle.isValid()) {
0395     if (muoHandle->size() < nmuons_)
0396       return;
0397     for (auto const& m : *muoHandle) {
0398       bool pass = m.isGlobalMuon() && m.isPFMuon() && m.globalTrack()->normalizedChi2() < 10. &&
0399                   m.globalTrack()->hitPattern().numberOfValidMuonHits() > 0 && m.numberOfMatchedStations() > 1 &&
0400                   fabs(m.muonBestTrack()->dxy(vtx.position())) < 0.2 &&
0401                   fabs(m.muonBestTrack()->dz(vtx.position())) < 0.5 &&
0402                   m.innerTrack()->hitPattern().numberOfValidPixelHits() > 0 &&
0403                   m.innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5;
0404       if (muoSelection_(m) && pass)
0405         muons.push_back(m);
0406     }
0407     if (muons.size() < nmuons_)
0408       return;
0409   } else {
0410     if (!warningPrinted4token_[4]) {
0411       warningPrinted4token_[4] = true;
0412       if (muoInputTag_.label().empty())
0413         edm::LogWarning("METMonitor") << "MuonCollection not set";
0414       else
0415         edm::LogWarning("METMonitor") << "skipping events because the collection " << muoInputTag_.label().c_str()
0416                                       << " is not available";
0417     }
0418     if (!muoInputTag_.label().empty())
0419       return;
0420   }
0421 
0422   // filling histograms (denominator)
0423   metME_.denominator->Fill(met);
0424   metME_variableBinning_.denominator->Fill(met);
0425   metPhiME_.denominator->Fill(phi);
0426   deltaphimetj1ME_.denominator->Fill(deltaPhi_met_j1);
0427   deltaphij1j2ME_.denominator->Fill(deltaPhi_j1_j2);
0428 
0429   const int ls = iEvent.id().luminosityBlock();
0430   metVsLS_.denominator->Fill(ls, met);
0431 
0432   nJetsME_.denominator->Fill(nJetsSel);
0433   for (auto const& jet : jets) {
0434     jetPtME_.denominator->Fill(jet.pt());
0435     jetPhiME_.denominator->Fill(jet.phi());
0436     jetEtaME_.denominator->Fill(jet.p4().eta());
0437   }
0438   if (enableFullMonitoring_) {  //===check the flag
0439     jetpt1ME_.denominator->Fill(Pt_J1);
0440     jetpt2ME_.denominator->Fill(Pt_J2);
0441     phij1ME_.denominator->Fill(Phi_J1);
0442     phij2ME_.denominator->Fill(Phi_J2);
0443     etaj1ME_.denominator->Fill(Eta_J1);
0444     etaj2ME_.denominator->Fill(Eta_J2);
0445   }
0446 
0447   // applying selection for numerator
0448   if (num_genTriggerEventFlag_->on() && !num_genTriggerEventFlag_->accept(iEvent, iSetup))
0449     return;
0450 
0451   // filling histograms (num_genTriggerEventFlag_)
0452   metME_.numerator->Fill(met);
0453   metME_variableBinning_.numerator->Fill(met);
0454   metPhiME_.numerator->Fill(phi);
0455   metVsLS_.numerator->Fill(ls, met);
0456   deltaphimetj1ME_.numerator->Fill(deltaPhi_met_j1);
0457   deltaphij1j2ME_.numerator->Fill(deltaPhi_j1_j2);
0458 
0459   nJetsME_.numerator->Fill(nJetsSel);
0460   for (auto const& jet : jets) {
0461     jetPtME_.numerator->Fill(jet.pt());
0462     jetPhiME_.numerator->Fill(jet.phi());
0463     jetEtaME_.numerator->Fill(jet.p4().eta());
0464   }
0465   if (enableFullMonitoring_) {  //===check the flag
0466     jetpt1ME_.numerator->Fill(Pt_J1);
0467     jetpt2ME_.numerator->Fill(Pt_J2);
0468     phij1ME_.numerator->Fill(Phi_J1);
0469     phij2ME_.numerator->Fill(Phi_J2);
0470     etaj1ME_.numerator->Fill(Eta_J1);
0471     etaj2ME_.numerator->Fill(Eta_J2);
0472   }
0473 }
0474 
0475 void METMonitor::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0476   edm::ParameterSetDescription desc;
0477   desc.add<std::string>("FolderName", "HLT/MET");
0478   desc.add<bool>("requireValidHLTPaths", true);
0479   //========== flag to enable more or less outputs in each trigger =====
0480   desc.add<bool>("enableFullMonitoring", false);
0481 
0482   desc.add<edm::InputTag>("met", edm::InputTag("pfMet"));
0483   desc.add<edm::InputTag>("jets", edm::InputTag("ak4PFJetsCHS"));
0484   desc.add<edm::InputTag>("electrons", edm::InputTag("gedGsfElectrons"));
0485   desc.add<edm::InputTag>("muons", edm::InputTag("muons"));
0486   desc.add<edm::InputTag>("vertices", edm::InputTag("offlinePrimaryVertices"));
0487   desc.add<std::string>("metSelection", "pt > 0");
0488   desc.add<std::string>("jetSelection", "pt > 0");
0489   desc.add<std::string>("eleSelection", "pt > 0");
0490   desc.add<std::string>("muoSelection", "pt > 0");
0491   desc.add<unsigned>("njets", 0);
0492   desc.add<unsigned>("nelectrons", 0);
0493   desc.add<unsigned>("nmuons", 0);
0494 
0495   edm::ParameterSetDescription genericTriggerEventPSet;
0496   GenericTriggerEventFlag::fillPSetDescription(genericTriggerEventPSet);
0497 
0498   desc.add<edm::ParameterSetDescription>("numGenericTriggerEventPSet", genericTriggerEventPSet);
0499   desc.add<edm::ParameterSetDescription>("denGenericTriggerEventPSet", genericTriggerEventPSet);
0500 
0501   edm::ParameterSetDescription histoPSet;
0502   edm::ParameterSetDescription metPSet;
0503   fillHistoPSetDescription(metPSet);
0504   histoPSet.add<edm::ParameterSetDescription>("metPSet", metPSet);
0505   std::vector<double> bins = {0.,   20.,  40.,  60.,  80.,  90.,  100., 110., 120., 130., 140., 150., 160.,
0506                               170., 180., 190., 200., 220., 240., 260., 280., 300., 350., 400., 450., 1000.};
0507   histoPSet.add<std::vector<double> >("metBinning", bins);
0508   std::vector<double> bins_ = {
0509       0.,   20.,  40.,  60.,  80.,  90.,  100., 110., 120., 130., 140., 150., 160.,
0510       170., 180., 190., 200., 220., 240., 260., 280., 300., 350., 400., 450., 1000.};  // Jet pT Binning
0511   histoPSet.add<std::vector<double> >("jetptBinning", bins_);
0512 
0513   edm::ParameterSetDescription lsPSet;
0514   fillHistoLSPSetDescription(lsPSet);
0515   histoPSet.add<edm::ParameterSetDescription>("lsPSet", lsPSet);
0516 
0517   desc.add<edm::ParameterSetDescription>("histoPSet", histoPSet);
0518 
0519   descriptions.add("metMonitoring", desc);
0520 }
0521 
0522 DEFINE_FWK_MODULE(METMonitor);