test
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
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
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:75
#define debug
Definition: HDRShower.cc:19
T const * product() const
Definition: Handle.h:81
tuple muons
Definition: patZpeak.py:38
UInt_t nEvents
Definition: hcalCalib.cc:42
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")