CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual bool filter (edm::Event &, const edm::EventSetup &)
 Get event properties to send to builder to fill seed collection. More...
 
 HiggsToZZ4LeptonsSkim (const edm::ParameterSet &)
 
 ~HiggsToZZ4LeptonsSkim ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

bool debug
 
int nEvents
 
int nLeptonMin
 
int nSelectedEvents
 
int nStiffLeptonMin
 
float softMinPt
 
float stiffMinPt
 
edm::EDGetTokenT
< reco::TrackCollection
theGLBMuonToken
 
edm::EDGetTokenT
< reco::GsfElectronCollection
theGsfEToken
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
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 &)
 
- 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 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 ( )

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 
)
virtual

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

Implements edm::EDFilter.

Definition at line 66 of file HiggsToZZ4LeptonsSkim.cc.

References HI_PhotonSkim_cff::electrons, edm::HandleBase::isValid(), patZpeak::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:14
edm::EDGetTokenT< reco::TrackCollection > theGLBMuonToken
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
bool isValid() const
Definition: HandleBase.h:75
T const * product() const
Definition: Handle.h:81
tuple muons
Definition: patZpeak.py:38
edm::EDGetTokenT< reco::GsfElectronCollection > theGsfEToken

Member Data Documentation

bool HiggsToZZ4LeptonsSkim::debug
private

Definition at line 48 of file HiggsToZZ4LeptonsSkim.h.

Referenced by rrapi.RRApi::dprint(), and rrapi.RRApi::get().

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.