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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, 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)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 31 of file HiggsToZZ4LeptonsSkim.h.

Constructor & Destructor Documentation

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

Definition at line 33 of file HiggsToZZ4LeptonsSkim.cc.

References debug, edm::ParameterSet::getParameter(), and nEvents.

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

Definition at line 55 of file HiggsToZZ4LeptonsSkim.cc.

References nEvents.

55  {
56 
57  edm::LogVerbatim("HiggsToZZ4LeptonsSkim")
58  << " Number_events_read " << nEvents
59  << " Number_events_kept " << nSelectedEvents
60  << " Efficiency " << ((double)nSelectedEvents)/((double) nEvents + 0.01) << std::endl;
61 }

Member Function Documentation

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

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

Definition at line 66 of file HiggsToZZ4LeptonsSkim.cc.

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

66  {
67 
68  nEvents++;
69 
71 
72  bool keepEvent = false;
73  int nStiffLeptons = 0;
74  int nLeptons = 0;
75 
76 
77  // First look at muons:
78 
79  // Get the muon track collection from the event
81  event.getByToken(theGLBMuonToken, muTracks);
82 
83  if ( muTracks.isValid() ) {
84 
85  reco::TrackCollection::const_iterator muons;
86 
87  // Loop over muon collections and count how many muons there are,
88  // and how many are above threshold
89  for ( muons = muTracks->begin(); muons != muTracks->end(); ++muons ) {
90  if ( muons->pt() > stiffMinPt) nStiffLeptons++;
91  if ( muons->pt() > softMinPt) nLeptons++;
92  }
93  }
94 
95  // Now look at electrons:
96 
97  // Get the electron track collection from the event
99  event.getByToken(theGsfEToken,pTracks);
100 
101  if ( pTracks.isValid() ) {
102 
103  const reco::GsfElectronCollection* eTracks = pTracks.product();
104 
105  reco::GsfElectronCollection::const_iterator electrons;
106 
107  // Loop over electron collections and count how many muons there are,
108  // and how many are above threshold
109  for ( electrons = eTracks->begin(); electrons != eTracks->end(); ++electrons ) {
110  float pt_e = electrons->pt();
111  if ( pt_e > stiffMinPt) nStiffLeptons++;
112  if ( pt_e > softMinPt) nLeptons++;
113  }
114  }
115 
116  // Make decision:
117  if ( nStiffLeptons >= nStiffLeptonMin && nLeptons >= nLeptonMin) keepEvent = true;
118 
119  if (keepEvent) nSelectedEvents++;
120 
121  return keepEvent;
122 }
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:15
edm::EDGetTokenT< reco::TrackCollection > theGLBMuonToken
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
bool isValid() const
Definition: HandleBase.h:74
T const * product() const
Definition: Handle.h:74
edm::EDGetTokenT< reco::GsfElectronCollection > theGsfEToken

Member Data Documentation

bool HiggsToZZ4LeptonsSkim::debug
private
int HiggsToZZ4LeptonsSkim::nEvents
private

Definition at line 45 of file HiggsToZZ4LeptonsSkim.h.

Referenced by looper.Looper::loop().

int HiggsToZZ4LeptonsSkim::nLeptonMin
private

Definition at line 52 of file HiggsToZZ4LeptonsSkim.h.

int HiggsToZZ4LeptonsSkim::nSelectedEvents
private

Definition at line 45 of file HiggsToZZ4LeptonsSkim.h.

int HiggsToZZ4LeptonsSkim::nStiffLeptonMin
private

Definition at line 51 of file HiggsToZZ4LeptonsSkim.h.

float HiggsToZZ4LeptonsSkim::softMinPt
private

Definition at line 50 of file HiggsToZZ4LeptonsSkim.h.

float HiggsToZZ4LeptonsSkim::stiffMinPt
private

Definition at line 49 of file HiggsToZZ4LeptonsSkim.h.

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

Definition at line 55 of file HiggsToZZ4LeptonsSkim.h.

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

Definition at line 56 of file HiggsToZZ4LeptonsSkim.h.