Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-30 02:32:58

0001 //#include <algorithm>
0002 #include "JetMETCorrections/Objects/interface/JetCorrectionsRecord.h"
0003 #include "DataFormats/JetReco/interface/CaloJet.h"
0004 #include "DataFormats/BTauReco/interface/JetTag.h"
0005 #include "DQM/Physics/src/TopDiLeptonOfflineDQM.h"
0006 
0007 #include <memory>
0008 
0009 #include "DQM/Physics/interface/TopDQMHelpers.h"
0010 #include "DataFormats/JetReco/interface/PFJet.h"
0011 #include "FWCore/Framework/interface/ConsumesCollector.h"
0012 #include "FWCore/Framework/interface/EDConsumerBase.h"
0013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0014 #include "FWCore/Utilities/interface/EDGetToken.h"
0015 
0016 namespace TopDiLeptonOffline {
0017 
0018   MonitorEnsemble::MonitorEnsemble(const char* label, const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC)
0019       : label_(label),
0020         eidCutValue_(0.),
0021         elecIso_(nullptr),
0022         elecSelect_(nullptr),
0023         muonIso_(nullptr),
0024         muonSelect_(nullptr),
0025         jetIDSelect_(nullptr),
0026         lowerEdge_(-1.),
0027         upperEdge_(-1.),
0028         elecMuLogged_(0),
0029         diMuonLogged_(0),
0030         diElecLogged_(0) {
0031     // sources have to be given; this PSet is not optional
0032     edm::ParameterSet sources = cfg.getParameter<edm::ParameterSet>("sources");
0033     muons_ = iC.consumes<edm::View<reco::PFCandidate>>(sources.getParameter<edm::InputTag>("muons"));
0034     elecs_ = iC.consumes<edm::View<reco::PFCandidate>>(sources.getParameter<edm::InputTag>("elecs"));
0035     jets_ = iC.consumes<edm::View<reco::Jet>>(sources.getParameter<edm::InputTag>("jets"));
0036     for (edm::InputTag const& tag : sources.getParameter<std::vector<edm::InputTag>>("mets"))
0037       mets_.push_back(iC.consumes<edm::View<reco::MET>>(tag));
0038 
0039     // elecExtras are optional; they may be omitted or empty
0040     if (cfg.existsAs<edm::ParameterSet>("elecExtras")) {
0041       edm::ParameterSet elecExtras = cfg.getParameter<edm::ParameterSet>("elecExtras");
0042       // select is optional; in case it's not found no
0043       // selection will be applied
0044       if (elecExtras.existsAs<std::string>("select")) {
0045         elecSelect_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate>>(
0046             elecExtras.getParameter<std::string>("select"));
0047       }
0048       // isolation is optional; in case it's not found no
0049       // isolation will be applied
0050       if (elecExtras.existsAs<std::string>("isolation")) {
0051         elecIso_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate>>(
0052             elecExtras.getParameter<std::string>("isolation"));
0053       }
0054       // electronId is optional; in case it's not found the
0055       // InputTag will remain empty
0056       if (elecExtras.existsAs<edm::ParameterSet>("electronId")) {
0057         edm::ParameterSet elecId = elecExtras.getParameter<edm::ParameterSet>("electronId");
0058         electronId_ = iC.consumes<edm::ValueMap<float>>(elecId.getParameter<edm::InputTag>("src"));
0059         eidCutValue_ = elecId.getParameter<double>("cutValue");
0060         //  eidPattern_= elecId.getParameter<int>("pattern");
0061       }
0062     }
0063     // muonExtras are optional; they may be omitted or empty
0064     if (cfg.existsAs<edm::ParameterSet>("muonExtras")) {
0065       edm::ParameterSet muonExtras = cfg.getParameter<edm::ParameterSet>("muonExtras");
0066       // select is optional; in case it's not found no
0067       // selection will be applied
0068       if (muonExtras.existsAs<std::string>("select")) {
0069         muonSelect_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate, true>>(
0070             muonExtras.getParameter<std::string>("select"));
0071       }
0072       // isolation is optional; in case it's not found no
0073       // isolation will be applied
0074       if (muonExtras.existsAs<std::string>("isolation")) {
0075         muonIso_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate, true>>(
0076             muonExtras.getParameter<std::string>("isolation"));
0077       }
0078     }
0079     // jetExtras are optional; they may be omitted or empty
0080     if (cfg.existsAs<edm::ParameterSet>("jetExtras")) {
0081       edm::ParameterSet jetExtras = cfg.getParameter<edm::ParameterSet>("jetExtras");
0082       // jetCorrector is optional; in case it's not found
0083       // the InputTag will remain empty
0084       if (jetExtras.existsAs<std::string>("jetCorrector")) {
0085         jetCorrector_ = iC.esConsumes(edm::ESInputTag("", jetExtras.getParameter<std::string>("jetCorrector")));
0086       }
0087       // read jetID information if it exists
0088       if (jetExtras.existsAs<edm::ParameterSet>("jetID")) {
0089         edm::ParameterSet jetID = jetExtras.getParameter<edm::ParameterSet>("jetID");
0090         jetIDLabel_ = iC.consumes<reco::JetIDValueMap>(jetID.getParameter<edm::InputTag>("label"));
0091         jetIDSelect_ =
0092             std::make_unique<StringCutObjectSelector<reco::JetID>>(jetID.getParameter<std::string>("select"));
0093       }
0094       // select is optional; in case it's not found no
0095       // selection will be applied (only implemented for
0096       // CaloJets at the moment)
0097       if (jetExtras.existsAs<std::string>("select")) {
0098         jetSelect_ = jetExtras.getParameter<std::string>("select");
0099       }
0100     }
0101     // triggerExtras are optional; they may be omitted or empty
0102     if (cfg.existsAs<edm::ParameterSet>("triggerExtras")) {
0103       edm::ParameterSet triggerExtras = cfg.getParameter<edm::ParameterSet>("triggerExtras");
0104       triggerTable_ = iC.consumes<edm::TriggerResults>(triggerExtras.getParameter<edm::InputTag>("src"));
0105       elecMuPaths_ = triggerExtras.getParameter<std::vector<std::string>>("pathsELECMU");
0106       diMuonPaths_ = triggerExtras.getParameter<std::vector<std::string>>("pathsDIMUON");
0107     }
0108     // massExtras is optional; in case it's not found no mass
0109     // window cuts are applied for the same flavor monitor
0110     // histograms
0111     if (cfg.existsAs<edm::ParameterSet>("massExtras")) {
0112       edm::ParameterSet massExtras = cfg.getParameter<edm::ParameterSet>("massExtras");
0113       lowerEdge_ = massExtras.getParameter<double>("lowerEdge");
0114       upperEdge_ = massExtras.getParameter<double>("upperEdge");
0115     }
0116 
0117     // setup the verbosity level for booking histograms;
0118     // per default the verbosity level will be set to
0119     // STANDARD. This will also be the chosen level in
0120     // the case when the monitoring PSet is not found
0121     verbosity_ = STANDARD;
0122     if (cfg.existsAs<edm::ParameterSet>("monitoring")) {
0123       edm::ParameterSet monitoring = cfg.getParameter<edm::ParameterSet>("monitoring");
0124       if (monitoring.getParameter<std::string>("verbosity") == "DEBUG")
0125         verbosity_ = DEBUG;
0126       if (monitoring.getParameter<std::string>("verbosity") == "VERBOSE")
0127         verbosity_ = VERBOSE;
0128       if (monitoring.getParameter<std::string>("verbosity") == "STANDARD")
0129         verbosity_ = STANDARD;
0130     }
0131     // and don't forget to do the histogram booking
0132     directory_ = cfg.getParameter<std::string>("directory");
0133   }
0134 
0135   void MonitorEnsemble::book(DQMStore::IBooker& ibooker) {
0136     // set up the current directory path
0137     std::string current(directory_);
0138     current += label_;
0139     ibooker.setCurrentFolder(current);
0140 
0141     // determine number of bins for trigger monitoring
0142     unsigned int nElecMu = elecMuPaths_.size();
0143     unsigned int nDiMuon = diMuonPaths_.size();
0144 
0145     // --- [STANDARD] --- //
0146     // Run Number
0147     hists_["RunNumb_"] = ibooker.book1D("RunNumber", "Run Nr.", 1.e4, 1.5e5, 3.e5);
0148     // invariant mass of opposite charge lepton pair (only filled for same flavor)
0149     hists_["invMass_"] = ibooker.book1D("InvMass", "M(lep1, lep2)", 80, 0., 320.);
0150     // invariant mass of opposite charge lepton pair (only filled for same flavor)
0151     hists_["invMassLog_"] = ibooker.book1D("InvMassLog", "log_{10}(M(lep1, lep2))", 80, .1, 2.5);
0152     // invariant mass of same charge lepton pair (log10 for low mass region, only
0153     // filled for same flavor)
0154     hists_["invMassWC_"] = ibooker.book1D("InvMassWC", "M_{WC}(L1, L2)", 80, 0., 320.);
0155     // invariant mass of same charge lepton pair (log10 for low mass region, only
0156     // filled for same flavor)
0157     hists_["invMassWCLog_"] = ibooker.book1D("InvMassLogWC", "log_{10}(M_{WC})", 80, .1, 2.5);
0158     // decay channel [1]: muon/muon, [2]:elec/elec, [3]:elec/muon
0159     hists_["decayChannel_"] = ibooker.book1D("DecayChannel", "Decay Channel", 3, 0, 3);
0160     // trigger efficiency estimates for the electron muon channel
0161     hists_["elecMuEff_"] = ibooker.book1D("ElecMuEff", "Eff(e/#mu paths)", nElecMu, 0., nElecMu);
0162     // monitored trigger occupancy for the electron muon channel
0163     hists_["elecMuMon_"] = ibooker.book1D("ElecMuMon", "Mon(e/#mu paths)", nElecMu, 0., nElecMu);
0164     // trigger efficiency estimates for the di muon channel
0165     hists_["diMuonEff_"] = ibooker.book1D("DiMuonEff", "Eff(#mu/#mu paths)", nDiMuon, 0., nDiMuon);
0166     // monitored trigger occupancy for the di muon channel
0167     hists_["diMuonMon_"] = ibooker.book1D("DiMuonMon", "Mon(#mu/#mu paths)", nDiMuon, 0., nDiMuon);
0168     // pt of the leading lepton
0169     hists_["lep1Pt_"] = ibooker.book1D("Lep1Pt", "pt(lep1)", 50, 0., 200.);
0170     // pt of the 2. leading lepton
0171     hists_["lep2Pt_"] = ibooker.book1D("Lep2Pt", "pt(lep2)", 50, 0., 200.);
0172     // multiplicity of jets with pt>30 (corrected to L2+L3)
0173     hists_["jetMult_"] = ibooker.book1D("JetMult", "N_{30}(jet)", 21, -0.5, 20.5);
0174     // MET (calo)
0175     hists_["metCalo_"] = ibooker.book1D("METCalo", "MET_{Calo}", 50, 0., 200.);
0176 
0177     // set bin labels for trigger monitoring
0178     triggerBinLabels(std::string("elecMu"), elecMuPaths_);
0179     triggerBinLabels(std::string("diMuon"), diMuonPaths_);
0180     // set bin labels for decayChannel_
0181     hists_["decayChannel_"]->setBinLabel(1, "#mu e", 1);
0182     hists_["decayChannel_"]->setBinLabel(2, "#mu #mu", 1);
0183     hists_["decayChannel_"]->setBinLabel(3, "e e", 1);
0184 
0185     if (verbosity_ == STANDARD)
0186       return;
0187 
0188     // --- [VERBOSE] --- //
0189     // mean eta of the candidate leptons
0190     hists_["sumEtaL1L2_"] = ibooker.book1D("SumEtaL1L2", "<#eta>(lep1, lep2)", 100, -5., 5.);
0191     // deltaEta between the 2 candidate leptons
0192     hists_["dEtaL1L2_"] = ibooker.book1D("DEtaL1L2", "#Delta#eta(lep1,lep2)", 80, -4., 4.);
0193     // deltaPhi between the 2 candidate leptons
0194     hists_["dPhiL1L2_"] = ibooker.book1D("DPhiL1L2", "#Delta#phi(lep1,lep2)", 64, -3.2, 3.2);
0195     // pt of the candidate electron (depending on the decay channel)
0196     hists_["elecPt_"] = ibooker.book1D("ElecPt", "pt(e)", 50, 0., 200.);
0197     // relative isolation of the candidate electron (depending on the decay
0198     // channel)
0199     hists_["elecRelIso_"] = ibooker.book1D("ElecRelIso", "Iso_{Rel}(e)", 50, 0., 1.);
0200     // pt of the canddiate muon (depending on the decay channel)
0201     hists_["muonPt_"] = ibooker.book1D("MuonPt", "pt(#mu)", 50, 0., 200.);
0202     // relative isolation of the candidate muon (depending on the decay channel)
0203     hists_["muonRelIso_"] = ibooker.book1D("MuonRelIso", "Iso_{Rel}(#mu) (#Delta#beta Corrected)", 50, 0., 1.);
0204     // pt of the 1. leading jet (corrected to L2+L3)
0205     hists_["jet1Pt_"] = ibooker.book1D("Jet1Pt", "pt_{L2L3}(jet1)", 60, 0., 300.);
0206     // pt of the 2. leading jet (corrected to L2+L3)
0207     hists_["jet2Pt_"] = ibooker.book1D("Jet2Pt", "pt_{L2L3}(jet2)", 60, 0., 300.);
0208     // MET (PF)
0209     hists_["metPflow_"] = ibooker.book1D("METPflow", "MET_{Pflow}", 50, 0., 200.);
0210     // MET (TC)
0211     hists_["metTC_"] = ibooker.book1D("METTC", "MET_{TC}", 50, 0., 200.);
0212     // dz for muons (to suppress cosmis)
0213     hists_["muonDelZ_"] = ibooker.book1D("MuonDelZ", "d_{z}(#mu)", 50, -25., 25.);
0214     // dxy for muons (to suppress cosmics)
0215     hists_["muonDelXY_"] = ibooker.book2D("MuonDelXY", "d_{xy}(#mu)", 50, -1., 1., 50, -1., 1.);
0216     // lepton multiplicity after std isolation
0217     hists_["lepMultIso_"] = ibooker.book2D("LepMultIso", "N_{Iso}(e) vs N_{Iso}(#mu)", 5, 0., 5., 5, 0., 5.);
0218 
0219     // set axes titles for dxy for muons
0220     hists_["muonDelXY_"]->setAxisTitle("x [cm]", 1);
0221     hists_["muonDelXY_"]->setAxisTitle("y [cm]", 2);
0222     // set axes titles for lepton multiplicity after std isolation
0223     hists_["lepMultIso_"]->setAxisTitle("N_{Iso}(#mu)", 1);
0224     hists_["lepMultIso_"]->setAxisTitle("N_{Iso}(elec)", 2);
0225 
0226     if (verbosity_ == VERBOSE)
0227       return;
0228 
0229     // --- [DEBUG] --- //
0230     // electron multiplicity after std isolation
0231     hists_["elecMultIso_"] = ibooker.book1D("ElecMultIso", "N_{Iso}(e)", 11, -0.5, 10.5);
0232     // muon multiplicity after std isolation
0233     hists_["muonMultIso_"] = ibooker.book1D("MuonMultIso", "N_{Iso}(#mu)", 11, -0.5, 10.5);
0234     // charged hadron isolation component of the candidate muon (depending on the
0235     // decay channel)
0236     hists_["muonChHadIso_"] = ibooker.book1D("MuonChHadIsoComp", "ChHad_{IsoComponent}(#mu)", 50, 0., 5.);
0237     // neutral hadron isolation component of the candidate muon (depending on the
0238     // decay channel)
0239     hists_["muonNeHadIso_"] = ibooker.book1D("MuonNeHadIsoComp", "NeHad_{IsoComponent}(#mu)", 50, 0., 5.);
0240     // photon isolation component of the candidate muon (depending on the decay
0241     // channel)
0242     hists_["muonPhIso_"] = ibooker.book1D("MuonPhIsoComp", "Photon_{IsoComponent}(#mu)", 50, 0., 5.);
0243     // charged hadron isolation component of the candidate electron (depending on
0244     // the decay channel)
0245     hists_["elecChHadIso_"] = ibooker.book1D("ElectronChHadIsoComp", "ChHad_{IsoComponent}(e)", 50, 0., 5.);
0246     // neutral hadron isolation component of the candidate electron (depending on
0247     // the decay channel)
0248     hists_["elecNeHadIso_"] = ibooker.book1D("ElectronNeHadIsoComp", "NeHad_{IsoComponent}(e)", 50, 0., 5.);
0249     // photon isolation component of the candidate electron (depending on the
0250     // decay channel)
0251     hists_["elecPhIso_"] = ibooker.book1D("ElectronPhIsoComp", "Photon_{IsoComponent}(e)", 50, 0., 5.);
0252     // eta of the leading jet
0253     hists_["jet1Eta_"] = ibooker.book1D("Jet1Eta", "#eta(jet1)", 30, -5., 5.);
0254     // eta of the 2. leading jet
0255     hists_["jet2Eta_"] = ibooker.book1D("Jet2Eta", "#eta(jet2)", 30, -5., 5.);
0256     // pt of the 1. leading jet (not corrected)
0257     hists_["jet1PtRaw_"] = ibooker.book1D("Jet1PtRaw", "pt_{Raw}(jet1)", 60, 0., 300.);
0258     // pt of the 2. leading jet (not corrected)
0259     hists_["jet2PtRaw_"] = ibooker.book1D("Jet2PtRaw", "pt_{Raw}(jet2)", 60, 0., 300.);
0260     // deltaEta between the 2 leading jets
0261     hists_["dEtaJet1Jet2_"] = ibooker.book1D("DEtaJet1Jet2", "#Delta#eta(jet1,jet2)", 80, -4., 4.);
0262     // deltaEta between the lepton and the leading jet
0263     hists_["dEtaJet1Lep1_"] = ibooker.book1D("DEtaJet1Lep1", "#Delta#eta(jet1,lep1)", 80, -4., 4.);
0264     // deltaEta between the lepton and MET
0265     hists_["dEtaLep1MET_"] = ibooker.book1D("DEtaLep1MET", "#Delta#eta(lep1,MET)", 80, -4., 4.);
0266     // deltaEta between leading jet and MET
0267     hists_["dEtaJet1MET_"] = ibooker.book1D("DEtaJet1MET", "#Delta#eta(jet1,MET)", 80, -4., 4.);
0268     // deltaPhi of 2 leading jets
0269     hists_["dPhiJet1Jet2_"] = ibooker.book1D("DPhiJet1Jet2", "#Delta#phi(jet1,jet2)", 64, -3.2, 3.2);
0270     // deltaPhi of 1. lepton and 1. jet
0271     hists_["dPhiJet1Lep1_"] = ibooker.book1D("DPhiJet1Lep1", "#Delta#phi(jet1,lep1)", 64, -3.2, 3.2);
0272     // deltaPhi of 1. lepton and MET
0273     hists_["dPhiLep1MET_"] = ibooker.book1D("DPhiLep1MET", "#Delta#phi(lep1,MET)", 64, -3.2, 3.2);
0274     // deltaPhi of 1. jet and MET
0275     hists_["dPhiJet1MET_"] = ibooker.book1D("DPhiJet1MET", "#Delta#phi(jet1,MET)", 64, -3.2, 3.2);
0276     // selected dimuon events
0277     hists_["diMuonLogger_"] = ibooker.book2D("DiMuonLogger", "Logged DiMuon Events", 8, 0., 8., 10, 0., 10.);
0278     // selected dielec events
0279     hists_["diElecLogger_"] = ibooker.book2D("DiElecLogger", "Logged DiElec Events", 8, 0., 8., 10, 0., 10.);
0280     // selected elemu events
0281     hists_["elecMuLogger_"] = ibooker.book2D("ElecMuLogger", "Logged ElecMu Events", 8, 0., 8., 10, 0., 10.);
0282 
0283     // set bin labels for trigger monitoring
0284     loggerBinLabels(std::string("diMuonLogger_"));
0285     loggerBinLabels(std::string("diElecLogger_"));
0286     loggerBinLabels(std::string("elecMuLogger_"));
0287     return;
0288   }
0289 
0290   void MonitorEnsemble::fill(const edm::Event& event, const edm::EventSetup& setup) {
0291     // fetch trigger event if configured such
0292     edm::Handle<edm::TriggerResults> triggerTable;
0293     if (!triggerTable_.isUninitialized()) {
0294       if (!event.getByToken(triggerTable_, triggerTable))
0295         return;
0296     }
0297     /*
0298   ------------------------------------------------------------
0299 
0300   Run and Inst. Luminosity information (Inst. Lumi. filled now with a dummy
0301   value=5.0)
0302 
0303   ------------------------------------------------------------
0304   */
0305 
0306     if (!event.eventAuxiliary().run())
0307       return;
0308     fill("RunNumb_", event.eventAuxiliary().run());
0309 
0310     double dummy = 5.;
0311     fill("InstLumi_", dummy);
0312 
0313     /*
0314   ------------------------------------------------------------
0315 
0316   Muon Selection
0317 
0318   ------------------------------------------------------------
0319   */
0320 
0321     std::vector<const reco::PFCandidate*> isoMuons;
0322 
0323     edm::Handle<edm::View<reco::PFCandidate>> muons;
0324     edm::View<reco::PFCandidate>::const_iterator muonit;
0325 
0326     if (!event.getByToken(muons_, muons))
0327       return;
0328 
0329     for (edm::View<reco::PFCandidate>::const_iterator muonit = muons->begin(); muonit != muons->end(); ++muonit) {
0330       if (muonit->muonRef().isNull())
0331         continue;
0332       reco::MuonRef muon = muonit->muonRef();
0333 
0334       if (muon->innerTrack().isNull())
0335         continue;
0336 
0337       if (muon->isGlobalMuon()) {
0338         fill("muonDelZ_", muon->innerTrack()->vz());  // CB using inner track!
0339         fill("muonDelXY_", muon->innerTrack()->vx(), muon->innerTrack()->vy());
0340 
0341         // apply selection
0342         if (!muonSelect_ || (*muonSelect_)(*muonit)) {
0343           double chHadPt = muon->pfIsolationR04().sumChargedHadronPt;
0344           double neHadEt = muon->pfIsolationR04().sumNeutralHadronEt;
0345           double phoEt = muon->pfIsolationR04().sumPhotonEt;
0346 
0347           double pfRelIso = (chHadPt + std::max(0., neHadEt + phoEt - 0.5 * muon->pfIsolationR04().sumPUPt)) /
0348                             muon->pt();  // CB dBeta corrected iso!
0349 
0350           fill("muonRelIso_", pfRelIso);
0351 
0352           fill("muonChHadIso_", chHadPt);
0353           fill("muonNeHadIso_", neHadEt);
0354           fill("muonPhIso_", phoEt);
0355 
0356           if (!muonIso_ || (*muonIso_)(*muonit))
0357             isoMuons.push_back(&(*muonit));
0358         }
0359       }
0360     }
0361 
0362     fill("muonMultIso_", isoMuons.size());
0363 
0364     /*
0365   ------------------------------------------------------------
0366 
0367   Electron Selection
0368 
0369   ------------------------------------------------------------
0370   */
0371 
0372     // buffer isolated electronss
0373     std::vector<const reco::PFCandidate*> isoElecs;
0374     edm::Handle<edm::ValueMap<float>> electronId;
0375     if (!electronId_.isUninitialized()) {
0376       if (!event.getByToken(electronId_, electronId))
0377         return;
0378     }
0379     edm::Handle<edm::View<reco::PFCandidate>> elecs;
0380     if (!event.getByToken(elecs_, elecs))
0381       return;
0382 
0383     for (edm::View<reco::PFCandidate>::const_iterator elec = elecs->begin(); elec != elecs->end(); ++elec) {
0384       if (elec->gsfElectronRef().isNull()) {
0385         continue;
0386       }
0387       reco::GsfElectronRef gsf_el = elec->gsfElectronRef();
0388       // restrict to electrons with good electronId
0389       if (electronId_.isUninitialized() ? true : ((double)(*electronId)[gsf_el] >= eidCutValue_)) {
0390         // apply preselection
0391         if (!elecSelect_ || (*elecSelect_)(*elec)) {
0392           double el_ChHadIso = gsf_el->pfIsolationVariables().sumChargedHadronPt;
0393           double el_NeHadIso = gsf_el->pfIsolationVariables().sumNeutralHadronEt;
0394           double el_PhIso = gsf_el->pfIsolationVariables().sumPhotonEt;
0395           double el_pfRelIso =
0396               (el_ChHadIso + std::max(0., el_NeHadIso + el_PhIso - 0.5 * gsf_el->pfIsolationVariables().sumPUPt)) /
0397               gsf_el->pt();
0398           fill("elecRelIso_", el_pfRelIso);
0399           fill("elecChHadIso_", el_ChHadIso);
0400           fill("elecNeHadIso_", el_NeHadIso);
0401           fill("elecPhIso_", el_PhIso);
0402           if (!elecIso_ || (*elecIso_)(*elec))
0403             isoElecs.push_back(&(*elec));
0404         }
0405       }
0406     }
0407     fill("elecMultIso_", isoElecs.size());
0408 
0409     /*
0410   ------------------------------------------------------------
0411 
0412   Jet Selection
0413 
0414   ------------------------------------------------------------
0415   */
0416 
0417     const JetCorrector* corrector = nullptr;
0418     if (!jetCorrector_.isInitialized() && jetCorrector_.hasValidIndex()) {
0419       // check whether a jet correcto is in the event setup or not
0420       if (setup.find(edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>())) {
0421         corrector = &setup.getData(jetCorrector_);
0422       } else {
0423         edm::LogVerbatim("TopDiLeptonOfflineDQM") << "\n"
0424                                                   << "-----------------------------------------------------------------"
0425                                                      "-------------------- \n"
0426                                                   << " No JetCorrectionsRecord available from EventSetup:              "
0427                                                      "                     \n"
0428                                                   << "  - Jets will not be corrected.                                  "
0429                                                      "                     \n"
0430                                                   << "  - If you want to change this add the following lines to your "
0431                                                      "cfg file:              \n"
0432                                                   << "                                                                 "
0433                                                      "                     \n"
0434                                                   << "  ## load jet corrections                                        "
0435                                                      "                     \n"
0436                                                   << "  "
0437                                                      "process.load(\"JetMETCorrections.Configuration."
0438                                                      "JetCorrectionServicesAllAlgos_cff\") \n"
0439                                                   << "  process.prefer(\"ak5CaloL2L3\")                                "
0440                                                      "                     \n"
0441                                                   << "                                                                 "
0442                                                      "                     \n"
0443                                                   << "-----------------------------------------------------------------"
0444                                                      "-------------------- \n";
0445       }
0446     }
0447 
0448     unsigned int mult = 0;
0449     // buffer leadingJets
0450     std::vector<reco::Jet> leadingJets;
0451     edm::Handle<edm::View<reco::Jet>> jets;
0452     if (!event.getByToken(jets_, jets))
0453       return;
0454 
0455     edm::Handle<reco::JetIDValueMap> jetID;
0456     if (jetIDSelect_) {
0457       if (!event.getByToken(jetIDLabel_, jetID))
0458         return;
0459     }
0460 
0461     for (edm::View<reco::Jet>::const_iterator jet = jets->begin(); jet != jets->end(); ++jet) {
0462       unsigned int idx = jet - jets->begin();
0463       if (jetIDSelect_ && dynamic_cast<const reco::CaloJet*>(jets->refAt(idx).get())) {
0464         if (!(*jetIDSelect_)((*jetID)[jets->refAt(idx)]))
0465           continue;
0466       }
0467       // chekc additional jet selection for calo, pf and bare reco jets
0468       if (dynamic_cast<const reco::CaloJet*>(&*jet)) {
0469         reco::CaloJet sel = dynamic_cast<const reco::CaloJet&>(*jet);
0470         sel.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
0471         StringCutObjectSelector<reco::CaloJet> jetSelect(jetSelect_);
0472         if (!jetSelect(sel)) {
0473           continue;
0474         }
0475       } else if (dynamic_cast<const reco::PFJet*>(&*jet)) {
0476         reco::PFJet sel = dynamic_cast<const reco::PFJet&>(*jet);
0477         sel.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
0478         StringCutObjectSelector<reco::PFJet> jetSelect(jetSelect_);
0479         if (!jetSelect(sel))
0480           continue;
0481       } else {
0482         reco::Jet sel = *jet;
0483         sel.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
0484         StringCutObjectSelector<reco::Jet> jetSelect(jetSelect_);
0485         if (!jetSelect(sel))
0486           continue;
0487       }
0488       // check for overlaps
0489       bool overlap = false;
0490       for (std::vector<const reco::PFCandidate*>::const_iterator elec = isoElecs.begin(); elec != isoElecs.end();
0491            ++elec) {
0492         if (reco::deltaR((*elec)->eta(), (*elec)->phi(), jet->eta(), jet->phi()) < 0.4) {
0493           overlap = true;
0494           break;
0495         }
0496       }
0497       if (overlap) {
0498         continue;
0499       }
0500       // prepare jet to fill monitor histograms
0501       reco::Jet monitorJet = *jet;
0502       monitorJet.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
0503       ++mult;  // determine jet multiplicity
0504       if (idx == 0) {
0505         leadingJets.push_back(monitorJet);
0506         fill("jet1Pt_", monitorJet.pt());
0507         fill("jet1PtRaw_", jet->pt());
0508         fill("jet1Eta_", jet->eta());
0509       }
0510       if (idx == 1) {
0511         leadingJets.push_back(monitorJet);
0512         fill("jet2Pt_", monitorJet.pt());
0513         fill("jet2PtRaw_", jet->pt());
0514         fill("jet2Eta_", jet->eta());
0515       }
0516     }
0517     if (leadingJets.size() > 1) {
0518       fill("dEtaJet1Jet2_", leadingJets[0].eta() - leadingJets[1].eta());
0519       fill("dPhiJet1Jet2_", reco::deltaPhi(leadingJets[0].phi(), leadingJets[1].phi()));
0520       if (!isoMuons.empty()) {
0521         if (isoElecs.empty() || isoMuons[0]->pt() > isoElecs[0]->pt()) {
0522           fill("dEtaJet1Lep1_", isoMuons[0]->eta() - leadingJets[0].eta());
0523           fill("dPhiJet1Lep1_", reco::deltaPhi(isoMuons[0]->phi(), leadingJets[0].phi()));
0524         }
0525       }
0526       if (!isoElecs.empty()) {
0527         if (isoMuons.empty() || isoElecs[0]->pt() > isoMuons[0]->pt()) {
0528           fill("dEtaJet1Lep1_", isoElecs[0]->eta() - leadingJets[0].eta());
0529           fill("dPhiJet1Lep1_", reco::deltaPhi(isoElecs[0]->phi(), leadingJets[0].phi()));
0530         }
0531       }
0532     }
0533     fill("jetMult_", mult);
0534 
0535     /*
0536   ------------------------------------------------------------
0537 
0538   MET Selection
0539 
0540   ------------------------------------------------------------
0541   */
0542 
0543     // buffer for event logging
0544     reco::MET caloMET;
0545     for (std::vector<edm::EDGetTokenT<edm::View<reco::MET>>>::const_iterator met_ = mets_.begin(); met_ != mets_.end();
0546          ++met_) {
0547       edm::Handle<edm::View<reco::MET>> met;
0548       if (!event.getByToken(*met_, met))
0549         continue;
0550 
0551       if (met->begin() != met->end()) {
0552         unsigned int idx = met_ - mets_.begin();
0553         if (idx == 0) {
0554           caloMET = *met->begin();
0555           fill("metCalo_", met->begin()->et());
0556           if (!leadingJets.empty()) {
0557             fill("dEtaJet1MET_", leadingJets[0].eta() - met->begin()->eta());
0558             fill("dPhiJet1MET_", reco::deltaPhi(leadingJets[0].phi(), met->begin()->phi()));
0559           }
0560           if (!isoMuons.empty()) {
0561             if (isoElecs.empty() || isoMuons[0]->pt() > isoElecs[0]->pt()) {
0562               fill("dEtaLep1MET_", isoMuons[0]->eta() - met->begin()->eta());
0563               fill("dPhiLep1MET_", reco::deltaPhi(isoMuons[0]->phi(), met->begin()->phi()));
0564             }
0565           }
0566           if (!isoElecs.empty()) {
0567             if (isoMuons.empty() || isoElecs[0]->pt() > isoMuons[0]->pt()) {
0568               fill("dEtaLep1MET_", isoElecs[0]->eta() - met->begin()->eta());
0569               fill("dPhiLep1MET_", reco::deltaPhi(isoElecs[0]->phi(), met->begin()->phi()));
0570             }
0571           }
0572         }
0573         if (idx == 1) {
0574           fill("metTC_", met->begin()->et());
0575         }
0576         if (idx == 2) {
0577           fill("metPflow_", met->begin()->et());
0578         }
0579       }
0580     }
0581 
0582     /*
0583   ------------------------------------------------------------
0584 
0585   Event Monitoring
0586 
0587   ------------------------------------------------------------
0588   */
0589 
0590     // check number of isolated leptons
0591     fill("lepMultIso_", isoMuons.size(), isoElecs.size());
0592     // ELECMU channel
0593     if (decayChannel(isoMuons, isoElecs) == ELECMU) {
0594       fill("decayChannel_", 0.5);
0595       double mass = (isoElecs[0]->p4() + isoMuons[0]->p4()).mass();
0596       if ((lowerEdge_ == -1. && upperEdge_ == -1.) || (lowerEdge_ < mass && mass < upperEdge_)) {
0597         fill("dEtaL1L2_", isoElecs[0]->eta() - isoMuons[0]->eta());
0598         fill("sumEtaL1L2_", (isoElecs[0]->eta() + isoMuons[0]->eta()) / 2);
0599         fill("dPhiL1L2_", reco::deltaPhi(isoElecs[0]->phi(), isoMuons[0]->eta()));
0600         fill("elecPt_", isoElecs[0]->pt());
0601         fill("muonPt_", isoMuons[0]->pt());
0602         fill("lep1Pt_", isoElecs[0]->pt() > isoMuons[0]->pt() ? isoElecs[0]->pt() : isoMuons[0]->pt());
0603         fill("lep2Pt_", isoElecs[0]->pt() > isoMuons[0]->pt() ? isoMuons[0]->pt() : isoElecs[0]->pt());
0604         // fill plots for trigger monitoring
0605         if (!triggerTable_.isUninitialized())
0606           fill(event, *triggerTable, "elecMu", elecMuPaths_);
0607         if (elecMuLogged_ <= hists_.find("elecMuLogger_")->second->getNbinsY()) {
0608           // log runnumber, lumi block, event number & some
0609           // more pysics infomation for interesting events
0610           fill("elecMuLogger_", 0.5, elecMuLogged_ + 0.5, event.eventAuxiliary().run());
0611           fill("elecMuLogger_", 1.5, elecMuLogged_ + 0.5, event.eventAuxiliary().luminosityBlock());
0612           fill("elecMuLogger_", 2.5, elecMuLogged_ + 0.5, event.eventAuxiliary().event());
0613           fill("elecMuLogger_", 3.5, elecMuLogged_ + 0.5, isoMuons[0]->pt());
0614           fill("elecMuLogger_", 4.5, elecMuLogged_ + 0.5, isoElecs[0]->pt());
0615           if (!leadingJets.empty())
0616             fill("elecMuLogger_", 5.5, elecMuLogged_ + 0.5, leadingJets[0].pt());
0617           if (leadingJets.size() > 1)
0618             fill("elecMuLogger_", 6.5, elecMuLogged_ + 0.5, leadingJets[1].pt());
0619           fill("elecMuLogger_", 7.5, elecMuLogged_ + 0.5, caloMET.et());
0620           ++elecMuLogged_;
0621         }
0622       }
0623     }
0624 
0625     // DIMUON channel
0626     if (decayChannel(isoMuons, isoElecs) == DIMUON) {
0627       fill("decayChannel_", 1.5);
0628       int charge = isoMuons[0]->charge() * isoMuons[1]->charge();
0629       double mass = (isoMuons[0]->p4() + isoMuons[1]->p4()).mass();
0630 
0631       fill(charge < 0 ? "invMass_" : "invMassWC_", mass);
0632       fill(charge < 0 ? "invMassLog_" : "invMassWCLog_", log10(mass));
0633       if ((lowerEdge_ == -1. && upperEdge_ == -1.) || (lowerEdge_ < mass && mass < upperEdge_)) {
0634         fill("dEtaL1L2_", isoMuons[0]->eta() - isoMuons[1]->eta());
0635         fill("sumEtaL1L2_", (isoMuons[0]->eta() + isoMuons[1]->eta()) / 2);
0636         fill("dPhiL1L2_", reco::deltaPhi(isoMuons[0]->phi(), isoMuons[1]->phi()));
0637         fill("muonPt_", isoMuons[0]->pt());
0638         fill("muonPt_", isoMuons[1]->pt());
0639         fill("lep1Pt_", isoMuons[0]->pt());
0640         fill("lep2Pt_", isoMuons[1]->pt());
0641         // fill plots for trigger monitoring
0642         if (!triggerTable_.isUninitialized())
0643           fill(event, *triggerTable, "diMuon", diMuonPaths_);
0644         if (diMuonLogged_ <= hists_.find("diMuonLogger_")->second->getNbinsY()) {
0645           // log runnumber, lumi block, event number & some
0646           // more pysics infomation for interesting events
0647           fill("diMuonLogger_", 0.5, diMuonLogged_ + 0.5, event.eventAuxiliary().run());
0648           fill("diMuonLogger_", 1.5, diMuonLogged_ + 0.5, event.eventAuxiliary().luminosityBlock());
0649           fill("diMuonLogger_", 2.5, diMuonLogged_ + 0.5, event.eventAuxiliary().event());
0650           fill("diMuonLogger_", 3.5, diMuonLogged_ + 0.5, isoMuons[0]->pt());
0651           fill("diMuonLogger_", 4.5, diMuonLogged_ + 0.5, isoMuons[1]->pt());
0652           if (!leadingJets.empty())
0653             fill("diMuonLogger_", 5.5, diMuonLogged_ + 0.5, leadingJets[0].pt());
0654           if (leadingJets.size() > 1)
0655             fill("diMuonLogger_", 6.5, diMuonLogged_ + 0.5, leadingJets[1].pt());
0656           fill("diMuonLogger_", 7.5, diMuonLogged_ + 0.5, caloMET.et());
0657           ++diMuonLogged_;
0658         }
0659       }
0660     }
0661 
0662     // DIELEC channel
0663     if (decayChannel(isoMuons, isoElecs) == DIELEC) {
0664       fill("decayChannel_", 2.5);
0665       int charge = isoElecs[0]->charge() * isoElecs[1]->charge();
0666       double mass = (isoElecs[0]->p4() + isoElecs[1]->p4()).mass();
0667       fill(charge < 0 ? "invMass_" : "invMassWC_", mass);
0668       fill(charge < 0 ? "invMassLog_" : "invMassWCLog_", log10(mass));
0669       if ((lowerEdge_ == -1. && upperEdge_ == -1.) || (lowerEdge_ < mass && mass < upperEdge_)) {
0670         fill("dEtaL1L2_", isoElecs[0]->eta() - isoElecs[1]->eta());
0671         fill("sumEtaL1L2_", (isoElecs[0]->eta() + isoElecs[1]->eta()) / 2);
0672         fill("dPhiL1L2_", reco::deltaPhi(isoElecs[0]->phi(), isoElecs[1]->phi()));
0673         fill("elecPt_", isoElecs[0]->pt());
0674         fill("elecPt_", isoElecs[1]->pt());
0675         fill("lep1Pt_", isoElecs[0]->pt());
0676         fill("lep2Pt_", isoElecs[1]->pt());
0677         if (diElecLogged_ <= hists_.find("diElecLogger_")->second->getNbinsY()) {
0678           // log runnumber, lumi block, event number & some
0679           // more pysics infomation for interesting events
0680           fill("diElecLogger_", 0.5, diElecLogged_ + 0.5, event.eventAuxiliary().run());
0681           fill("diElecLogger_", 1.5, diElecLogged_ + 0.5, event.eventAuxiliary().luminosityBlock());
0682           fill("diElecLogger_", 2.5, diElecLogged_ + 0.5, event.eventAuxiliary().event());
0683           fill("diElecLogger_", 3.5, diElecLogged_ + 0.5, isoElecs[0]->pt());
0684           fill("diElecLogger_", 4.5, diElecLogged_ + 0.5, isoElecs[1]->pt());
0685           if (!leadingJets.empty())
0686             fill("diElecLogger_", 5.5, diElecLogged_ + 0.5, leadingJets[0].pt());
0687           if (leadingJets.size() > 1)
0688             fill("diElecLogger_", 6.5, diElecLogged_ + 0.5, leadingJets[1].pt());
0689           fill("diElecLogger_", 7.5, diElecLogged_ + 0.5, caloMET.et());
0690           ++diElecLogged_;
0691         }
0692       }
0693     }
0694   }
0695 }  // namespace TopDiLeptonOffline
0696 
0697 TopDiLeptonOfflineDQM::TopDiLeptonOfflineDQM(const edm::ParameterSet& cfg)
0698     : vertexSelect_(nullptr),
0699       beamspotSelect_(nullptr),
0700       MuonStep(nullptr),
0701       ElectronStep(nullptr),
0702       PvStep(nullptr),
0703       METStep(nullptr) {
0704   JetSteps.clear();
0705   CaloJetSteps.clear();
0706   PFJetSteps.clear();
0707   // configure the preselection
0708   edm::ParameterSet presel = cfg.getParameter<edm::ParameterSet>("preselection");
0709   if (presel.existsAs<edm::ParameterSet>("trigger")) {
0710     edm::ParameterSet trigger = presel.getParameter<edm::ParameterSet>("trigger");
0711     //    triggerTable_=trigger.getParameter<edm::InputTag>("src");
0712     triggerTable_ = consumes<edm::TriggerResults>(trigger.getParameter<edm::InputTag>("src"));
0713     triggerPaths_ = trigger.getParameter<std::vector<std::string>>("select");
0714   }
0715   if (presel.existsAs<edm::ParameterSet>("vertex")) {
0716     edm::ParameterSet vertex = presel.getParameter<edm::ParameterSet>("vertex");
0717     vertex_ = consumes<std::vector<reco::Vertex>>(vertex.getParameter<edm::InputTag>("src"));
0718     vertexSelect_ = std::make_unique<StringCutObjectSelector<reco::Vertex>>(vertex.getParameter<std::string>("select"));
0719   }
0720   if (presel.existsAs<edm::ParameterSet>("beamspot")) {
0721     edm::ParameterSet beamspot = presel.getParameter<edm::ParameterSet>("beamspot");
0722     beamspot_ = consumes<reco::BeamSpot>(beamspot.getParameter<edm::InputTag>("src"));
0723     beamspotSelect_ =
0724         std::make_unique<StringCutObjectSelector<reco::BeamSpot>>(beamspot.getParameter<std::string>("select"));
0725   }
0726 
0727   // conifgure the selection
0728   sel_ = cfg.getParameter<std::vector<edm::ParameterSet>>("selection");
0729   setup_ = cfg.getParameter<edm::ParameterSet>("setup");
0730   for (unsigned int i = 0; i < sel_.size(); ++i) {
0731     selectionOrder_.push_back(sel_.at(i).getParameter<std::string>("label"));
0732     selection_[selectionStep(selectionOrder_.back())] =
0733         std::make_pair(sel_.at(i),
0734                        std::make_unique<TopDiLeptonOffline::MonitorEnsemble>(
0735                            selectionStep(selectionOrder_.back()).c_str(), setup_, consumesCollector()));
0736   }
0737   for (std::vector<std::string>::const_iterator selIt = selectionOrder_.begin(); selIt != selectionOrder_.end();
0738        ++selIt) {
0739     std::string key = selectionStep(*selIt), type = objectType(*selIt);
0740     if (selection_.find(key) != selection_.end()) {
0741       if (type == "muons") {
0742         MuonStep = std::make_unique<SelectionStep<reco::PFCandidate>>(selection_[key].first, consumesCollector());
0743       }
0744       if (type == "elecs") {
0745         ElectronStep = std::make_unique<SelectionStep<reco::PFCandidate>>(selection_[key].first, consumesCollector());
0746       }
0747       if (type == "pvs") {
0748         PvStep = std::make_unique<SelectionStep<reco::Vertex>>(selection_[key].first, consumesCollector());
0749       }
0750       if (type == "jets") {
0751         JetSteps.push_back(std::make_unique<SelectionStep<reco::Jet>>(selection_[key].first, consumesCollector()));
0752       }
0753       if (type == "jets/pf") {
0754         PFJetSteps.push_back(std::make_unique<SelectionStep<reco::PFJet>>(selection_[key].first, consumesCollector()));
0755       }
0756       if (type == "jets/calo") {
0757         CaloJetSteps.push_back(
0758             std::make_unique<SelectionStep<reco::CaloJet>>(selection_[key].first, consumesCollector()));
0759       }
0760       if (type == "met") {
0761         METStep = std::make_unique<SelectionStep<reco::MET>>(selection_[key].first, consumesCollector());
0762       }
0763     }
0764   }
0765 }
0766 
0767 void TopDiLeptonOfflineDQM::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, edm::EventSetup const&) {
0768   for (auto selIt = selection_.begin(); selIt != selection_.end(); ++selIt) {
0769     selIt->second.second->book(ibooker);
0770   }
0771 }
0772 void TopDiLeptonOfflineDQM::analyze(const edm::Event& event, const edm::EventSetup& setup) {
0773   if (!triggerTable_.isUninitialized()) {
0774     edm::Handle<edm::TriggerResults> triggerTable;
0775     if (!event.getByToken(triggerTable_, triggerTable))
0776       return;
0777     if (!accept(event, *triggerTable, triggerPaths_))
0778       return;
0779   }
0780   if (!vertex_.isUninitialized()) {
0781     edm::Handle<std::vector<reco::Vertex>> vertex;
0782     if (!event.getByToken(vertex_, vertex))
0783       return;
0784     if (vertex->empty() || !(*vertexSelect_)(vertex->front()))
0785       return;
0786   }
0787   if (!beamspot_.isUninitialized()) {
0788     edm::Handle<reco::BeamSpot> beamspot;
0789     if (!event.getByToken(beamspot_, beamspot))
0790       return;
0791     if (!(*beamspotSelect_)(*beamspot))
0792       return;
0793   }
0794   unsigned int passed = 0;
0795 
0796   unsigned int nJetSteps = -1;
0797 
0798   unsigned int nPFJetSteps = -1;
0799 
0800   unsigned int nCaloJetSteps = -1;
0801   // apply selection steps
0802   for (std::vector<std::string>::const_iterator selIt = selectionOrder_.begin(); selIt != selectionOrder_.end();
0803        ++selIt) {
0804     std::string key = selectionStep(*selIt), type = objectType(*selIt);
0805     if (selection_.find(key) != selection_.end()) {
0806       if (type == "empty") {
0807         selection_[key].second->fill(event, setup);
0808       }
0809       if (type == "muons" && MuonStep != nullptr) {
0810         if (MuonStep->select(event)) {
0811           ++passed;
0812           selection_[key].second->fill(event, setup);
0813         } else
0814           break;
0815       }
0816       if (type == "elecs" && ElectronStep != nullptr) {
0817         if (ElectronStep->select(event, "electron")) {
0818           ++passed;
0819           selection_[key].second->fill(event, setup);
0820         } else
0821           break;
0822       }
0823       if (type == "jets" && !JetSteps.empty()) {
0824         nJetSteps++;
0825         if (JetSteps[nJetSteps] != nullptr) {
0826           if (JetSteps[nJetSteps]->select(event, setup)) {
0827             ++passed;
0828             selection_[key].second->fill(event, setup);
0829           } else
0830             break;
0831         }
0832       }
0833 
0834       if (type == "jets/pf" && !PFJetSteps.empty()) {
0835         nPFJetSteps++;
0836         if (PFJetSteps[nPFJetSteps] != nullptr) {
0837           if (PFJetSteps[nPFJetSteps]->select(event, setup)) {
0838             ++passed;
0839             selection_[key].second->fill(event, setup);
0840           } else
0841             break;
0842         }
0843       }
0844 
0845       if (type == "jets/calo" && !CaloJetSteps.empty()) {
0846         nCaloJetSteps++;
0847         if (CaloJetSteps[nCaloJetSteps] != nullptr) {
0848           if (CaloJetSteps[nCaloJetSteps]->select(event, setup)) {
0849             ++passed;
0850             selection_[key].second->fill(event, setup);
0851           } else
0852             break;
0853         }
0854       }
0855 
0856       if (type == "met" && METStep != nullptr) {
0857         ++passed;
0858         if (METStep->select(event)) {
0859           selection_[key].second->fill(event, setup);
0860         } else
0861           break;
0862       }
0863     }
0864   }
0865 }