CMS 3D CMS Logo

HiggsToZZ4LeptonsSkim.cc
Go to the documentation of this file.
1 
2 /* \class HiggsTo4LeptonsSkim
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 // Muons:
19 
20 // Electrons
22 
23 // C++
24 #include <iostream>
25 #include <vector>
26 
27 using namespace std;
28 using namespace edm;
29 using namespace reco;
30 
31 
32 // Constructor
34 
35  // Local Debug flag
36  debug = pset.getParameter<bool>("DebugHiggsToZZ4LeptonsSkim");
37 
38  // Reconstructed objects
39  theGLBMuonToken = consumes<reco::TrackCollection>(pset.getParameter<edm::InputTag>("GlobalMuonCollectionLabel"));
40  theGsfEToken = consumes<reco::GsfElectronCollection>(pset.getParameter<edm::InputTag>("ElectronCollectionLabel"));
41 
42  // Minimum Pt for leptons for skimming
43  stiffMinPt = pset.getParameter<double>("stiffMinimumPt");
44  softMinPt = pset.getParameter<double>("softMinimumPt");
45  nStiffLeptonMin = pset.getParameter<int>("nStiffLeptonMinimum");
46  nLeptonMin = pset.getParameter<int>("nLeptonMinimum");
47 
48  nEvents = 0;
49  nSelectedEvents = 0;
50 
51 }
52 
53 
54 // Destructor
56 
57  edm::LogVerbatim("HiggsToZZ4LeptonsSkim")
58  << " Number_events_read " << nEvents
59  << " Number_events_kept " << nSelectedEvents
60  << " Efficiency " << ((double)nSelectedEvents)/((double) nEvents + 0.01) << std::endl;
61 }
62 
63 
64 
65 // Filter event
67 
68  nEvents++;
69 
71 
72  bool keepEvent = false;
73  int nStiffLeptons = 0;
74  int nLeptons = 0;
75 
76 
77  // First look at muons:
78 
79  // Get the muon track collection from the event
81  event.getByToken(theGLBMuonToken, muTracks);
82 
83  if ( muTracks.isValid() ) {
84 
85  reco::TrackCollection::const_iterator muons;
86 
87  // Loop over muon collections and count how many muons there are,
88  // and how many are above threshold
89  for ( muons = muTracks->begin(); muons != muTracks->end(); ++muons ) {
90  if ( muons->pt() > stiffMinPt) nStiffLeptons++;
91  if ( muons->pt() > softMinPt) nLeptons++;
92  }
93  }
94 
95  // Now look at electrons:
96 
97  // Get the electron track collection from the event
99  event.getByToken(theGsfEToken,pTracks);
100 
101  if ( pTracks.isValid() ) {
102 
103  const reco::GsfElectronCollection* eTracks = pTracks.product();
104 
105  reco::GsfElectronCollection::const_iterator electrons;
106 
107  // Loop over electron collections and count how many muons there are,
108  // and how many are above threshold
109  for ( electrons = eTracks->begin(); electrons != eTracks->end(); ++electrons ) {
110  float pt_e = electrons->pt();
111  if ( pt_e > stiffMinPt) nStiffLeptons++;
112  if ( pt_e > softMinPt) nLeptons++;
113  }
114  }
115 
116  // Make decision:
117  if ( nStiffLeptons >= nStiffLeptonMin && nLeptons >= nLeptonMin) keepEvent = true;
118 
119  if (keepEvent) nSelectedEvents++;
120 
121  return keepEvent;
122 }
123 
124 
T getParameter(std::string const &) const
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
HiggsToZZ4LeptonsSkim(const edm::ParameterSet &)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
virtual bool filter(edm::Event &, const edm::EventSetup &)
Get event properties to send to builder to fill seed collection.
bool isValid() const
Definition: HandleBase.h:74
#define debug
Definition: HDRShower.cc:19
T const * product() const
Definition: Handle.h:81
fixed size matrix
HLT enums.
UInt_t nEvents
Definition: hcalCalib.cc:42
Definition: event.py:1