Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:56

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