Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-03 02:23:42

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