CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HZZ4lFilter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HZZ4lFilter
4 // Class: HZZ4lFilter
5 //
13 //
14 // Original Author: Puljak Ivica
15 // Created: Wed Apr 18 12:52:31 CEST 2007
16 // $Id: HZZ4lFilter.cc,v 1.6 2010/09/07 11:45:07 fabstoec Exp $
17 //
18 //
19 
21 
22 // system include files
23 #include <memory>
24 
25 // user include files
28 
31 
33 
35 
36 
38 label_(iConfig.getUntrackedParameter("moduleLabel",std::string("generator"))),
39 minPtElectronMuon(iConfig.getUntrackedParameter("MinPtElectronMuon", 0.)),
40 maxEtaElectronMuon(iConfig.getUntrackedParameter("MaxEtaElectronMuon", 10.))
41 {
42  //now do what ever initialization is needed
43 
44 }
45 
46 
48 {
49 
50  // do anything here that needs to be done at desctruction time
51  // (e.g. close files, deallocate resources etc.)
52 
53 }
54 
55 
56 //
57 // member functions
58 //
59 
60 // ------------ method called on each new Event ------------
61 bool
63 {
64  using namespace edm;
65 
66  bool accepted = false;
67  int nLeptons = 0;
68 
70  iEvent.getByLabel(label_, evt);
71 
72  const HepMC::GenEvent * myGenEvent = evt->GetEvent();
73 
74  for ( HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin(); p != myGenEvent->particles_end(); ++p ) {
75 
76  if ( (*p)->status()!=1 ) continue;
77 
78  if ((*p)->momentum().perp() > minPtElectronMuon && fabs((*p)->momentum().eta()) < maxEtaElectronMuon) {
79  if ( abs((*p)->pdg_id()) == 11 || abs((*p)->pdg_id()) == 13 ) nLeptons++;
80  }
81  if (nLeptons == 3) {
82  accepted = true;
83  break;
84  }
85  }
86 
87  delete myGenEvent;
88 
89  if (accepted) {
90  return true;
91  } else {
92  return false;
93  }
94 
95 }
96 
97 
98 /*
99 // ------------ method called once each job just before starting event loop ------------
100 
101 // ------------ method called once each job just after ending the event loop ------------
102 void
103 HZZ4lFilter::endJob() {
104 }
105 */
106 
std::string label_
Definition: HZZ4lFilter.h:51
double minPtElectronMuon
Definition: HZZ4lFilter.h:53
double maxEtaElectronMuon
Definition: HZZ4lFilter.h:54
#define abs(x)
Definition: mlp_lapack.h:159
int iEvent
Definition: GenABIO.cc:243
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
HZZ4lFilter(const edm::ParameterSet &)
Definition: HZZ4lFilter.cc:37
virtual bool filter(edm::Event &, const edm::EventSetup &)
Definition: HZZ4lFilter.cc:62