CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HiggsTo2GammaSkim.cc
Go to the documentation of this file.
1 
2 /* \class HiggsTo2GammaSkim
3  *
4  * Consult header file for description
5  *
6  * author: Kati Lassila-Perini Helsinki Institute of Physics
7  *
8  */
9 
10 
11 // system include files
13 
14 // User include files
16 
17 // Message logger
19 
20 // Photons:
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>("DebugHiggsTo2GammaSkim");
37 
38  // Reconstructed objects
39  thePhotonToken = consumes<reco::PhotonCollection>(pset.getParameter<edm::InputTag>("PhotonCollectionLabel"));
40 
41  // Minimum Pt for photons for skimming
42  photon1MinPt = pset.getParameter<double>("photon1MinimumPt");
43  nPhotonMin = pset.getParameter<int>("nPhotonMinimum");
44 
45 
46  nEvents = 0;
47  nSelectedEvents = 0;
48 
49 }
50 
51 
52 // Destructor
54 
55  edm::LogVerbatim("HiggsTo2GammaSkim")
56  << " Number_events_read " << nEvents
57  << " Number_events_kept " << nSelectedEvents
58  << " Efficiency " << ((double)nSelectedEvents)/((double) nEvents + 0.01) << std::endl;
59 }
60 
61 
62 
63 // Filter event
65 
66  nEvents++;
67 
69 
70  bool keepEvent = false;
71  int nPhotons = 0;
72 
73  // Look at photons:
74 
75  // Get the photon collection from the event
77 
78  event.getByToken(thePhotonToken,photonHandle);
79 
80  if ( photonHandle.isValid() ) {
81 
82  const reco::PhotonCollection* phoCollection = photonHandle.product();
83 
84  reco::PhotonCollection::const_iterator photons;
85 
86  // Loop over photon collections and count how many photons there are,
87  // and how many are above the thresholds
88 
89  // Question: do we need to take the reconstructed primary vertex at this point?
90  // Here, I assume that the et is taken with respect to the nominal vertex (0,0,0).
91  for ( photons = phoCollection->begin(); photons != phoCollection->end(); ++photons ) {
92  float et_p = photons->et();
93  if ( et_p > photon1MinPt) nPhotons++;
94  }
95  }
96 
97  // Make decision:
98  if ( nPhotons >= nPhotonMin ) keepEvent = true;
99 
100  if (keepEvent) nSelectedEvents++;
101 
102  return keepEvent;
103 }
104 
105 
T getParameter(std::string const &) const
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
virtual bool filter(edm::Event &, const edm::EventSetup &)
Get event properties to send to builder to fill seed collection.
#define debug
Definition: HDRShower.cc:19
T const * product() const
Definition: Handle.h:81
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
HiggsTo2GammaSkim(const edm::ParameterSet &)
UInt_t nEvents
Definition: hcalCalib.cc:42
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")