Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-04-24 01:27:54

0001 #include "DQMServices/Core/interface/DQMStore.h"
0002 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0003 #include "FWCore/Utilities/interface/EDGetToken.h"
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/ServiceRegistry/interface/Service.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/Utilities/interface/transform.h"
0013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0014 #include "CommonTools/Utils/interface/StringCutObjectSelector.h"
0015 #include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h"
0016 #include "DataFormats/Math/interface/deltaR.h"
0017 #include "DataFormats/Common/interface/ValueMap.h"
0018 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0019 #include "DataFormats/MuonReco/interface/Muon.h"
0020 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0021 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
0022 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
0023 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0024 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
0025 #include "DataFormats/BTauReco/interface/JetTag.h"
0026 #include "DataFormats/METReco/interface/PFMET.h"
0027 #include "DataFormats/METReco/interface/PFMETCollection.h"
0028 #include "DQMOffline/Trigger/plugins/TriggerDQMBase.h"
0029 
0030 #include "DataFormats/PatCandidates/interface/Jet.h"
0031 #include "DataFormats/PatCandidates/interface/Electron.h"
0032 #include "DataFormats/PatCandidates/interface/Muon.h"
0033 #include "DataFormats/PatCandidates/interface/MET.h"
0034 #include "DataFormats/PatCandidates/interface/Photon.h"
0035 
0036 #include <string>
0037 #include <vector>
0038 #include <memory>
0039 #include <map>
0040 
0041 class BTVMonitor : public DQMEDAnalyzer, public TriggerDQMBase {
0042 public:
0043   typedef dqm::reco::MonitorElement MonitorElement;
0044   typedef dqm::reco::DQMStore DQMStore;
0045 
0046   BTVMonitor(const edm::ParameterSet&);
0047   ~BTVMonitor() throw() override;
0048   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0049 
0050 protected:
0051   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0052   void analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) override;
0053 
0054   struct JetRefCompare {
0055     inline bool operator()(const edm::RefToBase<pat::Jet>& j1, const edm::RefToBase<pat::Jet>& j2) const {
0056       return (j1.id() < j2.id()) || ((j1.id() == j2.id()) && (j1.key() < j2.key()));
0057     }
0058   };
0059 
0060   typedef std::map<std::string, float> BTagScores;
0061   typedef std::map<edm::RefToBase<pat::Jet>, BTagScores, JetRefCompare> JetBTagMap;
0062 
0063 private:
0064   const std::string folderName_;
0065 
0066   const bool requireValidHLTPaths_;
0067   bool hltPathsAreValid_;
0068 
0069   edm::EDGetTokenT<reco::VertexCollection> vtxToken_;
0070   edm::EDGetTokenT<edm::View<pat::Muon>> muoToken_;
0071   edm::EDGetTokenT<edm::View<pat::Electron>> eleToken_;
0072   edm::EDGetTokenT<edm::ValueMap<bool>> elecIDToken_;
0073   edm::EDGetTokenT<pat::PhotonCollection> phoToken_;
0074   edm::EDGetTokenT<edm::View<pat::Jet>> jetToken_;
0075   edm::EDGetTokenT<pat::METCollection> metToken_;
0076   std::vector<std::string> btagAlgos_;
0077   struct PVcut {
0078     double dxy;
0079     double dz;
0080   };
0081 
0082   MEbinning met_binning_;
0083   MEbinning ls_binning_;
0084   MEbinning phi_binning_;
0085   MEbinning pt_binning_;
0086   MEbinning eta_binning_;
0087   MEbinning HT_binning_;
0088   MEbinning DR_binning_;
0089   MEbinning csv_binning_;
0090   MEbinning invMass_mumu_binning_;
0091   MEbinning MHT_binning_;
0092 
0093   std::vector<double> met_variable_binning_;
0094   std::vector<double> HT_variable_binning_;
0095   std::vector<double> jetPt_variable_binning_;
0096   std::vector<double> muPt_variable_binning_;
0097   std::vector<double> elePt_variable_binning_;
0098   std::vector<double> jetEta_variable_binning_;
0099   std::vector<double> muEta_variable_binning_;
0100   std::vector<double> eleEta_variable_binning_;
0101   std::vector<double> invMass_mumu_variable_binning_;
0102   std::vector<double> MHT_variable_binning_;
0103 
0104   std::vector<double> HT_variable_binning_2D_;
0105   std::vector<double> jetPt_variable_binning_2D_;
0106   std::vector<double> muPt_variable_binning_2D_;
0107   std::vector<double> elePt_variable_binning_2D_;
0108   std::vector<double> phoPt_variable_binning_2D_;
0109   std::vector<double> jetEta_variable_binning_2D_;
0110   std::vector<double> muEta_variable_binning_2D_;
0111   std::vector<double> eleEta_variable_binning_2D_;
0112   std::vector<double> phoEta_variable_binning_2D_;
0113   std::vector<double> phi_variable_binning_2D_;
0114 
0115   ObjME metME_;
0116   ObjME metME_variableBinning_;
0117   ObjME metVsLS_;
0118   ObjME metPhiME_;
0119 
0120   ObjME jetVsLS_;
0121   ObjME muVsLS_;
0122   ObjME eleVsLS_;
0123   ObjME phoVsLS_;
0124   ObjME bjetVsLS_;
0125   ObjME htVsLS_;
0126 
0127   ObjME jetEtaPhi_HEP17_;  // for HEP17 monitoring
0128 
0129   ObjME jetMulti_;
0130   ObjME eleMulti_;
0131   ObjME muMulti_;
0132   ObjME phoMulti_;
0133   ObjME bjetMulti_;
0134 
0135   ObjME elePt_jetPt_;
0136   ObjME elePt_eventHT_;
0137 
0138   ObjME ele1Pt_ele2Pt_;
0139   ObjME ele1Eta_ele2Eta_;
0140   ObjME mu1Pt_mu2Pt_;
0141   ObjME mu1Eta_mu2Eta_;
0142   ObjME elePt_muPt_;
0143   ObjME eleEta_muEta_;
0144   ObjME invMass_mumu_;
0145   ObjME eventMHT_;
0146   ObjME invMass_mumu_variableBinning_;
0147   ObjME eventMHT_variableBinning_;
0148   ObjME muPt_phoPt_;
0149   ObjME muEta_phoEta_;
0150 
0151   ObjME DeltaR_jet_Mu_;
0152 
0153   ObjME eventHT_;
0154   ObjME eventHT_variableBinning_;
0155 
0156   std::vector<ObjME> muPhi_;
0157   std::vector<ObjME> muEta_;
0158   std::vector<ObjME> muPt_;
0159 
0160   std::vector<ObjME> elePhi_;
0161   std::vector<ObjME> eleEta_;
0162   std::vector<ObjME> elePt_;
0163 
0164   std::vector<ObjME> jetPhi_;
0165   std::vector<ObjME> jetEta_;
0166   std::vector<ObjME> jetPt_;
0167 
0168   std::vector<ObjME> phoPhi_;
0169   std::vector<ObjME> phoEta_;
0170   std::vector<ObjME> phoPt_;
0171 
0172   std::vector<ObjME> bjetPhi_;
0173   std::vector<ObjME> bjetEta_;
0174   std::vector<ObjME> bjetPt_;
0175   std::vector<ObjME> bjetDeepFlav_;
0176   std::vector<ObjME> bjetPNet_;
0177   std::vector<ObjME> bjetUParT_;
0178 
0179   // 2D distributions
0180   std::vector<ObjME> jetPtEta_;
0181   std::vector<ObjME> jetEtaPhi_;
0182 
0183   std::vector<ObjME> elePtEta_;
0184   std::vector<ObjME> eleEtaPhi_;
0185 
0186   std::vector<ObjME> muPtEta_;
0187   std::vector<ObjME> muEtaPhi_;
0188 
0189   std::vector<ObjME> phoPtEta_;
0190   std::vector<ObjME> phoEtaPhi_;
0191 
0192   std::vector<ObjME> bjetPtEta_;
0193   std::vector<ObjME> bjetEtaPhi_;
0194   std::vector<ObjME> bjetDeepFlavHT_;
0195   std::vector<ObjME> bjetPNetHT_;
0196   std::vector<ObjME> bjetUParTHT_;
0197 
0198   std::unique_ptr<GenericTriggerEventFlag> num_genTriggerEventFlag_;
0199   std::unique_ptr<GenericTriggerEventFlag> den_genTriggerEventFlag_;
0200 
0201   StringCutObjectSelector<pat::MET> metSelection_;
0202   StringCutObjectSelector<pat::Jet> jetSelection_;
0203   StringCutObjectSelector<pat::Electron, true> eleSelection_;
0204   StringCutObjectSelector<pat::Muon> muoSelection_;
0205   StringCutObjectSelector<pat::Photon> phoSelection_;
0206 
0207   StringCutObjectSelector<pat::Jet> HTdefinition_;
0208 
0209   StringCutObjectSelector<reco::Vertex> vtxSelection_;
0210 
0211   StringCutObjectSelector<pat::Jet, true> bjetSelection_;
0212 
0213   unsigned int njets_;
0214   unsigned int nelectrons_;
0215   unsigned int nmuons_;
0216   unsigned int nphotons_;
0217   double leptJetDeltaRmin_;
0218   double bJetMuDeltaRmax_;
0219   double bJetDeltaEtaMax_;
0220   double HTcut_;
0221   unsigned int nbjets_;
0222   double workingpoint_;
0223   PVcut lepPVcuts_;
0224   bool applyLeptonPVcuts_;
0225 
0226   bool applyMETcut_ = false;
0227 
0228   double invMassUppercut_;
0229   double invMassLowercut_;
0230   bool opsign_;
0231   StringCutObjectSelector<pat::Jet> MHTdefinition_;
0232   double MHTcut_;
0233 
0234   bool invMassCutInAllMuPairs_;
0235 
0236   bool enablePhotonPlot_;
0237   bool enableMETPlot_;
0238   bool enable2DPlots_;
0239 };
0240 
0241 BTVMonitor::BTVMonitor(const edm::ParameterSet& iConfig)
0242     : folderName_(iConfig.getParameter<std::string>("FolderName")),
0243       requireValidHLTPaths_(iConfig.getParameter<bool>("requireValidHLTPaths")),
0244       hltPathsAreValid_(false),
0245       vtxToken_(mayConsume<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertices"))),
0246       muoToken_(mayConsume<edm::View<pat::Muon>>(iConfig.getParameter<edm::InputTag>("muons"))),
0247       eleToken_(mayConsume<edm::View<pat::Electron>>(iConfig.getParameter<edm::InputTag>("electrons"))),
0248       elecIDToken_(consumes<edm::ValueMap<bool>>(iConfig.getParameter<edm::InputTag>("elecID"))),
0249       phoToken_(mayConsume<pat::PhotonCollection>(iConfig.getParameter<edm::InputTag>("photons"))),
0250       jetToken_(mayConsume<edm::View<pat::Jet>>(iConfig.getParameter<edm::InputTag>("jets"))),
0251       metToken_(consumes<pat::METCollection>(iConfig.getParameter<edm::InputTag>("met"))),
0252       btagAlgos_(iConfig.getParameter<std::vector<std::string>>("btagAlgos")),
0253       met_binning_(getHistoPSet(
0254           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("metPSet"))),
0255       ls_binning_(
0256           getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("lsPSet"))),
0257       phi_binning_(getHistoPSet(
0258           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("phiPSet"))),
0259       pt_binning_(
0260           getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("ptPSet"))),
0261       eta_binning_(getHistoPSet(
0262           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("etaPSet"))),
0263       HT_binning_(
0264           getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("htPSet"))),
0265       DR_binning_(
0266           getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("DRPSet"))),
0267       csv_binning_(getHistoPSet(
0268           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("csvPSet"))),
0269       invMass_mumu_binning_(getHistoPSet(
0270           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("invMassPSet"))),
0271       MHT_binning_(getHistoPSet(
0272           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("MHTPSet"))),
0273       met_variable_binning_(
0274           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("metBinning")),
0275       HT_variable_binning_(
0276           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("HTBinning")),
0277       jetPt_variable_binning_(
0278           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("jetPtBinning")),
0279       muPt_variable_binning_(
0280           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("muPtBinning")),
0281       elePt_variable_binning_(
0282           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("elePtBinning")),
0283       jetEta_variable_binning_(
0284           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("jetEtaBinning")),
0285       muEta_variable_binning_(
0286           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("muEtaBinning")),
0287       eleEta_variable_binning_(
0288           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("eleEtaBinning")),
0289       invMass_mumu_variable_binning_(iConfig.getParameter<edm::ParameterSet>("histoPSet")
0290                                          .getParameter<std::vector<double>>("invMassVariableBinning")),
0291       MHT_variable_binning_(
0292           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("MHTVariableBinning")),
0293       HT_variable_binning_2D_(
0294           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("HTBinning2D")),
0295       jetPt_variable_binning_2D_(
0296           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("jetPtBinning2D")),
0297       muPt_variable_binning_2D_(
0298           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("muPtBinning2D")),
0299       elePt_variable_binning_2D_(
0300           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("elePtBinning2D")),
0301       phoPt_variable_binning_2D_(
0302           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("phoPtBinning2D")),
0303       jetEta_variable_binning_2D_(
0304           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("jetEtaBinning2D")),
0305       muEta_variable_binning_2D_(
0306           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("muEtaBinning2D")),
0307       eleEta_variable_binning_2D_(
0308           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("eleEtaBinning2D")),
0309       phoEta_variable_binning_2D_(
0310           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("phoEtaBinning2D")),
0311       phi_variable_binning_2D_(
0312           iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double>>("phiBinning2D")),
0313       num_genTriggerEventFlag_(new GenericTriggerEventFlag(
0314           iConfig.getParameter<edm::ParameterSet>("numGenericTriggerEventPSet"), consumesCollector(), *this)),
0315       den_genTriggerEventFlag_(new GenericTriggerEventFlag(
0316           iConfig.getParameter<edm::ParameterSet>("denGenericTriggerEventPSet"), consumesCollector(), *this)),
0317       metSelection_(iConfig.getParameter<std::string>("metSelection")),
0318       jetSelection_(iConfig.getParameter<std::string>("jetSelection")),
0319       eleSelection_(iConfig.getParameter<std::string>("eleSelection")),
0320       muoSelection_(iConfig.getParameter<std::string>("muoSelection")),
0321       phoSelection_(iConfig.getParameter<std::string>("phoSelection")),
0322       HTdefinition_(iConfig.getParameter<std::string>("HTdefinition")),
0323       vtxSelection_(iConfig.getParameter<std::string>("vertexSelection")),
0324       bjetSelection_(iConfig.getParameter<std::string>("bjetSelection")),
0325       njets_(iConfig.getParameter<unsigned int>("njets")),
0326       nelectrons_(iConfig.getParameter<unsigned int>("nelectrons")),
0327       nmuons_(iConfig.getParameter<unsigned int>("nmuons")),
0328       nphotons_(iConfig.getParameter<unsigned int>("nphotons")),
0329       leptJetDeltaRmin_(iConfig.getParameter<double>("leptJetDeltaRmin")),
0330       bJetMuDeltaRmax_(iConfig.getParameter<double>("bJetMuDeltaRmax")),
0331       bJetDeltaEtaMax_(iConfig.getParameter<double>("bJetDeltaEtaMax")),
0332       HTcut_(iConfig.getParameter<double>("HTcut")),
0333       nbjets_(iConfig.getParameter<unsigned int>("nbjets")),
0334       workingpoint_(iConfig.getParameter<double>("workingpoint")),
0335       applyLeptonPVcuts_(iConfig.getParameter<bool>("applyLeptonPVcuts")),
0336       invMassUppercut_(iConfig.getParameter<double>("invMassUppercut")),
0337       invMassLowercut_(iConfig.getParameter<double>("invMassLowercut")),
0338       opsign_(iConfig.getParameter<bool>("oppositeSignMuons")),
0339       MHTdefinition_(iConfig.getParameter<std::string>("MHTdefinition")),
0340       MHTcut_(iConfig.getParameter<double>("MHTcut")),
0341       invMassCutInAllMuPairs_(iConfig.getParameter<bool>("invMassCutInAllMuPairs")),
0342       enablePhotonPlot_(iConfig.getParameter<bool>("enablePhotonPlot")),
0343       enableMETPlot_(iConfig.getParameter<bool>("enableMETPlot")),
0344       enable2DPlots_(iConfig.getParameter<bool>("enable2DPlots")) {
0345   ObjME empty;
0346 
0347   muPhi_ = std::vector<ObjME>(nmuons_, empty);
0348   muEta_ = std::vector<ObjME>(nmuons_, empty);
0349   muPt_ = std::vector<ObjME>(nmuons_, empty);
0350   muPtEta_ = std::vector<ObjME>(nmuons_, empty);
0351   muEtaPhi_ = std::vector<ObjME>(nmuons_, empty);
0352 
0353   elePhi_ = std::vector<ObjME>(nelectrons_, empty);
0354   eleEta_ = std::vector<ObjME>(nelectrons_, empty);
0355   elePt_ = std::vector<ObjME>(nelectrons_, empty);
0356   elePtEta_ = std::vector<ObjME>(nelectrons_, empty);
0357   eleEtaPhi_ = std::vector<ObjME>(nelectrons_, empty);
0358 
0359   jetPhi_ = std::vector<ObjME>(njets_, empty);
0360   jetEta_ = std::vector<ObjME>(njets_, empty);
0361   jetPt_ = std::vector<ObjME>(njets_, empty);
0362   jetPtEta_ = std::vector<ObjME>(njets_, empty);
0363   jetEtaPhi_ = std::vector<ObjME>(njets_, empty);
0364 
0365   //Menglei Sun
0366   phoPhi_ = std::vector<ObjME>(nphotons_, empty);
0367   phoEta_ = std::vector<ObjME>(nphotons_, empty);
0368   phoPt_ = std::vector<ObjME>(nphotons_, empty);
0369   phoPtEta_ = std::vector<ObjME>(nphotons_, empty);
0370   phoEtaPhi_ = std::vector<ObjME>(nphotons_, empty);
0371 
0372   // Marina
0373   bjetPhi_ = std::vector<ObjME>(nbjets_, empty);
0374   bjetEta_ = std::vector<ObjME>(nbjets_, empty);
0375   bjetPt_ = std::vector<ObjME>(nbjets_, empty);
0376   bjetDeepFlav_ = std::vector<ObjME>(nbjets_, empty);
0377   bjetPNet_ = std::vector<ObjME>(nbjets_, empty);
0378   bjetUParT_ = std::vector<ObjME>(nbjets_, empty);
0379   bjetPtEta_ = std::vector<ObjME>(nbjets_, empty);
0380   bjetEtaPhi_ = std::vector<ObjME>(nbjets_, empty);
0381   bjetDeepFlavHT_ = std::vector<ObjME>(nbjets_, empty);
0382   bjetPNetHT_ = std::vector<ObjME>(nbjets_, empty);
0383   bjetUParTHT_ = std::vector<ObjME>(nbjets_, empty);
0384 
0385   //Suvankar
0386   lepPVcuts_.dxy = (iConfig.getParameter<edm::ParameterSet>("leptonPVcuts")).getParameter<double>("dxy");
0387   lepPVcuts_.dz = (iConfig.getParameter<edm::ParameterSet>("leptonPVcuts")).getParameter<double>("dz");
0388 }
0389 
0390 BTVMonitor::~BTVMonitor() throw() {
0391   if (num_genTriggerEventFlag_)
0392     num_genTriggerEventFlag_.reset();
0393   if (den_genTriggerEventFlag_)
0394     den_genTriggerEventFlag_.reset();
0395 }
0396 
0397 void BTVMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) {
0398   // Initialize the GenericTriggerEventFlag
0399   if (num_genTriggerEventFlag_ && num_genTriggerEventFlag_->on())
0400     num_genTriggerEventFlag_->initRun(iRun, iSetup);
0401   if (den_genTriggerEventFlag_ && den_genTriggerEventFlag_->on())
0402     den_genTriggerEventFlag_->initRun(iRun, iSetup);
0403 
0404   // check if every HLT path specified in numerator and denominator has a valid match in the HLT Menu
0405   hltPathsAreValid_ = (num_genTriggerEventFlag_ && den_genTriggerEventFlag_ && num_genTriggerEventFlag_->on() &&
0406                        den_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->allHLTPathsAreValid() &&
0407                        den_genTriggerEventFlag_->allHLTPathsAreValid());
0408 
0409   // if valid HLT paths are required,
0410   // create DQM outputs only if all paths are valid
0411   if (requireValidHLTPaths_ and (not hltPathsAreValid_)) {
0412     return;
0413   }
0414 
0415   std::string histname, histtitle;
0416 
0417   std::string currentFolder = folderName_;
0418   ibooker.setCurrentFolder(currentFolder);
0419 
0420   if (enableMETPlot_) {
0421     histname = "met";
0422     histtitle = "PFMET";
0423     bookME(ibooker, metME_, histname, histtitle, met_binning_.nbins, met_binning_.xmin, met_binning_.xmax);
0424     setMETitle(metME_, "PF MET [GeV]", "events / [GeV]");
0425 
0426     histname = "metPhi";
0427     histtitle = "PFMET phi";
0428     bookME(ibooker, metPhiME_, histname, histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
0429     setMETitle(metPhiME_, "PF MET #phi", "events / 0.1 rad");
0430 
0431     histname = "met_variable";
0432     histtitle = "PFMET";
0433     bookME(ibooker, metME_variableBinning_, histname, histtitle, met_variable_binning_);
0434     setMETitle(metME_variableBinning_, "PF MET [GeV]", "events / [GeV]");
0435 
0436     histname = "metVsLS";
0437     histtitle = "PFMET vs LS";
0438     bookME(ibooker,
0439            metVsLS_,
0440            histname,
0441            histtitle,
0442            ls_binning_.nbins,
0443            ls_binning_.xmin,
0444            ls_binning_.xmax,
0445            met_binning_.xmin,
0446            met_binning_.xmax);
0447     setMETitle(metVsLS_, "LS", "PF MET [GeV]");
0448   }
0449 
0450   if (njets_ > 0) {
0451     histname = "jetVsLS";
0452     histtitle = "jet pt vs LS";
0453     bookME(ibooker,
0454            jetVsLS_,
0455            histname,
0456            histtitle,
0457            ls_binning_.nbins,
0458            ls_binning_.xmin,
0459            ls_binning_.xmax,
0460            pt_binning_.xmin,
0461            pt_binning_.xmax);
0462     setMETitle(jetVsLS_, "LS", "jet pt [GeV]");
0463 
0464     histname = "jetEtaPhi_HEP17";
0465     histtitle = "jet #eta-#phi for HEP17";
0466     bookME(ibooker, jetEtaPhi_HEP17_, histname, histtitle, 10, -2.5, 2.5, 18, -3.1415, 3.1415);  // for HEP17 monitoring
0467     setMETitle(jetEtaPhi_HEP17_, "jet #eta", "jet #phi");
0468 
0469     histname = "jetMulti";
0470     histtitle = "jet multiplicity";
0471     bookME(ibooker, jetMulti_, histname, histtitle, 11, -.5, 10.5);
0472     setMETitle(jetMulti_, "jet multiplicity", "events");
0473   }
0474 
0475   if (nmuons_ > 0) {
0476     histname = "muVsLS";
0477     histtitle = "muon pt vs LS";
0478     bookME(ibooker,
0479            muVsLS_,
0480            histname,
0481            histtitle,
0482            ls_binning_.nbins,
0483            ls_binning_.xmin,
0484            ls_binning_.xmax,
0485            pt_binning_.xmin,
0486            pt_binning_.xmax);
0487     setMETitle(muVsLS_, "LS", "muon pt [GeV]");
0488 
0489     histname = "muMulti";
0490     histtitle = "muon multiplicity";
0491     bookME(ibooker, muMulti_, histname, histtitle, 6, -.5, 5.5);
0492     setMETitle(muMulti_, "muon multiplicity", "events");
0493 
0494     if (njets_ > 0) {
0495       histname = "DeltaR_jet_Mu";
0496       histtitle = "#DeltaR(jet,mu)";
0497       bookME(ibooker, DeltaR_jet_Mu_, histname, histtitle, DR_binning_.nbins, DR_binning_.xmin, DR_binning_.xmax);
0498       setMETitle(DeltaR_jet_Mu_, "#DeltaR(jet,mu)", "events");
0499     }
0500   }
0501 
0502   if (nelectrons_ > 0) {
0503     histname = "eleVsLS";
0504     histtitle = "electron pt vs LS";
0505     bookME(ibooker,
0506            eleVsLS_,
0507            histname,
0508            histtitle,
0509            ls_binning_.nbins,
0510            ls_binning_.xmin,
0511            ls_binning_.xmax,
0512            pt_binning_.xmin,
0513            pt_binning_.xmax);
0514     setMETitle(eleVsLS_, "LS", "electron pt [GeV]");
0515 
0516     histname = "eleMulti";
0517     histtitle = "electron multiplicity";
0518     bookME(ibooker, eleMulti_, histname, histtitle, 6, -.5, 5.5);
0519     setMETitle(eleMulti_, "electron multiplicity", "events");
0520 
0521     if (njets_ > 0 && enable2DPlots_) {
0522       histname = "elePt_jetPt";
0523       histtitle = "electron pt vs jet pt";
0524       bookME(ibooker, elePt_jetPt_, histname, histtitle, elePt_variable_binning_2D_, jetPt_variable_binning_2D_);
0525       setMETitle(elePt_jetPt_, "leading electron pt", "leading jet pt");
0526     }
0527 
0528     if (nmuons_ > 0 && enable2DPlots_) {
0529       histname = "elePt_muPt";
0530       histtitle = "electron pt vs muon pt";
0531       bookME(ibooker, elePt_muPt_, histname, histtitle, elePt_variable_binning_2D_, muPt_variable_binning_2D_);
0532       setMETitle(elePt_muPt_, "electron pt [GeV]", "muon pt [GeV]");
0533 
0534       histname = "eleEta_muEta";
0535       histtitle = "electron #eta vs muon #eta";
0536       bookME(ibooker, eleEta_muEta_, histname, histtitle, eleEta_variable_binning_2D_, muEta_variable_binning_2D_);
0537       setMETitle(eleEta_muEta_, "electron #eta", "muon #eta");
0538     }
0539   }
0540 
0541   //Menglei
0542   if (enablePhotonPlot_) {
0543     if (nphotons_ > 0) {
0544       histname = "photonVsLS";
0545       histtitle = "photon pt vs LS";
0546       bookME(ibooker,
0547              phoVsLS_,
0548              histname,
0549              histtitle,
0550              ls_binning_.nbins,
0551              ls_binning_.xmin,
0552              ls_binning_.xmax,
0553              pt_binning_.xmin,
0554              pt_binning_.xmax);
0555       setMETitle(phoVsLS_, "LS", "photon pt [GeV]");
0556     }
0557   }
0558 
0559   // Marina
0560   if (nbjets_ > 0) {
0561     histname = "bjetVsLS";
0562     histtitle = "b-jet pt vs LS";
0563     bookME(ibooker,
0564            bjetVsLS_,
0565            histname,
0566            histtitle,
0567            ls_binning_.nbins,
0568            ls_binning_.xmin,
0569            ls_binning_.xmax,
0570            pt_binning_.xmin,
0571            pt_binning_.xmax);
0572     setMETitle(bjetVsLS_, "LS", "b-jet pt [GeV]");
0573 
0574     histname = "bjetMulti";
0575     histtitle = "b-jet multiplicity";
0576     bookME(ibooker, bjetMulti_, histname, histtitle, 6, -.5, 5.5);
0577     setMETitle(bjetMulti_, "b-jet multiplicity", "events");
0578   }
0579 
0580   if (nelectrons_ > 1 && enable2DPlots_) {
0581     histname = "ele1Pt_ele2Pt";
0582     histtitle = "electron-1 pt vs electron-2 pt";
0583     bookME(ibooker, ele1Pt_ele2Pt_, histname, histtitle, elePt_variable_binning_2D_, elePt_variable_binning_2D_);
0584     setMETitle(ele1Pt_ele2Pt_, "electron-1 pt [GeV]", "electron-2 pt [GeV]");
0585 
0586     histname = "ele1Eta_ele2Eta";
0587     histtitle = "electron-1 #eta vs electron-2 #eta";
0588     bookME(ibooker, ele1Eta_ele2Eta_, histname, histtitle, eleEta_variable_binning_2D_, eleEta_variable_binning_2D_);
0589     setMETitle(ele1Eta_ele2Eta_, "electron-1 #eta", "electron-2 #eta");
0590   }
0591 
0592   if (nmuons_ > 1) {
0593     if (enable2DPlots_) {
0594       histname = "mu1Pt_mu2Pt";
0595       histtitle = "muon-1 pt vs muon-2 pt";
0596       bookME(ibooker, mu1Pt_mu2Pt_, histname, histtitle, muPt_variable_binning_2D_, muPt_variable_binning_2D_);
0597       setMETitle(mu1Pt_mu2Pt_, "muon-1 pt [GeV]", "muon-2 pt [GeV]");
0598 
0599       histname = "mu1Eta_mu2Eta";
0600       histtitle = "muon-1 #eta vs muon-2 #eta";
0601       bookME(ibooker, mu1Eta_mu2Eta_, histname, histtitle, muEta_variable_binning_2D_, muEta_variable_binning_2D_);
0602       setMETitle(mu1Eta_mu2Eta_, "muon-1 #eta", "muon-2 #eta");
0603     }
0604     //george
0605     histname = "invMass";
0606     histtitle = "M mu1 mu2";
0607     bookME(ibooker,
0608            invMass_mumu_,
0609            histname,
0610            histtitle,
0611            invMass_mumu_binning_.nbins,
0612            invMass_mumu_binning_.xmin,
0613            invMass_mumu_binning_.xmax);
0614     setMETitle(invMass_mumu_, "M(mu1,mu2) [GeV]", "events");
0615     histname = "invMass_variable";
0616     histtitle = "M mu1 mu2 variable";
0617     bookME(ibooker, invMass_mumu_variableBinning_, histname, histtitle, invMass_mumu_variable_binning_);
0618     setMETitle(invMass_mumu_variableBinning_, "M(mu1,mu2) [GeV]", "events / [GeV]");
0619   }
0620 
0621   if (HTcut_ > 0) {
0622     histname = "htVsLS";
0623     histtitle = "event HT vs LS";
0624     bookME(ibooker,
0625            htVsLS_,
0626            histname,
0627            histtitle,
0628            ls_binning_.nbins,
0629            ls_binning_.xmin,
0630            ls_binning_.xmax,
0631            pt_binning_.xmin,
0632            pt_binning_.xmax);
0633     setMETitle(htVsLS_, "LS", "event HT [GeV]");
0634 
0635     histname = "eventHT";
0636     histtitle = "event HT";
0637     bookME(ibooker, eventHT_variableBinning_, histname, histtitle, HT_variable_binning_);
0638     setMETitle(eventHT_variableBinning_, "event HT [GeV]", "events");
0639 
0640     if (nelectrons_ > 0 && enable2DPlots_) {
0641       histname = "elePt_eventHT";
0642       histtitle = "electron pt vs event HT";
0643       bookME(ibooker, elePt_eventHT_, histname, histtitle, elePt_variable_binning_2D_, HT_variable_binning_2D_);
0644       setMETitle(elePt_eventHT_, "leading electron pt", "event HT");
0645     }
0646   }
0647 
0648   if (MHTcut_ > 0) {
0649     //george
0650     histname = "eventMHT";
0651     histtitle = "event MHT";
0652     bookME(ibooker, eventMHT_, histname, histtitle, MHT_binning_.nbins, MHT_binning_.xmin, MHT_binning_.xmax);
0653     setMETitle(eventMHT_, " event MHT [GeV]", "events");
0654 
0655     histname = "eventMHT_variable";
0656     histtitle = "event MHT variable";
0657     bookME(ibooker, eventMHT_variableBinning_, histname, histtitle, MHT_variable_binning_);
0658     setMETitle(eventMHT_variableBinning_, "event MHT [GeV]", "events / [GeV]");
0659   }
0660 
0661   //Menglei
0662   if (enablePhotonPlot_) {
0663     if ((nmuons_ > 0) && (nphotons_ > 0)) {
0664       histname = "muPt_phoPt", histtitle = "muon pt vs photon pt";
0665       bookME(ibooker, muPt_phoPt_, histname, histtitle, muPt_variable_binning_2D_, phoPt_variable_binning_2D_);
0666       setMETitle(muPt_phoPt_, "muon pt [GeV]", "photon pt [GeV]");
0667 
0668       histname = "muEta_phoEta", histtitle = "muon #eta vs photon #eta";
0669       bookME(ibooker, muEta_phoEta_, histname, histtitle, muEta_variable_binning_2D_, phoEta_variable_binning_2D_);
0670       setMETitle(muEta_phoEta_, "muon #eta", "photon #eta");
0671     }
0672   }
0673 
0674   for (unsigned int iMu = 0; iMu < nmuons_; ++iMu) {
0675     std::string index = std::to_string(iMu + 1);
0676 
0677     histname = "muPt_";
0678     histtitle = "muon p_{T} - ";
0679     histname.append(index);
0680     histtitle.append(index);
0681     bookME(ibooker, muPt_.at(iMu), histname, histtitle, muPt_variable_binning_);
0682     setMETitle(muPt_.at(iMu), "muon p_{T} [GeV]", "events");
0683 
0684     histname = "muEta_";
0685     histtitle = "muon #eta - ";
0686     histname.append(index);
0687     histtitle.append(index);
0688     bookME(ibooker, muEta_.at(iMu), histname, histtitle, muEta_variable_binning_);
0689     setMETitle(muEta_.at(iMu), " muon #eta", "events");
0690 
0691     histname = "muPhi_";
0692     histtitle = "muon #phi - ";
0693     histname.append(index);
0694     histtitle.append(index);
0695     bookME(ibooker, muPhi_.at(iMu), histname, histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
0696     setMETitle(muPhi_.at(iMu), " muon #phi", "events");
0697 
0698     if (enable2DPlots_) {
0699       histname = "muPtEta_";
0700       histtitle = "muon p_{T} - #eta - ";
0701       histname.append(index);
0702       histtitle.append(index);
0703       bookME(ibooker, muPtEta_.at(iMu), histname, histtitle, muPt_variable_binning_2D_, muEta_variable_binning_2D_);
0704       setMETitle(muPtEta_.at(iMu), "muon p_{T} [GeV]", "muon #eta");
0705 
0706       histname = "muEtaPhi_";
0707       histtitle = "muon #eta - #phi - ";
0708       histname.append(index);
0709       histtitle.append(index);
0710       bookME(ibooker, muEtaPhi_.at(iMu), histname, histtitle, muEta_variable_binning_2D_, phi_variable_binning_2D_);
0711       setMETitle(muEtaPhi_.at(iMu), "muon #eta", "muon #phi");
0712     }
0713   }
0714 
0715   for (unsigned int iEle = 0; iEle < nelectrons_; ++iEle) {
0716     std::string index = std::to_string(iEle + 1);
0717 
0718     histname = "elePt_";
0719     histtitle = "electron p_{T} - ";
0720     histname.append(index);
0721     histtitle.append(index);
0722     bookME(ibooker, elePt_.at(iEle), histname, histtitle, elePt_variable_binning_);
0723     setMETitle(elePt_.at(iEle), "electron p_{T} [GeV]", "events");
0724 
0725     histname = "eleEta_";
0726     histtitle = "electron #eta - ";
0727     histname.append(index);
0728     histtitle.append(index);
0729     bookME(ibooker, eleEta_.at(iEle), histname, histtitle, eleEta_variable_binning_);
0730     setMETitle(eleEta_.at(iEle), "electron #eta", "events");
0731 
0732     histname = "elePhi_";
0733     histtitle = "electron #phi - ";
0734     histname.append(index);
0735     histtitle.append(index);
0736     bookME(ibooker, elePhi_.at(iEle), histname, histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
0737     setMETitle(elePhi_.at(iEle), " electron #phi", "events");
0738 
0739     if (enable2DPlots_) {
0740       histname = "elePtEta_";
0741       histtitle = "electron p_{T} - #eta - ";
0742       histname.append(index);
0743       histtitle.append(index);
0744       bookME(ibooker, elePtEta_.at(iEle), histname, histtitle, elePt_variable_binning_2D_, eleEta_variable_binning_2D_);
0745       setMETitle(elePtEta_.at(iEle), "electron p_{T} [GeV]", "electron #eta");
0746 
0747       histname = "eleEtaPhi_";
0748       histtitle = "electron #eta - #phi - ";
0749       histname.append(index);
0750       histtitle.append(index);
0751       bookME(ibooker, eleEtaPhi_.at(iEle), histname, histtitle, eleEta_variable_binning_2D_, phi_variable_binning_2D_);
0752       setMETitle(eleEtaPhi_.at(iEle), "electron #eta", "electron #phi");
0753     }
0754   }
0755 
0756   //Menglei
0757   if (enablePhotonPlot_) {
0758     for (unsigned int iPho(0); iPho < nphotons_; iPho++) {
0759       std::string index = std::to_string(iPho + 1);
0760 
0761       histname = "phoPt_";
0762       histtitle = "photon p_{T} - ";
0763       histname.append(index);
0764       histtitle.append(index);
0765       bookME(ibooker, phoPt_[iPho], histname, histtitle, pt_binning_.nbins, pt_binning_.xmin, pt_binning_.xmax);
0766       setMETitle(phoPt_[iPho], "photon p_{T} [GeV]", "events");
0767 
0768       histname = "phoEta_";
0769       histtitle = "photon #eta - ";
0770       histname.append(index);
0771       histtitle.append(index);
0772       bookME(ibooker, phoEta_[iPho], histname, histtitle, eta_binning_.nbins, eta_binning_.xmin, eta_binning_.xmax);
0773       setMETitle(phoEta_[iPho], "photon #eta", "events");
0774 
0775       histname = "phoPhi_";
0776       histtitle = "photon #phi - ";
0777       histname.append(index);
0778       histtitle.append(index);
0779       bookME(ibooker, phoPhi_[iPho], histname, histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
0780       setMETitle(phoPhi_[iPho], "photon #phi", "events");
0781 
0782       histname = "phoPtEta_";
0783       histtitle = "photon p_{T} - #eta - ";
0784       histname.append(index);
0785       histtitle.append(index);
0786       bookME(ibooker, phoPtEta_[iPho], histname, histtitle, phoPt_variable_binning_2D_, phoEta_variable_binning_2D_);
0787       setMETitle(phoPtEta_[iPho], "photon p_{T} [GeV]", "photon #eta");
0788 
0789       histname = "phoEtaPhi_";
0790       histtitle = "photon #eta - #phi - ";
0791       histname.append(index);
0792       histtitle.append(index);
0793       bookME(ibooker, phoEtaPhi_[iPho], histname, histtitle, phoEta_variable_binning_2D_, phi_variable_binning_2D_);
0794       setMETitle(phoEtaPhi_[iPho], "photon #eta", "photon #phi");
0795     }
0796   }
0797 
0798   for (unsigned int iJet = 0; iJet < njets_; ++iJet) {
0799     std::string index = std::to_string(iJet + 1);
0800 
0801     histname = "jetPt_";
0802     histtitle = "jet p_{T} - ";
0803     histname.append(index);
0804     histtitle.append(index);
0805     bookME(ibooker, jetPt_.at(iJet), histname, histtitle, jetPt_variable_binning_);
0806     setMETitle(jetPt_.at(iJet), "jet p_{T} [GeV]", "events");
0807 
0808     histname = "jetEta_";
0809     histtitle = "jet #eta - ";
0810     histname.append(index);
0811     histtitle.append(index);
0812     bookME(ibooker, jetEta_.at(iJet), histname, histtitle, jetEta_variable_binning_);
0813     setMETitle(jetEta_.at(iJet), "jet #eta", "events");
0814 
0815     histname = "jetPhi_";
0816     histtitle = "jet #phi - ";
0817     histname.append(index);
0818     histtitle.append(index);
0819     bookME(ibooker, jetPhi_.at(iJet), histname, histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
0820     setMETitle(jetPhi_.at(iJet), "jet #phi", "events");
0821 
0822     if (enable2DPlots_) {
0823       histname = "jetPtEta_";
0824       histtitle = "jet p_{T} - #eta - ";
0825       histname.append(index);
0826       histtitle.append(index);
0827       bookME(ibooker, jetPtEta_.at(iJet), histname, histtitle, jetPt_variable_binning_2D_, jetEta_variable_binning_2D_);
0828       setMETitle(jetPtEta_.at(iJet), "jet p_{T} [GeV]", "jet #eta");
0829 
0830       histname = "jetEtaPhi_";
0831       histtitle = "jet #eta - #phi - ";
0832       histname.append(index);
0833       histtitle.append(index);
0834       bookME(ibooker, jetEtaPhi_.at(iJet), histname, histtitle, jetEta_variable_binning_2D_, phi_variable_binning_2D_);
0835       setMETitle(jetEtaPhi_.at(iJet), "jet #eta", "jet #phi");
0836     }
0837   }
0838 
0839   // Marina
0840   for (unsigned int iBJet = 0; iBJet < nbjets_; ++iBJet) {
0841     std::string index = std::to_string(iBJet + 1);
0842 
0843     histname = "bjetPt_";
0844     histtitle = "b-jet p_{T} - ";
0845     histname.append(index);
0846     histtitle.append(index);
0847     bookME(ibooker, bjetPt_.at(iBJet), histname, histtitle, jetPt_variable_binning_);
0848     setMETitle(bjetPt_.at(iBJet), "b-jet p_{T} [GeV]", "events");
0849 
0850     histname = "bjetEta_";
0851     histtitle = "b-jet #eta - ";
0852     histname.append(index);
0853     histtitle.append(index);
0854     bookME(ibooker, bjetEta_.at(iBJet), histname, histtitle, jetEta_variable_binning_);
0855     setMETitle(bjetEta_.at(iBJet), "b-jet #eta", "events");
0856 
0857     histname = "bjetPhi_";
0858     histtitle = "b-jet #phi - ";
0859     histname.append(index);
0860     histtitle.append(index);
0861     bookME(ibooker, bjetPhi_.at(iBJet), histname, histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
0862     setMETitle(bjetPhi_.at(iBJet), "b-jet #phi", "events");
0863 
0864     histname = "bjetDeepFlav_";
0865     histtitle = "b-jet DeepFlavour - ";
0866     histname.append(index);
0867     histtitle.append(index);
0868     bookME(
0869         ibooker, bjetDeepFlav_.at(iBJet), histname, histtitle, csv_binning_.nbins, csv_binning_.xmin, csv_binning_.xmax);
0870     setMETitle(bjetDeepFlav_.at(iBJet), "b-jet Deep Flavour", "events");
0871 
0872     histname = "bjetPNet_";
0873     histtitle = "b-jet ParticleNet - ";
0874     histname.append(index);
0875     histtitle.append(index);
0876     bookME(ibooker, bjetPNet_.at(iBJet), histname, histtitle, csv_binning_.nbins, csv_binning_.xmin, csv_binning_.xmax);
0877     setMETitle(bjetPNet_.at(iBJet), "b-jet ParticleNet", "events");
0878 
0879     histname = "bjetUParT_";
0880     histtitle = "b-jet UParT - ";
0881     histname.append(index);
0882     histtitle.append(index);
0883     bookME(
0884         ibooker, bjetUParT_.at(iBJet), histname, histtitle, csv_binning_.nbins, csv_binning_.xmin, csv_binning_.xmax);
0885     setMETitle(bjetUParT_.at(iBJet), "b-jet UParT", "events");
0886 
0887     if (enable2DPlots_) {
0888       histname = "bjetPtEta_";
0889       histtitle = "b-jet p_{T} - #eta - ";
0890       histname.append(index);
0891       histtitle.append(index);
0892       bookME(
0893           ibooker, bjetPtEta_.at(iBJet), histname, histtitle, jetPt_variable_binning_2D_, jetEta_variable_binning_2D_);
0894       setMETitle(bjetPtEta_.at(iBJet), "b-jet p_{T} [GeV]", "b-jet #eta");
0895 
0896       histname = "bjetEtaPhi_";
0897       histtitle = "b-jet #eta - #phi - ";
0898       histname.append(index);
0899       histtitle.append(index);
0900       bookME(
0901           ibooker, bjetEtaPhi_.at(iBJet), histname, histtitle, jetEta_variable_binning_2D_, phi_variable_binning_2D_);
0902       setMETitle(bjetEtaPhi_.at(iBJet), "b-jet #eta", "b-jet #phi");
0903     }
0904 
0905     histname = "bjetDeepFlavHT_";
0906     histtitle = "HT - b-jet DeepFlavour - ";
0907     histname.append(index);
0908     histtitle.append(index);
0909     bookME(ibooker,
0910            bjetDeepFlavHT_.at(iBJet),
0911            histname,
0912            histtitle,
0913            csv_binning_.nbins,
0914            csv_binning_.xmin,
0915            csv_binning_.xmax,
0916            HT_binning_.nbins,
0917            HT_binning_.xmin,
0918            HT_binning_.xmax);
0919     setMETitle(bjetDeepFlavHT_.at(iBJet), "b-jet DeepFlavour", "event HT [GeV]");
0920 
0921     histname = "bjetPNetHT_";
0922     histtitle = "HT - b-jet ParticleNet - ";
0923     histname.append(index);
0924     histtitle.append(index);
0925     bookME(ibooker,
0926            bjetPNetHT_.at(iBJet),
0927            histname,
0928            histtitle,
0929            csv_binning_.nbins,
0930            csv_binning_.xmin,
0931            csv_binning_.xmax,
0932            HT_binning_.nbins,
0933            HT_binning_.xmin,
0934            HT_binning_.xmax);
0935     setMETitle(bjetPNetHT_.at(iBJet), "b-jet ParticleNet", "event HT [GeV]");
0936 
0937     histname = "bjetUParTHT_";
0938     histtitle = "HT - b-jet UParT - ";
0939     histname.append(index);
0940     histtitle.append(index);
0941     bookME(ibooker,
0942            bjetUParTHT_.at(iBJet),
0943            histname,
0944            histtitle,
0945            csv_binning_.nbins,
0946            csv_binning_.xmin,
0947            csv_binning_.xmax,
0948            HT_binning_.nbins,
0949            HT_binning_.xmin,
0950            HT_binning_.xmax);
0951     setMETitle(bjetUParTHT_.at(iBJet), "b-jet UParT", "event HT [GeV]");
0952   }
0953 }
0954 
0955 void BTVMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) {
0956   // if valid HLT paths are required,
0957   // analyze event only if all paths are valid
0958   if (requireValidHLTPaths_ and (not hltPathsAreValid_)) {
0959     return;
0960   }
0961 
0962   // Filter out events if Trigger Filtering is requested
0963   if (den_genTriggerEventFlag_->on() && !den_genTriggerEventFlag_->accept(iEvent, iSetup)) {
0964     return;
0965   }
0966 
0967   edm::Handle<reco::VertexCollection> primaryVertices;
0968   iEvent.getByToken(vtxToken_, primaryVertices);
0969   //Primary Vertex selection
0970   const reco::Vertex* pv = nullptr;
0971   for (auto const& v : *primaryVertices) {
0972     if (!vtxSelection_(v)) {
0973       continue;
0974     }
0975     pv = &v;
0976     break;
0977   }
0978   if (applyLeptonPVcuts_ && (pv == nullptr)) {
0979     edm::LogWarning("BTVMonitor") << "Invalid handle to reco::VertexCollection, event will be skipped";
0980     return;
0981   }
0982 
0983   edm::Handle<pat::METCollection> metHandle;
0984   iEvent.getByToken(metToken_, metHandle);
0985   if ((not metHandle.isValid()) && enableMETPlot_) {
0986     edm::LogWarning("BTVMonitor") << "MET handle not valid \n";
0987     return;
0988   }
0989 
0990   double met_pt(-99.);
0991   double met_phi(-99.);
0992 
0993   if (enableMETPlot_) {
0994     const pat::MET& pfmet = metHandle->front();
0995 
0996     if (!metSelection_(pfmet)) {
0997       return;
0998     }
0999 
1000     met_pt = pfmet.pt();
1001     met_phi = pfmet.phi();
1002   }
1003 
1004   edm::Handle<edm::View<pat::Electron>> eleHandle;
1005   iEvent.getByToken(eleToken_, eleHandle);
1006   if (!eleHandle.isValid() && nelectrons_ > 0) {
1007     edm::LogWarning("BTVMonitor") << "Electron handle not valid \n";
1008     return;
1009   }
1010 
1011   edm::Handle<edm::ValueMap<bool>> eleIDHandle;
1012   iEvent.getByToken(elecIDToken_, eleIDHandle);
1013   if (!eleIDHandle.isValid() && nelectrons_ > 0) {
1014     edm::LogWarning("BTVMonitor") << "Electron ID handle not valid \n";
1015     return;
1016   }
1017 
1018   std::vector<pat::Electron> electrons;
1019   if (nelectrons_ > 0) {
1020     if (eleHandle->size() < nelectrons_) {
1021       return;
1022     }
1023 
1024     for (size_t index = 0; index < eleHandle->size(); index++) {
1025       const auto e = eleHandle->at(index);
1026       const auto el = eleHandle->ptrAt(index);
1027 
1028       bool pass_id = (*eleIDHandle)[el];
1029 
1030       if (eleSelection_(e) && pass_id) {
1031         electrons.push_back(e);
1032       }
1033 
1034       if (applyLeptonPVcuts_ && ((std::fabs(e.gsfTrack()->dxy(pv->position())) >= lepPVcuts_.dxy) ||
1035                                  (std::fabs(e.gsfTrack()->dz(pv->position())) >= lepPVcuts_.dz))) {
1036         continue;
1037       }
1038     }
1039 
1040     if (electrons.size() < nelectrons_) {
1041       return;
1042     }
1043   }
1044 
1045   edm::Handle<edm::View<pat::Muon>> muoHandle;
1046   iEvent.getByToken(muoToken_, muoHandle);
1047 
1048   std::vector<pat::Muon> muons;
1049   if (nmuons_ > 0) {
1050     if (!muoHandle.isValid()) {
1051       edm::LogWarning("BTVMonitor") << "Muon handle not valid \n";
1052       return;
1053     }
1054 
1055     if (muoHandle->size() < nmuons_) {
1056       return;
1057     }
1058 
1059     for (auto const& m : *muoHandle) {
1060       if (muoSelection_(m)) {
1061         muons.push_back(m);
1062       }
1063 
1064       if (applyLeptonPVcuts_ && ((std::fabs(m.muonBestTrack()->dxy(pv->position())) >= lepPVcuts_.dxy) ||
1065                                  (std::fabs(m.muonBestTrack()->dz(pv->position())) >= lepPVcuts_.dz))) {
1066         continue;
1067       }
1068     }
1069 
1070     if (muons.size() < nmuons_) {
1071       return;
1072     }
1073   }
1074 
1075   double mll(-2);
1076   if (nmuons_ > 1) {
1077     mll = (muons[0].p4() + muons[1].p4()).M();
1078 
1079     if ((invMassUppercut_ > -1) && (invMassLowercut_ > -1) && ((mll > invMassUppercut_) || (mll < invMassLowercut_))) {
1080       return;
1081     }
1082     if (opsign_ && (muons[0].charge() == muons[1].charge())) {
1083       return;
1084     }
1085   }
1086 
1087   edm::Handle<pat::PhotonCollection> phoHandle;
1088   iEvent.getByToken(phoToken_, phoHandle);
1089   if (!phoHandle.isValid()) {
1090     edm::LogWarning("BTVMonitor") << "Photon handle not valid \n";
1091     return;
1092   }
1093   if (phoHandle->size() < nphotons_) {
1094     return;
1095   }
1096 
1097   std::vector<pat::Photon> photons;
1098   for (auto const& p : *phoHandle) {
1099     if (phoSelection_(p)) {
1100       photons.push_back(p);
1101     }
1102   }
1103   if (photons.size() < nphotons_) {
1104     return;
1105   }
1106 
1107   double eventHT(0.);
1108   math::XYZTLorentzVector eventMHT(0., 0., 0., 0.);
1109 
1110   edm::Handle<edm::View<pat::Jet>> jetHandle;
1111   iEvent.getByToken(jetToken_, jetHandle);
1112   if (!jetHandle.isValid() && njets_ > 0) {
1113     edm::LogWarning("BTVMonitor") << "Jet handle not valid \n";
1114     return;
1115   }
1116   std::vector<pat::Jet> jets;
1117   if (njets_ > 0) {
1118     if (jetHandle->size() < njets_)
1119       return;
1120     for (auto const& j : *jetHandle) {
1121       if (HTdefinition_(j)) {
1122         eventHT += j.pt();
1123       }
1124       if (MHTdefinition_(j)) {
1125         eventMHT += j.p4();
1126       }
1127       if (jetSelection_(j)) {
1128         bool isJetOverlappedWithLepton = false;
1129         if (nmuons_ > 0) {
1130           for (auto const& m : muons) {
1131             if (deltaR(j, m) < leptJetDeltaRmin_) {
1132               isJetOverlappedWithLepton = true;
1133               break;
1134             }
1135           }
1136         }
1137         if (isJetOverlappedWithLepton)
1138           continue;
1139         if (nelectrons_ > 0) {
1140           for (auto const& e : electrons) {
1141             if (deltaR(j, e) < leptJetDeltaRmin_) {
1142               isJetOverlappedWithLepton = true;
1143               break;
1144             }
1145           }
1146         }
1147         if (isJetOverlappedWithLepton)
1148           continue;
1149         jets.push_back(j);
1150       }
1151     }
1152     if (jets.size() < njets_)
1153       return;
1154   }
1155 
1156   if (eventHT < HTcut_) {
1157     return;
1158   }
1159 
1160   if ((MHTcut_ > 0) && (eventMHT.pt() < MHTcut_)) {
1161     return;
1162   }
1163 
1164   bool allpairs = false;
1165   if (nmuons_ > 2) {
1166     double mumu_mass;
1167     for (unsigned int idx = 0; idx < muons.size(); idx++) {
1168       for (unsigned int idx2 = idx + 1; idx2 < muons.size(); idx2++) {
1169         //compute inv mass of two different leptons
1170         mumu_mass = (muons[idx2].p4() + muons[idx2].p4()).M();
1171         if (mumu_mass < invMassLowercut_ || mumu_mass > invMassUppercut_)
1172           allpairs = true;
1173       }
1174     }
1175   }
1176   //cut only if enabled and the event has a pair that failed the mll range
1177   if (allpairs && invMassCutInAllMuPairs_) {
1178     return;
1179   }
1180 
1181   JetBTagMap bjets;
1182 
1183   if (nbjets_ > 0) {
1184     edm::Handle<edm::View<pat::Jet>> bjetHandle;
1185     iEvent.getByToken(jetToken_, bjetHandle);
1186     if (!bjetHandle.isValid()) {
1187       edm::LogWarning("BTVMonitor") << "B-Jet handle not valid, skipping event\n";
1188       return;
1189     }
1190 
1191     for (size_t i = 0; i < bjetHandle->size(); ++i) {
1192       const auto& bJet = (*bjetHandle)[i];
1193 
1194       if (!bjetSelection_(bJet)) {
1195         continue;
1196       }
1197       edm::RefToBase<pat::Jet> jetRef(bjetHandle, i);
1198       float deepFlavScore = 0.f;
1199       float pNetScore = 0.f;
1200       float UParTScore = 0.f;
1201       bool haveDeepFlav = false;
1202       bool havePNet = false;
1203       bool haveUParT = false;
1204 
1205       for (auto const& algoName : btagAlgos_) {  // loop over all specified b-tagging algorithms
1206         float disc = bJet.bDiscriminator(algoName);
1207         if (!std::isfinite(disc)) {
1208           continue;
1209         }
1210         if (algoName.find("DeepFlavour") != std::string::npos) {
1211           deepFlavScore += disc;  // Sum three deepFlavour scores
1212           haveDeepFlav = true;
1213         }
1214         if (algoName.find("ParticleNet") != std::string::npos) {
1215           pNetScore = disc;
1216           havePNet = true;
1217         }
1218         if (algoName.find("ParticleTransformer") != std::string::npos) {
1219           UParTScore = disc;
1220           haveUParT = true;
1221         }
1222       }
1223 
1224       BTagScores scores;
1225       scores["deepFlav"] = haveDeepFlav ? deepFlavScore : std::numeric_limits<float>::quiet_NaN();
1226       scores["PNet"] = havePNet ? pNetScore : std::numeric_limits<float>::quiet_NaN();
1227       scores["UParT"] = haveUParT ? UParTScore : std::numeric_limits<float>::quiet_NaN();
1228       bjets.insert(std::make_pair(jetRef, scores));
1229 
1230       if (bjets.size() < nbjets_) {
1231         return;
1232       }
1233     }
1234   }
1235   if (nbjets_ > 1) {
1236     double deltaEta = std::abs(bjets.begin()->first->eta() - (++bjets.begin())->first->eta());
1237     if (deltaEta > bJetDeltaEtaMax_)
1238       return;
1239   }
1240 
1241   if ((nbjets_ > 0) && (nmuons_ > 0)) {
1242     bool foundMuonInsideJet = false;
1243     for (auto const& bjet : bjets) {
1244       for (auto const& mu : muons) {
1245         double dR = deltaR(*bjet.first, mu);
1246         if (dR < bJetMuDeltaRmax_) {
1247           foundMuonInsideJet = true;
1248           break;
1249         }
1250       }
1251       if (foundMuonInsideJet)
1252         break;
1253     }
1254 
1255     if (!foundMuonInsideJet)
1256       return;
1257   }
1258 
1259   const int ls = iEvent.id().luminosityBlock();
1260 
1261   // numerator condition
1262   const bool trg_passed = (num_genTriggerEventFlag_->on() && num_genTriggerEventFlag_->accept(iEvent, iSetup));
1263 
1264   if (enableMETPlot_) {
1265     metME_.fill(trg_passed, met_pt);
1266     metME_variableBinning_.fill(trg_passed, met_pt);
1267     metPhiME_.fill(trg_passed, met_phi);
1268     metVsLS_.fill(trg_passed, ls, met_pt);
1269   }
1270   if (HTcut_ > 0) {
1271     eventHT_.fill(trg_passed, eventHT);
1272     eventHT_variableBinning_.fill(trg_passed, eventHT);
1273     htVsLS_.fill(trg_passed, ls, eventHT);
1274   }
1275   //george
1276   if (MHTcut_ > 0) {
1277     eventMHT_.fill(trg_passed, eventMHT.pt());
1278     eventMHT_variableBinning_.fill(trg_passed, eventMHT.pt());
1279   }
1280 
1281   if (njets_ > 0) {
1282     jetMulti_.fill(trg_passed, jets.size());
1283     jetEtaPhi_HEP17_.fill(trg_passed, jets.at(0).eta(), jets.at(0).phi());  // for HEP17 monitorning
1284     jetVsLS_.fill(trg_passed, ls, jets.at(0).pt());
1285   }
1286 
1287   if (enablePhotonPlot_) {
1288     phoMulti_.fill(trg_passed, photons.size());
1289   }
1290 
1291   // Marina
1292   if (nbjets_ > 0) {
1293     bjetMulti_.fill(trg_passed, bjets.size());
1294     bjetVsLS_.fill(trg_passed, ls, bjets.begin()->first->pt());
1295   }
1296 
1297   if (nmuons_ > 0) {
1298     muMulti_.fill(trg_passed, muons.size());
1299     muVsLS_.fill(trg_passed, ls, muons.at(0).pt());
1300     if (nmuons_ > 1) {
1301       mu1Pt_mu2Pt_.fill(trg_passed, muons.at(0).pt(), muons.at(1).pt());
1302       mu1Eta_mu2Eta_.fill(trg_passed, muons.at(0).eta(), muons.at(1).eta());
1303       invMass_mumu_.fill(trg_passed, mll);
1304       invMass_mumu_variableBinning_.fill(trg_passed, mll);
1305     }
1306     if (njets_ > 0) {
1307       DeltaR_jet_Mu_.fill(trg_passed, deltaR(jets.at(0), muons.at(0)));
1308     }
1309   }
1310 
1311   if (nelectrons_ > 0) {
1312     eleMulti_.fill(trg_passed, electrons.size());
1313     eleVsLS_.fill(trg_passed, ls, electrons.at(0).pt());
1314     if (HTcut_ > 0)
1315       elePt_eventHT_.fill(trg_passed, electrons.at(0).pt(), eventHT);
1316     if (njets_ > 0)
1317       elePt_jetPt_.fill(trg_passed, electrons.at(0).pt(), jets.at(0).pt());
1318     if (nmuons_ > 0) {
1319       elePt_muPt_.fill(trg_passed, electrons.at(0).pt(), muons.at(0).pt());
1320       eleEta_muEta_.fill(trg_passed, electrons.at(0).eta(), muons.at(0).eta());
1321     }
1322     if (nelectrons_ > 1) {
1323       ele1Pt_ele2Pt_.fill(trg_passed, electrons.at(0).pt(), electrons.at(1).pt());
1324       ele1Eta_ele2Eta_.fill(trg_passed, electrons.at(0).eta(), electrons.at(1).eta());
1325     }
1326   }
1327 
1328   if (enablePhotonPlot_) {
1329     if (nphotons_ > 0) {
1330       phoVsLS_.fill(trg_passed, ls, photons.at(0).pt());
1331       if (nmuons_ > 0) {
1332         muPt_phoPt_.fill(trg_passed, muons.at(0).pt(), photons.at(0).pt());
1333         muEta_phoEta_.fill(trg_passed, muons.at(0).eta(), photons.at(0).eta());
1334       }
1335     }
1336   }
1337 
1338   for (unsigned int iMu = 0; iMu < muons.size(); ++iMu) {
1339     if (iMu >= nmuons_)
1340       break;
1341     muPhi_.at(iMu).fill(trg_passed, muons.at(iMu).phi());
1342     muEta_.at(iMu).fill(trg_passed, muons.at(iMu).eta());
1343     muPt_.at(iMu).fill(trg_passed, muons.at(iMu).pt());
1344     muPtEta_.at(iMu).fill(trg_passed, muons.at(iMu).pt(), muons.at(iMu).eta());
1345     muEtaPhi_.at(iMu).fill(trg_passed, muons.at(iMu).eta(), muons.at(iMu).phi());
1346   }
1347   for (unsigned int iEle = 0; iEle < electrons.size(); ++iEle) {
1348     if (iEle >= nelectrons_)
1349       break;
1350     elePhi_.at(iEle).fill(trg_passed, electrons.at(iEle).phi());
1351     eleEta_.at(iEle).fill(trg_passed, electrons.at(iEle).eta());
1352     elePt_.at(iEle).fill(trg_passed, electrons.at(iEle).pt());
1353     elePtEta_.at(iEle).fill(trg_passed, electrons.at(iEle).pt(), electrons.at(iEle).eta());
1354     eleEtaPhi_.at(iEle).fill(trg_passed, electrons.at(iEle).eta(), electrons.at(iEle).phi());
1355   }
1356   //Menglei
1357   if (enablePhotonPlot_) {
1358     for (unsigned int iPho = 0; iPho < photons.size(); ++iPho) {
1359       if (iPho >= nphotons_)
1360         break;
1361       phoPhi_[iPho].fill(trg_passed, photons[iPho].phi());
1362       phoEta_[iPho].fill(trg_passed, photons[iPho].eta());
1363       phoPt_[iPho].fill(trg_passed, photons[iPho].pt());
1364       phoPtEta_[iPho].fill(trg_passed, photons[iPho].pt(), photons[iPho].eta());
1365       phoEtaPhi_[iPho].fill(trg_passed, photons[iPho].eta(), photons[iPho].phi());
1366     }
1367   }
1368 
1369   for (unsigned int iJet = 0; iJet < jets.size(); ++iJet) {
1370     if (iJet >= njets_)
1371       break;
1372     jetPhi_.at(iJet).fill(trg_passed, jets.at(iJet).phi());
1373     jetEta_.at(iJet).fill(trg_passed, jets.at(iJet).eta());
1374     jetPt_.at(iJet).fill(trg_passed, jets.at(iJet).pt());
1375     jetPtEta_.at(iJet).fill(trg_passed, jets.at(iJet).pt(), jets.at(iJet).eta());
1376     jetEtaPhi_.at(iJet).fill(trg_passed, jets.at(iJet).eta(), jets.at(iJet).phi());
1377   }
1378 
1379   // Marina
1380   unsigned int iBJet = 0;
1381   for (auto& bjet : bjets) {
1382     if (iBJet >= nbjets_)
1383       break;
1384     const BTagScores& scores = bjet.second;
1385 
1386     bjetPhi_.at(iBJet).fill(trg_passed, bjet.first->phi());
1387     bjetEta_.at(iBJet).fill(trg_passed, bjet.first->eta());
1388     bjetPt_.at(iBJet).fill(trg_passed, bjet.first->pt());
1389     bjetDeepFlav_.at(iBJet).fill(trg_passed, scores.at("deepFlav"));
1390     bjetPNet_.at(iBJet).fill(trg_passed, scores.at("PNet"));
1391     bjetUParT_.at(iBJet).fill(trg_passed, scores.at("UParT"));
1392     bjetPtEta_.at(iBJet).fill(trg_passed, bjet.first->pt(), bjet.first->eta());
1393     bjetEtaPhi_.at(iBJet).fill(trg_passed, bjet.first->eta(), bjet.first->phi());
1394     bjetDeepFlavHT_.at(iBJet).fill(trg_passed, scores.at("deepFlav"), eventHT);
1395     bjetPNetHT_.at(iBJet).fill(trg_passed, scores.at("PNet"), eventHT);
1396     bjetUParTHT_.at(iBJet).fill(trg_passed, scores.at("UParT"), eventHT);
1397 
1398     iBJet++;
1399   }
1400 }
1401 
1402 void BTVMonitor::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
1403   edm::ParameterSetDescription desc;
1404   desc.add<std::string>("FolderName", "HLT/BTV/default");
1405 
1406   desc.add<bool>("requireValidHLTPaths", true);
1407 
1408   desc.add<edm::InputTag>("vertices", edm::InputTag("offlinePrimaryVertices"));
1409   desc.add<edm::InputTag>("muons", edm::InputTag("slimmedMuons"));
1410   desc.add<edm::InputTag>("electrons", edm::InputTag("slimmedElectrons"));
1411   desc.add<edm::InputTag>("elecID",
1412                           edm::InputTag("egmGsfElectronIDsForDQM:cutBasedElectronID-RunIIIWinter22-V1-tight"));
1413   desc.add<edm::InputTag>("photons", edm::InputTag("slimmedPhotons"));
1414   desc.add<edm::InputTag>("jets", edm::InputTag("slimmedJetsPuppi"));
1415   desc.add<edm::InputTag>("met", edm::InputTag("slimmedMETs"));
1416   desc.add<std::vector<std::string>>("btagAlgos",
1417                                      {"pfDeepFlavourJetTags:probb",
1418                                       "pfDeepFlavourJetTags:probbb",
1419                                       "pfDeepFlavourJetTags:problepb",
1420                                       "pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:BvsAll",
1421                                       "pfUnifiedParticleTransformerAK4DiscriminatorsJetTags:BvsAll"});
1422 
1423   desc.add<std::string>("metSelection", "pt > 0");
1424   desc.add<std::string>("jetSelection", "pt > 0");
1425   desc.add<std::string>("eleSelection", "pt > 0");
1426   desc.add<std::string>("muoSelection", "pt > 0");
1427   desc.add<std::string>("phoSelection", "pt > 0");
1428   desc.add<std::string>("HTdefinition", "pt > 0 & abs(eta)<2.5");
1429   desc.add<std::string>("vertexSelection", "!isFake");
1430   desc.add<std::string>("bjetSelection", "pt > 30 & abs(eta)<2.4");
1431   desc.add<unsigned int>("njets", 0);
1432   desc.add<unsigned int>("nelectrons", 0);
1433   desc.add<unsigned int>("nmuons", 0);
1434   desc.add<unsigned int>("nphotons", 0);
1435   desc.add<double>("leptJetDeltaRmin", 0);
1436   desc.add<double>("bJetMuDeltaRmax", 9999.);
1437   desc.add<double>("bJetDeltaEtaMax", 9999.);
1438   desc.add<double>("HTcut", 0);
1439 
1440   desc.add<unsigned int>("nbjets", 1);
1441   desc.add<double>("workingpoint", -1);  // no cut applied
1442   desc.add<bool>("applyLeptonPVcuts", false);
1443   desc.add<double>("invMassUppercut", -1.0);
1444   desc.add<double>("invMassLowercut", -1.0);
1445   desc.add<bool>("oppositeSignMuons", false);
1446   desc.add<std::string>("MHTdefinition", "pt > 0");
1447   desc.add<double>("MHTcut", -1);
1448   desc.add<bool>("invMassCutInAllMuPairs", false);
1449   desc.add<bool>("enablePhotonPlot", false);
1450   desc.add<bool>("enableMETPlot", false);
1451   desc.add<bool>("enable2DPlots", true);
1452 
1453   edm::ParameterSetDescription genericTriggerEventPSet;
1454   GenericTriggerEventFlag::fillPSetDescription(genericTriggerEventPSet);
1455   desc.add<edm::ParameterSetDescription>("numGenericTriggerEventPSet", genericTriggerEventPSet);
1456   desc.add<edm::ParameterSetDescription>("denGenericTriggerEventPSet", genericTriggerEventPSet);
1457 
1458   edm::ParameterSetDescription histoPSet;
1459   edm::ParameterSetDescription metPSet;
1460   edm::ParameterSetDescription phiPSet;
1461   edm::ParameterSetDescription etaPSet;
1462   edm::ParameterSetDescription ptPSet;
1463   edm::ParameterSetDescription htPSet;
1464   edm::ParameterSetDescription DRPSet;
1465   edm::ParameterSetDescription csvPSet;
1466   edm::ParameterSetDescription invMassPSet;
1467   edm::ParameterSetDescription MHTPSet;
1468   fillHistoPSetDescription(metPSet);
1469   fillHistoPSetDescription(phiPSet);
1470   fillHistoPSetDescription(ptPSet);
1471   fillHistoPSetDescription(etaPSet);
1472   fillHistoPSetDescription(htPSet);
1473   fillHistoPSetDescription(DRPSet);
1474   fillHistoPSetDescription(csvPSet);
1475   fillHistoPSetDescription(MHTPSet);
1476   fillHistoPSetDescription(invMassPSet);
1477   histoPSet.add<edm::ParameterSetDescription>("metPSet", metPSet);
1478   histoPSet.add<edm::ParameterSetDescription>("etaPSet", etaPSet);
1479   histoPSet.add<edm::ParameterSetDescription>("phiPSet", phiPSet);
1480   histoPSet.add<edm::ParameterSetDescription>("ptPSet", ptPSet);
1481   histoPSet.add<edm::ParameterSetDescription>("htPSet", htPSet);
1482   histoPSet.add<edm::ParameterSetDescription>("DRPSet", DRPSet);
1483   histoPSet.add<edm::ParameterSetDescription>("csvPSet", csvPSet);
1484   histoPSet.add<edm::ParameterSetDescription>("invMassPSet", invMassPSet);
1485   histoPSet.add<edm::ParameterSetDescription>("MHTPSet", MHTPSet);
1486 
1487   std::vector<double> bins = {0.,   20.,  40.,  60.,  80.,  90.,  100., 110., 120., 130., 140., 150., 160.,
1488                               170., 180., 190., 200., 220., 240., 260., 280., 300., 350., 400., 450., 1000.};
1489   std::vector<double> eta_bins = {-3., -2.5, -2., -1.5, -1., -.5, 0., .5, 1., 1.5, 2., 2.5, 3.};
1490   histoPSet.add<std::vector<double>>("metBinning", bins);
1491   histoPSet.add<std::vector<double>>("HTBinning", bins);
1492   histoPSet.add<std::vector<double>>("jetPtBinning", bins);
1493   histoPSet.add<std::vector<double>>("elePtBinning", bins);
1494   histoPSet.add<std::vector<double>>("muPtBinning", bins);
1495   histoPSet.add<std::vector<double>>("jetEtaBinning", eta_bins);
1496   histoPSet.add<std::vector<double>>("eleEtaBinning", eta_bins);
1497   histoPSet.add<std::vector<double>>("muEtaBinning", eta_bins);
1498   histoPSet.add<std::vector<double>>("invMassVariableBinning", bins);
1499   histoPSet.add<std::vector<double>>("MHTVariableBinning", bins);
1500 
1501   std::vector<double> bins_2D = {0., 40., 80., 100., 120., 140., 160., 180., 200., 240., 280., 350., 450., 1000.};
1502   std::vector<double> eta_bins_2D = {-3., -2., -1., 0., 1., 2., 3.};
1503   std::vector<double> phi_bins_2D = {
1504       -3.1415, -2.5132, -1.8849, -1.2566, -0.6283, 0, 0.6283, 1.2566, 1.8849, 2.5132, 3.1415};
1505   histoPSet.add<std::vector<double>>("HTBinning2D", bins_2D);
1506   histoPSet.add<std::vector<double>>("jetPtBinning2D", bins_2D);
1507   histoPSet.add<std::vector<double>>("elePtBinning2D", bins_2D);
1508   histoPSet.add<std::vector<double>>("muPtBinning2D", bins_2D);
1509   histoPSet.add<std::vector<double>>("phoPtBinning2D", bins_2D);
1510   histoPSet.add<std::vector<double>>("jetEtaBinning2D", eta_bins_2D);
1511   histoPSet.add<std::vector<double>>("eleEtaBinning2D", eta_bins_2D);
1512   histoPSet.add<std::vector<double>>("muEtaBinning2D", eta_bins_2D);
1513   histoPSet.add<std::vector<double>>("phoEtaBinning2D", eta_bins_2D);
1514   histoPSet.add<std::vector<double>>("phiBinning2D", phi_bins_2D);
1515 
1516   edm::ParameterSetDescription lsPSet;
1517   fillHistoLSPSetDescription(lsPSet);
1518   histoPSet.add<edm::ParameterSetDescription>("lsPSet", lsPSet);
1519 
1520   desc.add<edm::ParameterSetDescription>("histoPSet", histoPSet);
1521 
1522   edm::ParameterSetDescription lPVcutPSet;
1523   lPVcutPSet.add<double>("dxy", 9999.);
1524   lPVcutPSet.add<double>("dz", 9999.);
1525   desc.add<edm::ParameterSetDescription>("leptonPVcuts", lPVcutPSet);
1526 
1527   descriptions.add("BTVMonitoring", desc);
1528 }
1529 
1530 // Define this as a plug-in
1531 DEFINE_FWK_MODULE(BTVMonitor);