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 
14 
18 
19 // Muons:
21 
22 // Electrons
25 
27 
28 
29 #include <iostream>
30 
32 
33 using namespace edm;
34 using namespace std;
35 using namespace reco;
36 
38  nEvents_(0), nAccepted_(0)
39 {
40 
41  // Reconstructed objects
42  recTrackLabel = iConfig.getParameter<edm::InputTag>("RecoTrackLabel");
43  theGLBMuonLabel = iConfig.getParameter<edm::InputTag>("GlobalMuonCollectionLabel");
44  theGsfELabel = iConfig.getParameter<edm::InputTag>("ElectronCollectionLabel");
45 
46  singleTrackPtMin_ = iConfig.getParameter<double>("SingleTrackPtMin");
47  diTrackPtMin_ = iConfig.getParameter<double>("DiTrackPtMin");
48  etaMin_ = iConfig.getParameter<double>("etaMin");
49  etaMax_ = iConfig.getParameter<double>("etaMax");
50 }
51 
52 
54 {
55 }
56 
58 {
59  edm::LogVerbatim("HiggsToWW2LeptonsSkim")
60  << "Events read " << nEvents_
61  << " Events accepted " << nAccepted_
62  << "\nEfficiency " << ((double)nAccepted_)/((double)nEvents_)
63  << std::endl;
64 }
65 
66 
68 {
69 
70  nEvents_++;
71  bool accepted = false;
72  bool accepted1 = false;
73  int nTrackOver2ndCut = 0;
74 
75 
76  // Handle<CandidateCollection> tracks;
77 
79 
80  // Get the muon track collection from the event
82  event.getByLabel(theGLBMuonLabel.label(), muTracks);
83 
84  if ( muTracks.isValid() ) {
85 
86  reco::TrackCollection::const_iterator muons;
87 
88  // Loop over muon collections and count how many muons there are,
89  // and how many are above threshold
90  for ( muons = muTracks->begin(); muons != muTracks->end(); ++muons ) {
91  if ( muons->eta() > etaMin_ && muons->eta() < etaMax_ ) {
92  if ( muons->pt() > singleTrackPtMin_ ) accepted1 = true;
93  if ( muons->pt() > diTrackPtMin_ ) nTrackOver2ndCut++;
94  }
95  }
96  }
97 
98  // Now look at electrons:
99 
100  // Get the electron track collection from the event
102 
103  event.getByLabel(theGsfELabel.label(),pTracks);
104 
105  if ( pTracks.isValid() ) {
106 
107  const reco::GsfElectronCollection* eTracks = pTracks.product();
108 
109  reco::GsfElectronCollection::const_iterator electrons;
110 
111  // Loop over electron collections and count how many muons there are,
112  // and how many are above threshold
113  for ( electrons = eTracks->begin(); electrons != eTracks->end(); ++electrons ) {
114  if ( electrons->eta() > etaMin_ && electrons->eta() < etaMax_ ) {
115  if ( electrons->pt() > singleTrackPtMin_ ) accepted1 = true;
116  if ( electrons->pt() > diTrackPtMin_ ) nTrackOver2ndCut++;
117  }
118  }
119  }
120 
121 
122  if ( accepted1 && nTrackOver2ndCut >= 2 ) accepted = true;
123 
124  if ( accepted ) nAccepted_++;
125 
126  return accepted;
127 
128 }
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:74
std::string const & label() const
Definition: InputTag.h:42
tuple muons
Definition: patZpeak.py:38