CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HiggsToZZ4LeptonsSkim Class Reference

#include <HiggsToZZ4LeptonsSkim.h>

Inheritance diagram for HiggsToZZ4LeptonsSkim:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

bool filter (edm::Event &, const edm::EventSetup &) override
 Get event properties to send to builder to fill seed collection. More...
 
 HiggsToZZ4LeptonsSkim (const edm::ParameterSet &)
 
 ~HiggsToZZ4LeptonsSkim () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

bool debug
 
int nEvents
 
int nLeptonMin
 
int nSelectedEvents
 
int nStiffLeptonMin
 
float softMinPt
 
float stiffMinPt
 
edm::EDGetTokenT< reco::TrackCollectiontheGLBMuonToken
 
edm::EDGetTokenT< reco::GsfElectronCollectiontheGsfEToken
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 31 of file HiggsToZZ4LeptonsSkim.h.

Constructor & Destructor Documentation

◆ HiggsToZZ4LeptonsSkim()

HiggsToZZ4LeptonsSkim::HiggsToZZ4LeptonsSkim ( const edm::ParameterSet pset)
explicit

Definition at line 31 of file HiggsToZZ4LeptonsSkim.cc.

31  {
32  // Local Debug flag
33  debug = pset.getParameter<bool>("DebugHiggsToZZ4LeptonsSkim");
34 
35  // Reconstructed objects
36  theGLBMuonToken = consumes<reco::TrackCollection>(pset.getParameter<edm::InputTag>("GlobalMuonCollectionLabel"));
37  theGsfEToken = consumes<reco::GsfElectronCollection>(pset.getParameter<edm::InputTag>("ElectronCollectionLabel"));
38 
39  // Minimum Pt for leptons for skimming
40  stiffMinPt = pset.getParameter<double>("stiffMinimumPt");
41  softMinPt = pset.getParameter<double>("softMinimumPt");
42  nStiffLeptonMin = pset.getParameter<int>("nStiffLeptonMinimum");
43  nLeptonMin = pset.getParameter<int>("nLeptonMinimum");
44 
45  nEvents = 0;
46  nSelectedEvents = 0;
47 }

References debug, nEvents, and muonDTDigis_cfi::pset.

◆ ~HiggsToZZ4LeptonsSkim()

HiggsToZZ4LeptonsSkim::~HiggsToZZ4LeptonsSkim ( )
override

Definition at line 50 of file HiggsToZZ4LeptonsSkim.cc.

50  {
51  edm::LogVerbatim("HiggsToZZ4LeptonsSkim")
52  << " Number_events_read " << nEvents << " Number_events_kept " << nSelectedEvents << " Efficiency "
53  << ((double)nSelectedEvents) / ((double)nEvents + 0.01) << std::endl;
54 }

References nEvents.

Member Function Documentation

◆ filter()

bool HiggsToZZ4LeptonsSkim::filter ( edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

Get event properties to send to builder to fill seed collection.

Implements edm::EDFilter.

Definition at line 57 of file HiggsToZZ4LeptonsSkim.cc.

57  {
58  nEvents++;
59 
61 
62  bool keepEvent = false;
63  int nStiffLeptons = 0;
64  int nLeptons = 0;
65 
66  // First look at muons:
67 
68  // Get the muon track collection from the event
70  event.getByToken(theGLBMuonToken, muTracks);
71 
72  if (muTracks.isValid()) {
73  reco::TrackCollection::const_iterator muons;
74 
75  // Loop over muon collections and count how many muons there are,
76  // and how many are above threshold
77  for (muons = muTracks->begin(); muons != muTracks->end(); ++muons) {
78  if (muons->pt() > stiffMinPt)
79  nStiffLeptons++;
80  if (muons->pt() > softMinPt)
81  nLeptons++;
82  }
83  }
84 
85  // Now look at electrons:
86 
87  // Get the electron track collection from the event
89  event.getByToken(theGsfEToken, pTracks);
90 
91  if (pTracks.isValid()) {
92  const reco::GsfElectronCollection* eTracks = pTracks.product();
93 
94  reco::GsfElectronCollection::const_iterator electrons;
95 
96  // Loop over electron collections and count how many muons there are,
97  // and how many are above threshold
98  for (electrons = eTracks->begin(); electrons != eTracks->end(); ++electrons) {
99  float pt_e = electrons->pt();
100  if (pt_e > stiffMinPt)
101  nStiffLeptons++;
102  if (pt_e > softMinPt)
103  nLeptons++;
104  }
105  }
106 
107  // Make decision:
108  if (nStiffLeptons >= nStiffLeptonMin && nLeptons >= nLeptonMin)
109  keepEvent = true;
110 
111  if (keepEvent)
112  nSelectedEvents++;
113 
114  return keepEvent;
115 }

References pwdgSkimBPark_cfi::electrons, edm::HandleBase::isValid(), PDWG_BPHSkim_cff::muons, nEvents, and edm::Handle< T >::product().

Member Data Documentation

◆ debug

bool HiggsToZZ4LeptonsSkim::debug
private

◆ nEvents

int HiggsToZZ4LeptonsSkim::nEvents
private

Definition at line 43 of file HiggsToZZ4LeptonsSkim.h.

Referenced by looper.Looper::loop().

◆ nLeptonMin

int HiggsToZZ4LeptonsSkim::nLeptonMin
private

Definition at line 49 of file HiggsToZZ4LeptonsSkim.h.

◆ nSelectedEvents

int HiggsToZZ4LeptonsSkim::nSelectedEvents
private

Definition at line 43 of file HiggsToZZ4LeptonsSkim.h.

◆ nStiffLeptonMin

int HiggsToZZ4LeptonsSkim::nStiffLeptonMin
private

Definition at line 48 of file HiggsToZZ4LeptonsSkim.h.

◆ softMinPt

float HiggsToZZ4LeptonsSkim::softMinPt
private

Definition at line 47 of file HiggsToZZ4LeptonsSkim.h.

◆ stiffMinPt

float HiggsToZZ4LeptonsSkim::stiffMinPt
private

Definition at line 46 of file HiggsToZZ4LeptonsSkim.h.

◆ theGLBMuonToken

edm::EDGetTokenT<reco::TrackCollection> HiggsToZZ4LeptonsSkim::theGLBMuonToken
private

Definition at line 52 of file HiggsToZZ4LeptonsSkim.h.

◆ theGsfEToken

edm::EDGetTokenT<reco::GsfElectronCollection> HiggsToZZ4LeptonsSkim::theGsfEToken
private

Definition at line 53 of file HiggsToZZ4LeptonsSkim.h.

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
HiggsToZZ4LeptonsSkim::nLeptonMin
int nLeptonMin
Definition: HiggsToZZ4LeptonsSkim.h:49
edm::Handle::product
T const * product() const
Definition: Handle.h:70
HiggsToZZ4LeptonsSkim::debug
bool debug
Definition: HiggsToZZ4LeptonsSkim.h:45
reco::GsfElectronCollection
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
Definition: GsfElectronFwd.h:14
edm::Handle< reco::TrackCollection >
HiggsToZZ4LeptonsSkim::nStiffLeptonMin
int nStiffLeptonMin
Definition: HiggsToZZ4LeptonsSkim.h:48
HiggsToZZ4LeptonsSkim::theGLBMuonToken
edm::EDGetTokenT< reco::TrackCollection > theGLBMuonToken
Definition: HiggsToZZ4LeptonsSkim.h:52
HiggsToZZ4LeptonsSkim::nEvents
int nEvents
Definition: HiggsToZZ4LeptonsSkim.h:43
edm::LogVerbatim
Definition: MessageLogger.h:297
HiggsToZZ4LeptonsSkim::stiffMinPt
float stiffMinPt
Definition: HiggsToZZ4LeptonsSkim.h:46
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
HiggsToZZ4LeptonsSkim::softMinPt
float softMinPt
Definition: HiggsToZZ4LeptonsSkim.h:47
HiggsToZZ4LeptonsSkim::theGsfEToken
edm::EDGetTokenT< reco::GsfElectronCollection > theGsfEToken
Definition: HiggsToZZ4LeptonsSkim.h:53
HiggsToZZ4LeptonsSkim::nSelectedEvents
int nSelectedEvents
Definition: HiggsToZZ4LeptonsSkim.h:43
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27