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 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 ()
 
- 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 Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual bool filter (edm::Event &, const edm::EventSetup &)
 
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
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 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(), edm::ParameterSet::getUntrackedParameter(), and HLT_25ns14e33_v1_cff::InputTag.

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

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

Reimplemented from edm::EDFilter.

Definition at line 87 of file TwoVBGenFilter.cc.

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

Reimplemented from edm::EDFilter.

Definition at line 93 of file TwoVBGenFilter.cc.

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

Implements edm::EDFilter.

Definition at line 42 of file TwoVBGenFilter.cc.

References funct::abs(), GenParticle::GenParticle, edm::Event::getByLabel(), 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:420
edm::InputTag src_
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(), and query::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 }
tuple result
Definition: query.py:137
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(), and query::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 }
tuple result
Definition: query.py:137
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(), and query::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 }
tuple result
Definition: query.py:137
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(), and query::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 }
tuple result
Definition: query.py:137
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(), and query::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 }
tuple result
Definition: query.py:137
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.