CMS 3D CMS Logo

HiggsToZZ4LeptonsPreFilter.cc
Go to the documentation of this file.
1 
2 /* \class HiggsTo4LeptonsPreFilter
3  *
4  * Consult header file for description
5  *
6  * author: Dominique Fortin - UC Riverside
7  *
8  */
9 
10 
11 // system include files
13 
14 // User include files
16 
17 // Candidate handling
21 
22 // C++
23 #include <iostream>
24 #include <vector>
25 
26 using namespace std;
27 using namespace edm;
28 using namespace reco;
29 
30 
31 // Constructor
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 }
48 
49 
50 // Destructor
52 
53  std::cout << "number of events processed: " << evt << std::endl;
54  std::cout << "number of events kept: " << ikept << std::endl;
55 
56 }
57 
58 
59 // Filter event
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 }
117 
118 
HiggsToZZ4LeptonsPreFilter(const edm::ParameterSet &)
T getParameter(std::string const &) const
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
bool isValid() const
Definition: HandleBase.h:74
#define debug
Definition: HDRShower.cc:19
fixed size matrix
HLT enums.
bool filter(edm::Event &, const edm::EventSetup &) override
Get event properties to send to builder to fill seed collection.
Definition: event.py:1