CMS 3D CMS Logo

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

#include <HiggsToZZ4LeptonsPreFilter.h>

Inheritance diagram for HiggsToZZ4LeptonsPreFilter:
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...
 
 HiggsToZZ4LeptonsPreFilter (const edm::ParameterSet &)
 
 ~HiggsToZZ4LeptonsPreFilter () 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 evt
 
edm::EDGetTokenT< reco::GenParticleCollectiongenToken
 
int ikept
 
int leptonFlavour
 

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 28 of file HiggsToZZ4LeptonsPreFilter.h.

Constructor & Destructor Documentation

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

Definition at line 32 of file HiggsToZZ4LeptonsPreFilter.cc.

References debug, edm::ParameterSet::getParameter(), and StEvtSolProducer_cfi::leptonFlavour.

32  {
33 
34 // LeptonFlavour
35 // 0 = no tau
36 // 1 = 4 mu
37 // 2 = 4 e
38 // 3 = 2e 2mu
39 
40  // Local Debug flag
41  debug = pset.getParameter<bool>("DebugHiggsToZZ4LeptonsPreFilter");
42  leptonFlavour = pset.getParameter<int>("HiggsToZZ4LeptonsPreFilterLeptonFlavour");
43  genToken = consumes<GenParticleCollection>(edm::InputTag("genParticles"));
44 
45  ikept = 0;
46  evt = 0;
47 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::GenParticleCollection > genToken
HiggsToZZ4LeptonsPreFilter::~HiggsToZZ4LeptonsPreFilter ( )
override

Definition at line 51 of file HiggsToZZ4LeptonsPreFilter.cc.

References gather_cfg::cout.

51  {
52 
53  std::cout << "number of events processed: " << evt << std::endl;
54  std::cout << "number of events kept: " << ikept << std::endl;
55 
56 }

Member Function Documentation

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

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

Definition at line 60 of file HiggsToZZ4LeptonsPreFilter.cc.

References GenHFHadronMatcher_cfi::genParticles, edm::HandleBase::isValid(), and StEvtSolProducer_cfi::leptonFlavour.

60  {
61 
62  bool keepEvent = false;
63  evt++;
64 
65  bool FourL = false;
66  bool FourE = false;
67  bool FourM = false;
68  bool TwoETwoM = false;
69 
70  // get gen particle candidates
72  event.getByToken(genToken, genParticles);
73 
74  if ( genParticles.isValid() ) {
75 
76  int nElec = 0;
77  int nMuon = 0;
78 
79  for (GenParticleCollection::const_iterator mcIter=genParticles->begin(); mcIter!=genParticles->end(); ++mcIter) {
80  // Muons:
81  if ( mcIter->pdgId() == 13 || mcIter->pdgId() == -13) {
82  // Mother is a Z
83  if ( mcIter->mother()->pdgId() == 23 ) {
84  // In fiducial volume:
85  if ( mcIter->pt() < 3 ) continue;
86  if ( mcIter->eta() > -2.4 && mcIter->eta() < 2.4 ) nMuon++;
87  }
88  }
89  // Electrons:
90  if ( mcIter->pdgId() == 11 || mcIter->pdgId() == -11)
91  // Mother is a Z
92  if ( mcIter->mother()->pdgId() == 23 ) {
93  // In fiducial volume:
94  if ( mcIter->pt() < 3 ) continue;
95  if ( mcIter->eta() > -2.5 && mcIter->eta() < 2.5 ) nElec++;
96  }
97  }
98 
99 
100  if (nElec > 3) FourE = true;
101  if (nMuon > 3) FourM = true;
102  if (nMuon > 1 && nElec > 1) TwoETwoM = true;
103  if ( FourE || FourM || TwoETwoM ) FourL = true;
104 
105  if ( leptonFlavour == 0 && FourL ) keepEvent = true;
106  if ( leptonFlavour == 1 && FourM ) keepEvent = true;
107  if ( leptonFlavour == 2 && FourE ) keepEvent = true;
108  if ( leptonFlavour == 3 && TwoETwoM ) keepEvent = true;
109 
110  }
111 
112  if (keepEvent ) ikept++;
113 
114  return keepEvent;
115 
116 }
edm::EDGetTokenT< reco::GenParticleCollection > genToken
bool isValid() const
Definition: HandleBase.h:74

Member Data Documentation

bool HiggsToZZ4LeptonsPreFilter::debug
private
int HiggsToZZ4LeptonsPreFilter::evt
private

Definition at line 42 of file HiggsToZZ4LeptonsPreFilter.h.

edm::EDGetTokenT<reco::GenParticleCollection> HiggsToZZ4LeptonsPreFilter::genToken
private

Definition at line 47 of file HiggsToZZ4LeptonsPreFilter.h.

int HiggsToZZ4LeptonsPreFilter::ikept
private

Definition at line 42 of file HiggsToZZ4LeptonsPreFilter.h.

int HiggsToZZ4LeptonsPreFilter::leptonFlavour
private

Definition at line 45 of file HiggsToZZ4LeptonsPreFilter.h.