Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:24:10

0001 #ifndef PhysicsTools_PatExamples_interface_WPlusJetsEventSelector_h
0002 #define PhysicsTools_PatExamples_interface_WPlusJetsEventSelector_h
0003 
0004 #ifndef __GCCXML__
0005 #include "FWCore/Framework/interface/ConsumesCollector.h"
0006 #endif
0007 #include "PhysicsTools/SelectorUtils/interface/EventSelector.h"
0008 #include "FWCore/Utilities/interface/InputTag.h"
0009 #include "DataFormats/PatCandidates/interface/Jet.h"
0010 #include "DataFormats/PatCandidates/interface/Muon.h"
0011 #include "DataFormats/PatCandidates/interface/Electron.h"
0012 #include "DataFormats/PatCandidates/interface/MET.h"
0013 #include "DataFormats/PatCandidates/interface/TriggerEvent.h"
0014 #include "PhysicsTools/SelectorUtils/interface/ElectronVPlusJetsIDSelectionFunctor.h"
0015 #include "PhysicsTools/SelectorUtils/interface/MuonVPlusJetsIDSelectionFunctor.h"
0016 #include "PhysicsTools/SelectorUtils/interface/JetIDSelectionFunctor.h"
0017 #include "PhysicsTools/SelectorUtils/interface/PFJetIDSelectionFunctor.h"
0018 #include "PhysicsTools/SelectorUtils/interface/PVSelector.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 #include "DataFormats/Candidate/interface/ShallowClonePtrCandidate.h"
0021 
0022 class WPlusJetsEventSelector : public EventSelector {
0023 public:
0024   WPlusJetsEventSelector() {}
0025 #ifndef __GCCXML__
0026   WPlusJetsEventSelector(edm::ParameterSet const& params, edm::ConsumesCollector&& iC)
0027       : WPlusJetsEventSelector(params) {
0028     muonToken_ = iC.mayConsume<std::vector<pat::Muon> >(muonTag_);
0029     electronToken_ = iC.mayConsume<std::vector<pat::Electron> >(electronTag_);
0030     jetToken_ = iC.mayConsume<std::vector<pat::Jet> >(jetTag_);
0031     metToken_ = iC.mayConsume<std::vector<pat::MET> >(metTag_);
0032     trigToken_ = iC.mayConsume<pat::TriggerEvent>(trigTag_);
0033     muonIdTight_ = MuonVPlusJetsIDSelectionFunctor(params.getParameter<edm::ParameterSet>("muonIdTight"), iC);
0034     electronIdTight_ =
0035         ElectronVPlusJetsIDSelectionFunctor(params.getParameter<edm::ParameterSet>("electronIdTight"), iC);
0036     muonIdLoose_ = MuonVPlusJetsIDSelectionFunctor(params.getParameter<edm::ParameterSet>("muonIdLoose"), iC);
0037     electronIdLoose_ =
0038         ElectronVPlusJetsIDSelectionFunctor(params.getParameter<edm::ParameterSet>("electronIdLoose"), iC);
0039     jetIdLoose_ = JetIDSelectionFunctor(params.getParameter<edm::ParameterSet>("jetIdLoose"), iC);
0040     pfjetIdLoose_ = PFJetIDSelectionFunctor(params.getParameter<edm::ParameterSet>("pfjetIdLoose"), iC);
0041   }
0042 #endif
0043   WPlusJetsEventSelector(edm::ParameterSet const& params);
0044 
0045   virtual void scaleJets(double scale) { jetScale_ = scale; }
0046 
0047   bool operator()(edm::EventBase const& t, pat::strbitset& ret) override;
0048   using EventSelector::operator();
0049 
0050   std::vector<reco::ShallowClonePtrCandidate> const& selectedJets() const { return selectedJets_; }
0051   std::vector<reco::ShallowClonePtrCandidate> const& cleanedJets() const { return cleanedJets_; }
0052   std::vector<reco::ShallowClonePtrCandidate> const& selectedElectrons() const { return selectedElectrons_; }
0053   std::vector<reco::ShallowClonePtrCandidate> const& selectedMuons() const { return selectedMuons_; }
0054   reco::ShallowClonePtrCandidate const& selectedMET() const { return met_; }
0055 
0056   void printSelectors(std::ostream& out) const {
0057     out << "PV Selector: " << std::endl;
0058     pvSelector_.print(out);
0059     out << "Muon ID Tight Selector: " << std::endl;
0060     muonIdTight_.print(out);
0061     out << "Electron ID Tight Selector: " << std::endl;
0062     electronIdTight_.print(out);
0063     out << "Muon ID Loose Selector: " << std::endl;
0064     muonIdLoose_.print(out);
0065     out << "Electron ID Loose Selector: " << std::endl;
0066     electronIdLoose_.print(out);
0067     out << "Calo Jet Selector: " << std::endl;
0068     jetIdLoose_.print(out);
0069     out << "PF Jet Selector: " << std::endl;
0070     pfjetIdLoose_.print(out);
0071   }
0072 
0073 protected:
0074   edm::InputTag muonTag_;
0075 #ifndef __GCCXML__
0076   edm::EDGetTokenT<std::vector<pat::Muon> > muonToken_;
0077 #endif
0078   edm::InputTag electronTag_;
0079 #ifndef __GCCXML__
0080   edm::EDGetTokenT<std::vector<pat::Electron> > electronToken_;
0081 #endif
0082   edm::InputTag jetTag_;
0083 #ifndef __GCCXML__
0084   edm::EDGetTokenT<std::vector<pat::Jet> > jetToken_;
0085 #endif
0086   edm::InputTag metTag_;
0087 #ifndef __GCCXML__
0088   edm::EDGetTokenT<std::vector<pat::MET> > metToken_;
0089 #endif
0090   edm::InputTag trigTag_;
0091 #ifndef __GCCXML__
0092   edm::EDGetTokenT<pat::TriggerEvent> trigToken_;
0093 #endif
0094 
0095   std::string muTrig_;
0096   std::string eleTrig_;
0097 
0098   std::vector<reco::ShallowClonePtrCandidate> selectedJets_;
0099   std::vector<reco::ShallowClonePtrCandidate> selectedMuons_;
0100   std::vector<reco::ShallowClonePtrCandidate> selectedElectrons_;
0101   std::vector<reco::ShallowClonePtrCandidate> looseMuons_;
0102   std::vector<reco::ShallowClonePtrCandidate> looseElectrons_;
0103   std::vector<reco::ShallowClonePtrCandidate> selectedMETs_;
0104   std::vector<reco::ShallowClonePtrCandidate> cleanedJets_;
0105   std::vector<reco::ShallowClonePtrCandidate> selectedElectrons2_;
0106   reco::ShallowClonePtrCandidate met_;
0107 
0108   PVSelector pvSelector_;
0109   MuonVPlusJetsIDSelectionFunctor muonIdTight_;
0110   ElectronVPlusJetsIDSelectionFunctor electronIdTight_;
0111   MuonVPlusJetsIDSelectionFunctor muonIdLoose_;
0112   ElectronVPlusJetsIDSelectionFunctor electronIdLoose_;
0113   JetIDSelectionFunctor jetIdLoose_;
0114   PFJetIDSelectionFunctor pfjetIdLoose_;
0115 
0116   int minJets_;
0117 
0118   double muJetDR_;
0119   double eleJetDR_;
0120 
0121   bool muPlusJets_;
0122   bool ePlusJets_;
0123 
0124   double muPtMin_;
0125   double muEtaMax_;
0126   double eleEtMin_;
0127   double eleEtaMax_;
0128 
0129   double muPtMinLoose_;
0130   double muEtaMaxLoose_;
0131   double eleEtMinLoose_;
0132   double eleEtaMaxLoose_;
0133 
0134   double jetPtMin_;
0135   double jetEtaMax_;
0136 
0137   double jetScale_;
0138 
0139   double metMin_;
0140 
0141   index_type inclusiveIndex_;
0142   index_type triggerIndex_;
0143   index_type pvIndex_;
0144   index_type lep1Index_;
0145   index_type lep2Index_;
0146   index_type lep3Index_;
0147   index_type lep4Index_;
0148   index_type metIndex_;
0149   index_type zvetoIndex_;
0150   index_type conversionIndex_;
0151   index_type cosmicIndex_;
0152   index_type jet1Index_;
0153   index_type jet2Index_;
0154   index_type jet3Index_;
0155   index_type jet4Index_;
0156   index_type jet5Index_;
0157 };
0158 
0159 #endif