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:
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>("DebugHiggsTo2GammaSkim");
38 
39  // Reconstructed objects
40  thePhotonLabel = pset.getParameter<edm::InputTag>("PhotonCollectionLabel");
41 
42  // Minimum Pt for photons for skimming
43  photon1MinPt = pset.getParameter<double>("photon1MinimumPt");
44  nPhotonMin = pset.getParameter<int>("nPhotonMinimum");
45 
46 
47  nEvents = 0;
48  nSelectedEvents = 0;
49 
50 }
51 
52 
53 // Destructor
55 
56  edm::LogVerbatim("HiggsTo2GammaSkim")
57  << " Number_events_read " << nEvents
58  << " Number_events_kept " << nSelectedEvents
59  << " Efficiency " << ((double)nSelectedEvents)/((double) nEvents + 0.01) << std::endl;
60 }
61 
62 
63 
64 // Filter event
66 
67  nEvents++;
68 
70 
71  bool keepEvent = false;
72  int nPhotons = 0;
73 
74  // Look at photons:
75 
76  // Get the photon collection from the event
78 
79  event.getByLabel(thePhotonLabel.label(),photonHandle);
80 
81  if ( photonHandle.isValid() ) {
82 
83  const reco::PhotonCollection* phoCollection = photonHandle.product();
84 
85  reco::PhotonCollection::const_iterator photons;
86 
87  // Loop over photon collections and count how many photons there are,
88  // and how many are above the thresholds
89 
90  // Question: do we need to take the reconstructed primary vertex at this point?
91  // Here, I assume that the et is taken with respect to the nominal vertex (0,0,0).
92  for ( photons = phoCollection->begin(); photons != phoCollection->end(); ++photons ) {
93  float et_p = photons->et();
94  if ( et_p > photon1MinPt) nPhotons++;
95  }
96  }
97 
98  // Make decision:
99  if ( nPhotons >= nPhotonMin ) keepEvent = true;
100 
101  if (keepEvent) nSelectedEvents++;
102 
103  return keepEvent;
104 }
105 
106 
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.
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
HiggsTo2GammaSkim(const edm::ParameterSet &)
T const * product() const
Definition: Handle.h:74
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="")