CMS 3D CMS Logo

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

#include <TwoVBGenFilter.h>

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

Public Member Functions

 TwoVBGenFilter (const edm::ParameterSet &)
 
 ~TwoVBGenFilter () 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 Member Functions

void beginJob () override
 
void endJob () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 
bool isElectron (const HepMC::GenParticle *)
 
bool isMuon (const HepMC::GenParticle *)
 
bool isNeutrino (const HepMC::GenParticle *)
 
bool isQuark (const HepMC::GenParticle *)
 
bool isTau (const HepMC::GenParticle *)
 

Private Attributes

bool eejj_
 
bool enujj_
 
bool mumujj_
 
bool munujj_
 
bool nunujj_
 
edm::InputTag src_
 
bool taunujj_
 
bool tautaujj_
 

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 37 of file TwoVBGenFilter.h.

Constructor & Destructor Documentation

TwoVBGenFilter::TwoVBGenFilter ( const edm::ParameterSet iConfig)
explicit

Definition at line 6 of file TwoVBGenFilter.cc.

References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

7 {
8  //now do what ever initialization is needed
9  src_ = iConfig.getUntrackedParameter<edm::InputTag>("src",edm::InputTag("generator", "unsmeared"));
10 
11  eejj_ = iConfig.getParameter<bool>("eejj");
12  enujj_ = iConfig.getParameter<bool>("enujj");
13 
14  mumujj_ = iConfig.getParameter<bool>("mumujj");
15  munujj_ = iConfig.getParameter<bool>("munujj");
16 
17  tautaujj_ = iConfig.getParameter<bool>("tautaujj");
18  taunujj_ = iConfig.getParameter<bool>("taunujj");
19 
20  nunujj_ = iConfig.getParameter<bool>("nunujj");
21 
22  //cout << eejj_ << endl;
23 
24 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag src_
TwoVBGenFilter::~TwoVBGenFilter ( )
override

Definition at line 27 of file TwoVBGenFilter.cc.

28 {
29 
30  // do anything here that needs to be done at desctruction time
31  // (e.g. close files, deallocate resources etc.)
32 
33 }

Member Function Documentation

void TwoVBGenFilter::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 87 of file TwoVBGenFilter.cc.

88 {
89 }
void TwoVBGenFilter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 93 of file TwoVBGenFilter.cc.

93  {
94 }
bool TwoVBGenFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 42 of file TwoVBGenFilter.cc.

References funct::abs(), class-composition::children, GenParticle::GenParticle, edm::Event::getByLabel(), edm::HepMCProduct::GetEvent(), reco::isElectron(), reco::isMuon(), reco::isNeutrino(), reco::isTau(), Vispa.Plugins.EdmBrowser.EdmDataAccessor::ne(), and AlCaHLTBitMon_ParallelJobs::p.

43 {
44  int nj = 0;
45  int ne = 0;
46  int nnu = 0;
47  int nmu = 0;
48  int ntau = 0;
49 
51  iEvent.getByLabel(src_, evt);
52 
53  const HepMC::GenEvent* myGenEvent = evt->GetEvent();
54 
55  for ( HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();
56  p != myGenEvent->particles_end(); ++p ) {
57 
58  if(abs((*p)->pdg_id()) !=23 && abs((*p)->pdg_id()) !=24) continue; // If it is not Z or W, go to the next particle.
59 
60  if ( (*p)->end_vertex() ) {
61  for ( HepMC::GenVertex::particle_iterator des=(*p)->end_vertex()->particles_begin(HepMC::children);
62  des != (*p)->end_vertex()->particles_end(HepMC::children); ++des ) {
63 
64  const HepMC::GenParticle* theDaughter = *des;
65  if(isQuark(theDaughter)) ++nj;
66  else if(isNeutrino(theDaughter)) ++nnu;
67  else if(isElectron(theDaughter)) ++ne;
68  else if(isMuon(theDaughter)) ++nmu;
69  else if(isTau(theDaughter)) ++ntau;
70 
71  }
72  }
73  }
74 
75  if (ne==2 && nj == 2 && eejj_) return true;
76  else if (ne==1 && nj == 2 && nnu==1 && enujj_) return true;
77  else if (nmu==2 && nj == 2 && mumujj_) return true;
78  else if (nmu==1 && nj == 2 && nnu==1 && munujj_) return true;
79  else if (ntau==2 && nj == 2 && tautaujj_) return true;
80  else if (ntau==1 && nj == 2 && nnu==1 && taunujj_) return true;
81  else if (nnu==2 && nj == 2 && nunujj_) return true;
82  else return false;
83 }
bool isQuark(const HepMC::GenParticle *)
bool isNeutrino(const HepMC::GenParticle *)
bool isTau(const HepMC::GenParticle *)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
edm::InputTag src_
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
bool isElectron(const HepMC::GenParticle *)
bool isMuon(const HepMC::GenParticle *)
bool TwoVBGenFilter::isElectron ( const HepMC::GenParticle *  p)
private

Definition at line 117 of file TwoVBGenFilter.cc.

References funct::abs(), BPhysicsValidation_cfi::pdgid, and mps_fire::result.

117  {
118  bool result;
119  int pdgid = std::abs(p->pdg_id());
120  if(pdgid == 11)
121  result = true;
122  else
123  result = false;
124  return result;
125 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool TwoVBGenFilter::isMuon ( const HepMC::GenParticle *  p)
private

Definition at line 127 of file TwoVBGenFilter.cc.

References funct::abs(), BPhysicsValidation_cfi::pdgid, and mps_fire::result.

127  {
128  bool result;
129  int pdgid = std::abs(p->pdg_id());
130  if(pdgid == 13)
131  result = true;
132  else
133  result = false;
134  return result;
135 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool TwoVBGenFilter::isNeutrino ( const HepMC::GenParticle *  p)
private

Definition at line 107 of file TwoVBGenFilter.cc.

References funct::abs(), BPhysicsValidation_cfi::pdgid, and mps_fire::result.

107  {
108  bool result;
109  int pdgid = std::abs(p->pdg_id());
110  if(pdgid == 12 || pdgid == 14 || pdgid == 16)
111  result = true;
112  else
113  result = false;
114  return result;
115 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool TwoVBGenFilter::isQuark ( const HepMC::GenParticle *  p)
private

Definition at line 96 of file TwoVBGenFilter.cc.

References funct::abs(), BPhysicsValidation_cfi::pdgid, and mps_fire::result.

96  {
97  bool result;
98  int pdgid = std::abs(p->pdg_id());
99  if(pdgid == 1 || pdgid == 2 || pdgid == 3 ||
100  pdgid == 4 || pdgid == 5 || pdgid == 6)
101  result = true;
102  else
103  result = false;
104  return result;
105 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool TwoVBGenFilter::isTau ( const HepMC::GenParticle *  p)
private

Definition at line 137 of file TwoVBGenFilter.cc.

References funct::abs(), BPhysicsValidation_cfi::pdgid, and mps_fire::result.

137  {
138  bool result;
139  int pdgid = std::abs(p->pdg_id());
140  if(pdgid == 15)
141  result = true;
142  else
143  result = false;
144  return result;
145 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

bool TwoVBGenFilter::eejj_
private

Definition at line 49 of file TwoVBGenFilter.h.

bool TwoVBGenFilter::enujj_
private

Definition at line 49 of file TwoVBGenFilter.h.

bool TwoVBGenFilter::mumujj_
private

Definition at line 49 of file TwoVBGenFilter.h.

bool TwoVBGenFilter::munujj_
private

Definition at line 49 of file TwoVBGenFilter.h.

bool TwoVBGenFilter::nunujj_
private

Definition at line 49 of file TwoVBGenFilter.h.

edm::InputTag TwoVBGenFilter::src_
private

Definition at line 48 of file TwoVBGenFilter.h.

bool TwoVBGenFilter::taunujj_
private

Definition at line 49 of file TwoVBGenFilter.h.

bool TwoVBGenFilter::tautaujj_
private

Definition at line 49 of file TwoVBGenFilter.h.