CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HiggsToWW2LeptonsSkim.cc
Go to the documentation of this file.
1 
12 
16 
17 // Muons:
19 
20 // Electrons
23 
25 
26 
27 #include <iostream>
28 
30 
31 using namespace edm;
32 using namespace std;
33 using namespace reco;
34 
36  nEvents_(0), nAccepted_(0)
37 {
38 
39  // Reconstructed objects
40  recTrackLabel = iConfig.getParameter<edm::InputTag>("RecoTrackLabel");
41  theGLBMuonLabel = iConfig.getParameter<edm::InputTag>("GlobalMuonCollectionLabel");
42  theGsfELabel = iConfig.getParameter<edm::InputTag>("ElectronCollectionLabel");
43 
44  singleTrackPtMin_ = iConfig.getParameter<double>("SingleTrackPtMin");
45  diTrackPtMin_ = iConfig.getParameter<double>("DiTrackPtMin");
46  etaMin_ = iConfig.getParameter<double>("etaMin");
47  etaMax_ = iConfig.getParameter<double>("etaMax");
48 }
49 
50 
52 {
53 }
54 
56 {
57  edm::LogVerbatim("HiggsToWW2LeptonsSkim")
58  << "Events read " << nEvents_
59  << " Events accepted " << nAccepted_
60  << "\nEfficiency " << ((double)nAccepted_)/((double)nEvents_)
61  << std::endl;
62 }
63 
64 
66 {
67 
68  nEvents_++;
69  bool accepted = false;
70  bool accepted1 = false;
71  int nTrackOver2ndCut = 0;
72 
73 
74  // Handle<CandidateCollection> tracks;
75 
77 
78  // Get the muon track collection from the event
80  event.getByLabel(theGLBMuonLabel.label(), muTracks);
81 
82  if ( muTracks.isValid() ) {
83 
84  reco::TrackCollection::const_iterator muons;
85 
86  // Loop over muon collections and count how many muons there are,
87  // and how many are above threshold
88  for ( muons = muTracks->begin(); muons != muTracks->end(); ++muons ) {
89  if ( muons->eta() > etaMin_ && muons->eta() < etaMax_ ) {
90  if ( muons->pt() > singleTrackPtMin_ ) accepted1 = true;
91  if ( muons->pt() > diTrackPtMin_ ) nTrackOver2ndCut++;
92  }
93  }
94  }
95 
96  // Now look at electrons:
97 
98  // Get the electron track collection from the event
100 
101  event.getByLabel(theGsfELabel.label(),pTracks);
102 
103  if ( pTracks.isValid() ) {
104 
105  const reco::GsfElectronCollection* eTracks = pTracks.product();
106 
107  reco::GsfElectronCollection::const_iterator electrons;
108 
109  // Loop over electron collections and count how many muons there are,
110  // and how many are above threshold
111  for ( electrons = eTracks->begin(); electrons != eTracks->end(); ++electrons ) {
112  if ( electrons->eta() > etaMin_ && electrons->eta() < etaMax_ ) {
113  if ( electrons->pt() > singleTrackPtMin_ ) accepted1 = true;
114  if ( electrons->pt() > diTrackPtMin_ ) nTrackOver2ndCut++;
115  }
116  }
117  }
118 
119 
120  if ( accepted1 && nTrackOver2ndCut >= 2 ) accepted = true;
121 
122  if ( accepted ) nAccepted_++;
123 
124  return accepted;
125 
126 }
T getParameter(std::string const &) const
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
virtual bool filter(edm::Event &, const edm::EventSetup &)
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
HiggsToWW2LeptonsSkim(const edm::ParameterSet &)
T const * product() const
Definition: Handle.h:81
std::string const & label() const
Definition: InputTag.h:42
tuple muons
Definition: patZpeak.py:38