diff --git a/HiggsAnalysis/Skimming/interface/HeavyChHiggsToTauNuSkim.h b/HiggsAnalysis/Skimming/interface/HeavyChHiggsToTauNuSkim.h index 2c60b253ba009..a2d1ec1f9abba 100644 --- a/HiggsAnalysis/Skimming/interface/HeavyChHiggsToTauNuSkim.h +++ b/HiggsAnalysis/Skimming/interface/HeavyChHiggsToTauNuSkim.h @@ -3,8 +3,8 @@ /** \class HeavyChHiggsToTauNuSkim * - * - * Filter to select events passing + * + * Filter to select events passing * L1 single tau * HLT tau+MET * 3 offline jets @@ -24,6 +24,8 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/BTauReco/interface/IsolatedTauTagInfo.h" +#include "DataFormats/JetReco/interface/CaloJetCollection.h" #include @@ -37,15 +39,15 @@ class HeavyChHiggsToTauNuSkim : public edm::EDFilter { private: double deltaPhi(double phi1, double phi2){ - const double PI = 3.1415926535; + const double PI = 3.1415926535; // in ORCA phi = [0,2pi], in TLorentzVector phi = [-pi,pi]. // With the conversion below deltaPhi works ok despite the // 2*pi difference in phi definitions. if(phi1 < 0) phi1 += 2*PI; if(phi2 < 0) phi2 += 2*PI; - + double dphi = fabs(phi1-phi2); - + if(dphi > PI) dphi = 2*PI - dphi; return dphi; } @@ -58,8 +60,8 @@ class HeavyChHiggsToTauNuSkim : public edm::EDFilter { bool debug; - edm::InputTag hltTauLabel; - edm::InputTag jetLabel; + edm::EDGetTokenT hltTauToken; + edm::EDGetTokenT jetToken; int minNumberOfjets; double jetEtMin; double jetEtaMin; @@ -71,4 +73,4 @@ class HeavyChHiggsToTauNuSkim : public edm::EDFilter { #endif - + diff --git a/HiggsAnalysis/Skimming/interface/HiggsTo2GammaSkim.h b/HiggsAnalysis/Skimming/interface/HiggsTo2GammaSkim.h index 58cddd8de7c7a..0433f0ec42bb0 100644 --- a/HiggsAnalysis/Skimming/interface/HiggsTo2GammaSkim.h +++ b/HiggsAnalysis/Skimming/interface/HiggsTo2GammaSkim.h @@ -5,7 +5,7 @@ * * * Filter to select 2 photon events based on the - * 1 or 2 photon HLT trigger, + * 1 or 2 photon HLT trigger, * * \author Kati Lassila-Perini - Helsinki Institute of Physics * @@ -22,9 +22,10 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" +#include class HiggsTo2GammaSkim : public edm::EDFilter { - + public: // Constructor explicit HiggsTo2GammaSkim(const edm::ParameterSet&); @@ -46,8 +47,7 @@ class HiggsTo2GammaSkim : public edm::EDFilter { int nPhotonMin; // Reco samples - edm::InputTag thePhotonLabel; - // std::string thePhotonLabel; + edm::EDGetTokenT thePhotonToken; }; #endif diff --git a/HiggsAnalysis/Skimming/interface/HiggsToWW2LeptonsSkim.h b/HiggsAnalysis/Skimming/interface/HiggsToWW2LeptonsSkim.h index 6f80025dcc1f0..e3f1e65d82fec 100644 --- a/HiggsAnalysis/Skimming/interface/HiggsToWW2LeptonsSkim.h +++ b/HiggsAnalysis/Skimming/interface/HiggsToWW2LeptonsSkim.h @@ -3,7 +3,7 @@ /** \class HWWFilter * - * + * * This class is an EDFilter choosing reconstructed di-tracks * * @@ -23,6 +23,9 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" + class HiggsToWW2LeptonsSkim : public edm::EDFilter { public: explicit HiggsToWW2LeptonsSkim(const edm::ParameterSet&); @@ -40,12 +43,11 @@ class HiggsToWW2LeptonsSkim : public edm::EDFilter { unsigned int nAccepted_; // Reco samples - edm::InputTag recTrackLabel; - edm::InputTag theGLBMuonLabel; - edm::InputTag theGsfELabel; + edm::EDGetTokenT theGLBMuonToken; + edm::EDGetTokenT theGsfEToken; }; #endif - + diff --git a/HiggsAnalysis/Skimming/interface/HiggsToZZ4LeptonsPreFilter.h b/HiggsAnalysis/Skimming/interface/HiggsToZZ4LeptonsPreFilter.h index 44d18d7133d64..d729f5ae6d343 100644 --- a/HiggsAnalysis/Skimming/interface/HiggsToZZ4LeptonsPreFilter.h +++ b/HiggsAnalysis/Skimming/interface/HiggsToZZ4LeptonsPreFilter.h @@ -23,8 +23,10 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" + class HiggsToZZ4LeptonsPreFilter : public edm::EDFilter { - + public: // Constructor explicit HiggsToZZ4LeptonsPreFilter(const edm::ParameterSet&); @@ -38,9 +40,11 @@ class HiggsToZZ4LeptonsPreFilter : public edm::EDFilter { private: int evt, ikept; - + bool debug; int leptonFlavour; + + edm::EDGetTokenT genToken; }; #endif diff --git a/HiggsAnalysis/Skimming/interface/HiggsToZZ4LeptonsSkim.h b/HiggsAnalysis/Skimming/interface/HiggsToZZ4LeptonsSkim.h index a33dccd8cb3b7..ca0f91dc647b8 100644 --- a/HiggsAnalysis/Skimming/interface/HiggsToZZ4LeptonsSkim.h +++ b/HiggsAnalysis/Skimming/interface/HiggsToZZ4LeptonsSkim.h @@ -5,7 +5,7 @@ * * * Filter to select 4 lepton events based on the - * 1 or 2 electron or 1 or 2 muon HLT trigger, + * 1 or 2 electron or 1 or 2 muon HLT trigger, * and four leptons (no flavour requirement). * No charge requirements are applied on event. * @@ -25,8 +25,11 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" +#include +#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" + class HiggsToZZ4LeptonsSkim : public edm::EDFilter { - + public: // Constructor explicit HiggsToZZ4LeptonsSkim(const edm::ParameterSet&); @@ -49,9 +52,8 @@ class HiggsToZZ4LeptonsSkim : public edm::EDFilter { int nLeptonMin; // Reco samples - edm::InputTag recTrackLabel; - edm::InputTag theGLBMuonLabel; - edm::InputTag theGsfELabel; + edm::EDGetTokenT theGLBMuonToken; + edm::EDGetTokenT theGsfEToken; }; #endif diff --git a/HiggsAnalysis/Skimming/interface/HiggsToZZ4LeptonsSkimEff.h b/HiggsAnalysis/Skimming/interface/HiggsToZZ4LeptonsSkimEff.h index bda44731347e6..a71572f73fd79 100644 --- a/HiggsAnalysis/Skimming/interface/HiggsToZZ4LeptonsSkimEff.h +++ b/HiggsAnalysis/Skimming/interface/HiggsToZZ4LeptonsSkimEff.h @@ -22,8 +22,12 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" + class HiggsToZZ4LeptonsSkimEff : public edm::EDAnalyzer { - + public: // Constructor explicit HiggsToZZ4LeptonsSkimEff(const edm::ParameterSet&); @@ -46,9 +50,9 @@ class HiggsToZZ4LeptonsSkimEff : public edm::EDAnalyzer { int nFourE, nFourM, nTwoETwoM, nFourL, nTau; // Reco samples - edm::InputTag recTrackLabel; - edm::InputTag theGLBMuonLabel; - edm::InputTag thePixelGsfELabel; + edm::EDGetTokenT theGLBMuonToken; + edm::EDGetTokenT theGsfEToken; + edm::EDGetTokenT genToken; }; #endif diff --git a/HiggsAnalysis/Skimming/src/HeavyChHiggsToTauNuSkim.cc b/HiggsAnalysis/Skimming/src/HeavyChHiggsToTauNuSkim.cc index c8dc3c1535f8b..f4e4d8d76d3fc 100644 --- a/HiggsAnalysis/Skimming/src/HeavyChHiggsToTauNuSkim.cc +++ b/HiggsAnalysis/Skimming/src/HeavyChHiggsToTauNuSkim.cc @@ -1,6 +1,6 @@ /** \class HeavyChHiggsToTauNuSkim * - * + * * This class is an EDFilter for heavy H+->taunu events * * \author Sami Lehti - HIP Helsinki @@ -9,12 +9,10 @@ #include "HiggsAnalysis/Skimming/interface/HeavyChHiggsToTauNuSkim.h" -#include "DataFormats/BTauReco/interface/IsolatedTauTagInfo.h" #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" #include "DataFormats/BTauReco/interface/JetTag.h" //#include "DataFormats/BTauReco/interface/JetTagFwd.h" #include "DataFormats/JetReco/interface/Jet.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" #include @@ -30,8 +28,8 @@ HeavyChHiggsToTauNuSkim::HeavyChHiggsToTauNuSkim(const edm::ParameterSet& iConfi // Local Debug flag debug = iConfig.getParameter("DebugHeavyChHiggsToTauNuSkim"); - hltTauLabel = iConfig.getParameter("HLTTauCollection"); - jetLabel = iConfig.getParameter("JetTagCollection"); + hltTauToken = consumes(iConfig.getParameter("HLTTauCollection")); + jetToken = consumes(iConfig.getParameter("JetTagCollection")); minNumberOfjets = iConfig.getParameter("minNumberOfJets"); jetEtMin = iConfig.getParameter("jetEtMin"); jetEtaMin = iConfig.getParameter("jetEtaMin"); @@ -45,7 +43,7 @@ HeavyChHiggsToTauNuSkim::HeavyChHiggsToTauNuSkim(const edm::ParameterSet& iConfi HeavyChHiggsToTauNuSkim::~HeavyChHiggsToTauNuSkim(){ - edm::LogVerbatim("HeavyChHiggsToTauNuSkim") + edm::LogVerbatim("HeavyChHiggsToTauNuSkim") << " Number_events_read " << nEvents << " Number_events_kept " << nSelectedEvents << " Efficiency " << ((double)nSelectedEvents)/((double) nEvents + 0.01) << std::endl; @@ -58,7 +56,7 @@ bool HeavyChHiggsToTauNuSkim::filter(edm::Event& iEvent, const edm::EventSetup& nEvents++; Handle tauTagL3Handle; - iEvent.getByLabel(hltTauLabel, tauTagL3Handle); + iEvent.getByToken(hltTauToken, tauTagL3Handle); if ( !tauTagL3Handle.isValid() ) return false; @@ -77,18 +75,18 @@ bool HeavyChHiggsToTauNuSkim::filter(edm::Event& iEvent, const edm::EventSetup& } } } - + if (maxEt == 0) return false; // jets - - Handle jetHandle; - iEvent.getByLabel(jetLabel,jetHandle); - + + Handle jetHandle; + iEvent.getByToken(jetToken,jetHandle); + if ( !jetHandle.isValid() ) return false; - + bool accepted = false; - + if (jetHandle.isValid() ) { int nJets = 0; const reco::CaloJetCollection & jets = *(jetHandle.product()); @@ -98,13 +96,13 @@ bool HeavyChHiggsToTauNuSkim::filter(edm::Event& iEvent, const edm::EventSetup& iJet->eta() > jetEtaMin && iJet->eta() < jetEtaMax ) { double DR = deltaR(theTau.eta(),iJet->eta(),theTau.phi(),iJet->phi()); - if (DR > minDRFromTau) nJets++; + if (DR > minDRFromTau) nJets++; } } if (nJets >= minNumberOfjets) { accepted = true; nSelectedEvents++; - } + } } return accepted; } diff --git a/HiggsAnalysis/Skimming/src/HiggsTo2GammaSkim.cc b/HiggsAnalysis/Skimming/src/HiggsTo2GammaSkim.cc index 1a72d40dd0fc0..2661fef103cca 100644 --- a/HiggsAnalysis/Skimming/src/HiggsTo2GammaSkim.cc +++ b/HiggsAnalysis/Skimming/src/HiggsTo2GammaSkim.cc @@ -1,5 +1,5 @@ -/* \class HiggsTo2GammaSkim +/* \class HiggsTo2GammaSkim * * Consult header file for description * @@ -19,7 +19,6 @@ // Photons: #include -#include // C++ #include @@ -37,7 +36,7 @@ HiggsTo2GammaSkim::HiggsTo2GammaSkim(const edm::ParameterSet& pset) { debug = pset.getParameter("DebugHiggsTo2GammaSkim"); // Reconstructed objects - thePhotonLabel = pset.getParameter("PhotonCollectionLabel"); + thePhotonToken = consumes(pset.getParameter("PhotonCollectionLabel")); // Minimum Pt for photons for skimming photon1MinPt = pset.getParameter("photon1MinimumPt"); @@ -53,9 +52,9 @@ HiggsTo2GammaSkim::HiggsTo2GammaSkim(const edm::ParameterSet& pset) { // Destructor HiggsTo2GammaSkim::~HiggsTo2GammaSkim() { - edm::LogVerbatim("HiggsTo2GammaSkim") - << " Number_events_read " << nEvents - << " Number_events_kept " << nSelectedEvents + edm::LogVerbatim("HiggsTo2GammaSkim") + << " Number_events_read " << nEvents + << " Number_events_kept " << nSelectedEvents << " Efficiency " << ((double)nSelectedEvents)/((double) nEvents + 0.01) << std::endl; } @@ -76,25 +75,25 @@ bool HiggsTo2GammaSkim::filter(edm::Event& event, const edm::EventSetup& setup ) // Get the photon collection from the event edm::Handle photonHandle; - event.getByLabel(thePhotonLabel.label(),photonHandle); + event.getByToken(thePhotonToken,photonHandle); if ( photonHandle.isValid() ) { - + const reco::PhotonCollection* phoCollection = photonHandle.product(); reco::PhotonCollection::const_iterator photons; - // Loop over photon collections and count how many photons there are, + // Loop over photon collections and count how many photons there are, // and how many are above the thresholds // Question: do we need to take the reconstructed primary vertex at this point? // Here, I assume that the et is taken with respect to the nominal vertex (0,0,0). for ( photons = phoCollection->begin(); photons != phoCollection->end(); ++photons ) { - float et_p = photons->et(); + float et_p = photons->et(); if ( et_p > photon1MinPt) nPhotons++; } } - + // Make decision: if ( nPhotons >= nPhotonMin ) keepEvent = true; diff --git a/HiggsAnalysis/Skimming/src/HiggsToWW2LeptonsSkim.cc b/HiggsAnalysis/Skimming/src/HiggsToWW2LeptonsSkim.cc index 8e283904dbbb7..10dd31d66e8cf 100644 --- a/HiggsAnalysis/Skimming/src/HiggsToWW2LeptonsSkim.cc +++ b/HiggsAnalysis/Skimming/src/HiggsToWW2LeptonsSkim.cc @@ -1,6 +1,6 @@ /** \class HiggsToWW2LeptonsSkim * - * + * * This class is an EDFilter for HWW events * * @@ -11,15 +11,12 @@ #include "HiggsAnalysis/Skimming/interface/HiggsToWW2LeptonsSkim.h" #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/TrackReco/interface/Track.h" // Muons: #include // Electrons #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" #include "DataFormats/Candidate/interface/Candidate.h" @@ -37,9 +34,8 @@ HiggsToWW2LeptonsSkim::HiggsToWW2LeptonsSkim(const edm::ParameterSet& iConfig) : { // Reconstructed objects - recTrackLabel = iConfig.getParameter("RecoTrackLabel"); - theGLBMuonLabel = iConfig.getParameter("GlobalMuonCollectionLabel"); - theGsfELabel = iConfig.getParameter("ElectronCollectionLabel"); + theGLBMuonToken = consumes(iConfig.getParameter("GlobalMuonCollectionLabel")); + theGsfEToken = consumes(iConfig.getParameter("ElectronCollectionLabel")); singleTrackPtMin_ = iConfig.getParameter("SingleTrackPtMin"); diTrackPtMin_ = iConfig.getParameter("DiTrackPtMin"); @@ -52,12 +48,12 @@ HiggsToWW2LeptonsSkim::~HiggsToWW2LeptonsSkim() { } -void HiggsToWW2LeptonsSkim::endJob() +void HiggsToWW2LeptonsSkim::endJob() { - edm::LogVerbatim("HiggsToWW2LeptonsSkim") - << "Events read " << nEvents_ - << " Events accepted " << nAccepted_ - << "\nEfficiency " << ((double)nAccepted_)/((double)nEvents_) + edm::LogVerbatim("HiggsToWW2LeptonsSkim") + << "Events read " << nEvents_ + << " Events accepted " << nAccepted_ + << "\nEfficiency " << ((double)nAccepted_)/((double)nEvents_) << std::endl; } @@ -77,8 +73,8 @@ bool HiggsToWW2LeptonsSkim::filter(edm::Event& event, const edm::EventSetup& iSe // Get the muon track collection from the event edm::Handle muTracks; - event.getByLabel(theGLBMuonLabel.label(), muTracks); - + event.getByToken(theGLBMuonToken, muTracks); + if ( muTracks.isValid() ) { reco::TrackCollection::const_iterator muons; @@ -88,22 +84,22 @@ bool HiggsToWW2LeptonsSkim::filter(edm::Event& event, const edm::EventSetup& iSe for ( muons = muTracks->begin(); muons != muTracks->end(); ++muons ) { if ( muons->eta() > etaMin_ && muons->eta() < etaMax_ ) { if ( muons->pt() > singleTrackPtMin_ ) accepted1 = true; - if ( muons->pt() > diTrackPtMin_ ) nTrackOver2ndCut++; + if ( muons->pt() > diTrackPtMin_ ) nTrackOver2ndCut++; } } - } + } // Now look at electrons: // Get the electron track collection from the event edm::Handle pTracks; - event.getByLabel(theGsfELabel.label(),pTracks); + event.getByToken(theGsfEToken,pTracks); if ( pTracks.isValid() ) { const reco::GsfElectronCollection* eTracks = pTracks.product(); - + reco::GsfElectronCollection::const_iterator electrons; // Loop over electron collections and count how many muons there are, diff --git a/HiggsAnalysis/Skimming/src/HiggsToZZ4LeptonsPreFilter.cc b/HiggsAnalysis/Skimming/src/HiggsToZZ4LeptonsPreFilter.cc index 99ebd7d930966..453175e3c0b74 100644 --- a/HiggsAnalysis/Skimming/src/HiggsToZZ4LeptonsPreFilter.cc +++ b/HiggsAnalysis/Skimming/src/HiggsToZZ4LeptonsPreFilter.cc @@ -1,5 +1,5 @@ -/* \class HiggsTo4LeptonsPreFilter +/* \class HiggsTo4LeptonsPreFilter * * Consult header file for description * @@ -18,7 +18,6 @@ #include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/Candidate/interface/CandMatchMap.h" #include "DataFormats/Common/interface/AssociationVector.h" -#include "DataFormats/HepMCCandidate/interface/GenParticle.h" // C++ #include @@ -41,6 +40,7 @@ HiggsToZZ4LeptonsPreFilter::HiggsToZZ4LeptonsPreFilter(const edm::ParameterSet& // Local Debug flag debug = pset.getParameter("DebugHiggsToZZ4LeptonsPreFilter"); leptonFlavour = pset.getParameter("HiggsToZZ4LeptonsPreFilterLeptonFlavour"); + genToken = consumes(edm::InputTag("genParticles")); ikept = 0; evt = 0; @@ -67,10 +67,9 @@ bool HiggsToZZ4LeptonsPreFilter::filter(edm::Event& event, const edm::EventSetup bool FourM = false; bool TwoETwoM = false; - // get gen particle candidates + // get gen particle candidates Handle genParticles; - - event.getByLabel("genParticles", genParticles); + event.getByToken(genToken, genParticles); if ( genParticles.isValid() ) { @@ -88,7 +87,7 @@ bool HiggsToZZ4LeptonsPreFilter::filter(edm::Event& event, const edm::EventSetup } } // Electrons: - if ( mcIter->pdgId() == 11 || mcIter->pdgId() == -11) + if ( mcIter->pdgId() == 11 || mcIter->pdgId() == -11) // Mother is a Z if ( mcIter->mother()->pdgId() == 23 ) { // In fiducial volume: @@ -97,16 +96,16 @@ bool HiggsToZZ4LeptonsPreFilter::filter(edm::Event& event, const edm::EventSetup } } - + if (nElec > 3) FourE = true; if (nMuon > 3) FourM = true; if (nMuon > 1 && nElec > 1) TwoETwoM = true; if ( FourE || FourM || TwoETwoM ) FourL = true; - if ( leptonFlavour == 0 && FourL ) keepEvent = true; - if ( leptonFlavour == 1 && FourM ) keepEvent = true; - if ( leptonFlavour == 2 && FourE ) keepEvent = true; - if ( leptonFlavour == 3 && TwoETwoM ) keepEvent = true; + if ( leptonFlavour == 0 && FourL ) keepEvent = true; + if ( leptonFlavour == 1 && FourM ) keepEvent = true; + if ( leptonFlavour == 2 && FourE ) keepEvent = true; + if ( leptonFlavour == 3 && TwoETwoM ) keepEvent = true; } diff --git a/HiggsAnalysis/Skimming/src/HiggsToZZ4LeptonsSkim.cc b/HiggsAnalysis/Skimming/src/HiggsToZZ4LeptonsSkim.cc index 45171a78940ec..9893eabae9b2a 100644 --- a/HiggsAnalysis/Skimming/src/HiggsToZZ4LeptonsSkim.cc +++ b/HiggsAnalysis/Skimming/src/HiggsToZZ4LeptonsSkim.cc @@ -1,5 +1,5 @@ -/* \class HiggsTo4LeptonsSkim +/* \class HiggsTo4LeptonsSkim * * Consult header file for description * @@ -19,7 +19,6 @@ // Electrons #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" // C++ #include @@ -37,9 +36,8 @@ HiggsToZZ4LeptonsSkim::HiggsToZZ4LeptonsSkim(const edm::ParameterSet& pset) { debug = pset.getParameter("DebugHiggsToZZ4LeptonsSkim"); // Reconstructed objects - recTrackLabel = pset.getParameter("RecoTrackLabel"); - theGLBMuonLabel = pset.getParameter("GlobalMuonCollectionLabel"); - theGsfELabel = pset.getParameter("ElectronCollectionLabel"); + theGLBMuonToken = consumes(pset.getParameter("GlobalMuonCollectionLabel")); + theGsfEToken = consumes(pset.getParameter("ElectronCollectionLabel")); // Minimum Pt for leptons for skimming stiffMinPt = pset.getParameter("stiffMinimumPt"); @@ -56,9 +54,9 @@ HiggsToZZ4LeptonsSkim::HiggsToZZ4LeptonsSkim(const edm::ParameterSet& pset) { // Destructor HiggsToZZ4LeptonsSkim::~HiggsToZZ4LeptonsSkim() { - edm::LogVerbatim("HiggsToZZ4LeptonsSkim") - << " Number_events_read " << nEvents - << " Number_events_kept " << nSelectedEvents + edm::LogVerbatim("HiggsToZZ4LeptonsSkim") + << " Number_events_read " << nEvents + << " Number_events_kept " << nSelectedEvents << " Efficiency " << ((double)nSelectedEvents)/((double) nEvents + 0.01) << std::endl; } @@ -74,45 +72,44 @@ bool HiggsToZZ4LeptonsSkim::filter(edm::Event& event, const edm::EventSetup& set bool keepEvent = false; int nStiffLeptons = 0; int nLeptons = 0; - + // First look at muons: // Get the muon track collection from the event edm::Handle muTracks; - event.getByLabel(theGLBMuonLabel.label(), muTracks); + event.getByToken(theGLBMuonToken, muTracks); + + if ( muTracks.isValid() ) { - if ( muTracks.isValid() ) { - reco::TrackCollection::const_iterator muons; - - // Loop over muon collections and count how many muons there are, + + // Loop over muon collections and count how many muons there are, // and how many are above threshold for ( muons = muTracks->begin(); muons != muTracks->end(); ++muons ) { - if ( muons->pt() > stiffMinPt) nStiffLeptons++; - if ( muons->pt() > softMinPt) nLeptons++; - } - } - + if ( muons->pt() > stiffMinPt) nStiffLeptons++; + if ( muons->pt() > softMinPt) nLeptons++; + } + } + // Now look at electrons: // Get the electron track collection from the event edm::Handle pTracks; + event.getByToken(theGsfEToken,pTracks); - event.getByLabel(theGsfELabel.label(),pTracks); - - if ( pTracks.isValid() ) { + if ( pTracks.isValid() ) { const reco::GsfElectronCollection* eTracks = pTracks.product(); reco::GsfElectronCollection::const_iterator electrons; - // Loop over electron collections and count how many muons there are, + // Loop over electron collections and count how many muons there are, // and how many are above threshold for ( electrons = eTracks->begin(); electrons != eTracks->end(); ++electrons ) { - float pt_e = electrons->pt(); - if ( pt_e > stiffMinPt) nStiffLeptons++; - if ( pt_e > softMinPt) nLeptons++; + float pt_e = electrons->pt(); + if ( pt_e > stiffMinPt) nStiffLeptons++; + if ( pt_e > softMinPt) nLeptons++; } } diff --git a/HiggsAnalysis/Skimming/src/HiggsToZZ4LeptonsSkimEff.cc b/HiggsAnalysis/Skimming/src/HiggsToZZ4LeptonsSkimEff.cc index 2198dbdabb21f..3e9f82aaf9372 100644 --- a/HiggsAnalysis/Skimming/src/HiggsToZZ4LeptonsSkimEff.cc +++ b/HiggsAnalysis/Skimming/src/HiggsToZZ4LeptonsSkimEff.cc @@ -1,5 +1,5 @@ -/* \class HiggsTo4LeptonsSkimEff +/* \class HiggsTo4LeptonsSkimEff * * Consult header file for description * @@ -19,13 +19,11 @@ // Electrons #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" // Candidate handling #include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/Candidate/interface/CandMatchMap.h" #include "DataFormats/Common/interface/AssociationVector.h" -#include "DataFormats/HepMCCandidate/interface/GenParticle.h" // C++ @@ -44,9 +42,9 @@ HiggsToZZ4LeptonsSkimEff::HiggsToZZ4LeptonsSkimEff(const edm::ParameterSet& pset debug = pset.getParameter("DebugHiggsToZZ4LeptonsSkim"); // Reconstructed objects - recTrackLabel = pset.getParameter("RecoTrackLabel"); - theGLBMuonLabel = pset.getParameter("GlobalMuonCollectionLabel"); - thePixelGsfELabel = pset.getParameter("ElectronCollectionLabel"); + theGLBMuonToken = consumes(pset.getParameter("GlobalMuonCollectionLabel")); + theGsfEToken = consumes(pset.getParameter("ElectronCollectionLabel")); + genToken = consumes(edm::InputTag("genParticles")); // Minimum Pt for leptons for skimming // Minimum Pt for leptons for skimming @@ -68,24 +66,24 @@ HiggsToZZ4LeptonsSkimEff::~HiggsToZZ4LeptonsSkimEff() { std::cout << "Number of events read " << nEvents << std::endl; std::cout << "*** Efficiency for the various subsamples *** " << endl; - std::cout << "Four leptons: " - << " pres " << nFourL + std::cout << "Four leptons: " + << " pres " << nFourL << " kept " << nSelFourL << " eff " << ((double)nSelFourL)/((double) nFourL + 0.0001) << std::endl; std::cout << "Four muons: " - << " pres " << nFourM + << " pres " << nFourM << " kept " << nSelFourM << " eff " << ((double)nSelFourM)/((double) nFourM + 0.0001) << std::endl; std::cout << "Four elecs: " - << " pres " << nFourE + << " pres " << nFourE << " kept " << nSelFourE << " eff " << ((double)nSelFourE)/((double) nFourE + 0.0001) << std::endl; std::cout << "2 elec 2 mu: " - << " pres " << nTwoETwoM + << " pres " << nTwoETwoM << " kept " << nSelTwoETwoM << " eff " << ((double)nSelTwoETwoM)/((double) nTwoETwoM + 0.0001) << std::endl; std::cout << "with taus: " - << " pres " << nTau + << " pres " << nTau << " kept " << nSelTau << " eff " << ((double)nSelTau)/((double) nTau + 0.0001) << std::endl; @@ -115,7 +113,7 @@ void HiggsToZZ4LeptonsSkimEff::analyze(const edm::Event& event, const edm::Event // get gen particle candidates edm::Handle genCandidates; - event.getByLabel("genParticleCandidates", genCandidates); + event.getByToken(genToken, genCandidates); for ( CandidateCollection::const_iterator mcIter=genCandidates->begin(); mcIter!=genCandidates->end(); ++mcIter ) { @@ -145,7 +143,7 @@ void HiggsToZZ4LeptonsSkimEff::analyze(const edm::Event& event, const edm::Event } } - + if (nElec > 3) { isFourE = true; nFourE++; @@ -181,43 +179,43 @@ void HiggsToZZ4LeptonsSkimEff::analyze(const edm::Event& event, const edm::Event // Get the muon track collection from the event edm::Handle muTracks; - event.getByLabel(theGLBMuonLabel.label(), muTracks); - - if ( muTracks.isValid() ) { + event.getByToken(theGLBMuonToken, muTracks); + + if ( muTracks.isValid() ) { reco::TrackCollection::const_iterator muons; - - // Loop over muon collections and count how many muons there are, + + // Loop over muon collections and count how many muons there are, // and how many are above threshold for ( muons = muTracks->begin(); muons != muTracks->end(); ++muons ) { float pt_mu = muons->pt(); - if ( pt_mu > stiffMinPt ) nStiffLeptons++; - if ( pt_mu > softMinPt ) nLeptons++; - } - } - + if ( pt_mu > stiffMinPt ) nStiffLeptons++; + if ( pt_mu > softMinPt ) nLeptons++; + } + } + // Now look at electrons: // Get the electron track collection from the event edm::Handle pTracks; - event.getByLabel(thePixelGsfELabel.label(),pTracks); + event.getByToken(theGsfEToken,pTracks); - if ( pTracks.isValid() ) { + if ( pTracks.isValid() ) { const reco::GsfElectronCollection* eTracks = pTracks.product(); reco::GsfElectronCollection::const_iterator electrons; - // Loop over electron collections and count how many muons there are, + // Loop over electron collections and count how many muons there are, // and how many are above threshold for ( electrons = eTracks->begin(); electrons != eTracks->end(); ++electrons ) { - float pt_e = electrons->pt(); - if ( pt_e > stiffMinPt ) nStiffLeptons++; - if ( pt_e > softMinPt ) nLeptons++; + float pt_e = electrons->pt(); + if ( pt_e > stiffMinPt ) nStiffLeptons++; + if ( pt_e > softMinPt ) nLeptons++; } } - + // Make decision: if ( nStiffLeptons >= nStiffLeptonMin && nLeptons >= nLeptonMin) { keepEvent = true;