CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
23 
24 // C++
25 #include <iostream>
26 #include <vector>
27 
28 using namespace std;
29 using namespace edm;
30 using namespace reco;
31 
32 
33 // Constructor
35 
36  // Local Debug flag
37  debug = pset.getParameter<bool>("DebugHiggsToZZ4LeptonsSkim");
38 
39  // Reconstructed objects
40  recTrackLabel = pset.getParameter<edm::InputTag>("RecoTrackLabel");
41  theGLBMuonLabel = pset.getParameter<edm::InputTag>("GlobalMuonCollectionLabel");
42  theGsfELabel = pset.getParameter<edm::InputTag>("ElectronCollectionLabel");
43 
44  // Minimum Pt for leptons for skimming
45  stiffMinPt = pset.getParameter<double>("stiffMinimumPt");
46  softMinPt = pset.getParameter<double>("softMinimumPt");
47  nStiffLeptonMin = pset.getParameter<int>("nStiffLeptonMinimum");
48  nLeptonMin = pset.getParameter<int>("nLeptonMinimum");
49 
50  nEvents = 0;
51  nSelectedEvents = 0;
52 
53 }
54 
55 
56 // Destructor
58 
59  edm::LogVerbatim("HiggsToZZ4LeptonsSkim")
60  << " Number_events_read " << nEvents
61  << " Number_events_kept " << nSelectedEvents
62  << " Efficiency " << ((double)nSelectedEvents)/((double) nEvents + 0.01) << std::endl;
63 }
64 
65 
66 
67 // Filter event
69 
70  nEvents++;
71 
73 
74  bool keepEvent = false;
75  int nStiffLeptons = 0;
76  int nLeptons = 0;
77 
78 
79  // First look at muons:
80 
81  // Get the muon track collection from the event
83  event.getByLabel(theGLBMuonLabel.label(), muTracks);
84 
85  if ( muTracks.isValid() ) {
86 
87  reco::TrackCollection::const_iterator muons;
88 
89  // Loop over muon collections and count how many muons there are,
90  // and how many are above threshold
91  for ( muons = muTracks->begin(); muons != muTracks->end(); ++muons ) {
92  if ( muons->pt() > stiffMinPt) nStiffLeptons++;
93  if ( muons->pt() > softMinPt) nLeptons++;
94  }
95  }
96 
97  // Now look at electrons:
98 
99  // Get the electron track collection from the event
101 
102  event.getByLabel(theGsfELabel.label(),pTracks);
103 
104  if ( pTracks.isValid() ) {
105 
106  const reco::GsfElectronCollection* eTracks = pTracks.product();
107 
108  reco::GsfElectronCollection::const_iterator electrons;
109 
110  // Loop over electron collections and count how many muons there are,
111  // and how many are above threshold
112  for ( electrons = eTracks->begin(); electrons != eTracks->end(); ++electrons ) {
113  float pt_e = electrons->pt();
114  if ( pt_e > stiffMinPt) nStiffLeptons++;
115  if ( pt_e > softMinPt) nLeptons++;
116  }
117  }
118 
119  // Make decision:
120  if ( nStiffLeptons >= nStiffLeptonMin && nLeptons >= nLeptonMin) keepEvent = true;
121 
122  if (keepEvent) nSelectedEvents++;
123 
124  return keepEvent;
125 }
126 
127 
T getParameter(std::string const &) const
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
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.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isValid() const
Definition: HandleBase.h:76
T const * product() const
Definition: Handle.h:74
tuple muons
Definition: patZpeak.py:38
UInt_t nEvents
Definition: hcalCalib.cc:43
#define debug
Definition: MEtoEDMFormat.h:34
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")