Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <HiggsAnalysis/Skimming/interface/HiggsTo2GammaSkim.h>
00013
00014
00015 #include <FWCore/ParameterSet/interface/ParameterSet.h>
00016
00017
00018 #include <FWCore/MessageLogger/interface/MessageLogger.h>
00019
00020
00021 #include <DataFormats/EgammaCandidates/interface/Photon.h>
00022 #include <DataFormats/EgammaCandidates/interface/PhotonFwd.h>
00023
00024
00025 #include <iostream>
00026 #include <vector>
00027
00028 using namespace std;
00029 using namespace edm;
00030 using namespace reco;
00031
00032
00033
00034 HiggsTo2GammaSkim::HiggsTo2GammaSkim(const edm::ParameterSet& pset) {
00035
00036
00037 debug = pset.getParameter<bool>("DebugHiggsTo2GammaSkim");
00038
00039
00040 thePhotonLabel = pset.getParameter<edm::InputTag>("PhotonCollectionLabel");
00041
00042
00043 photon1MinPt = pset.getParameter<double>("photon1MinimumPt");
00044 nPhotonMin = pset.getParameter<int>("nPhotonMinimum");
00045
00046
00047 nEvents = 0;
00048 nSelectedEvents = 0;
00049
00050 }
00051
00052
00053
00054 HiggsTo2GammaSkim::~HiggsTo2GammaSkim() {
00055
00056 edm::LogVerbatim("HiggsTo2GammaSkim")
00057 << " Number_events_read " << nEvents
00058 << " Number_events_kept " << nSelectedEvents
00059 << " Efficiency " << ((double)nSelectedEvents)/((double) nEvents + 0.01) << std::endl;
00060 }
00061
00062
00063
00064
00065 bool HiggsTo2GammaSkim::filter(edm::Event& event, const edm::EventSetup& setup ) {
00066
00067 nEvents++;
00068
00069 using reco::PhotonCollection;
00070
00071 bool keepEvent = false;
00072 int nPhotons = 0;
00073
00074
00075
00076
00077 edm::Handle<reco::PhotonCollection> photonHandle;
00078
00079 event.getByLabel(thePhotonLabel.label(),photonHandle);
00080
00081 if ( photonHandle.isValid() ) {
00082
00083 const reco::PhotonCollection* phoCollection = photonHandle.product();
00084
00085 reco::PhotonCollection::const_iterator photons;
00086
00087
00088
00089
00090
00091
00092 for ( photons = phoCollection->begin(); photons != phoCollection->end(); ++photons ) {
00093 float et_p = photons->et();
00094 if ( et_p > photon1MinPt) nPhotons++;
00095 }
00096 }
00097
00098
00099 if ( nPhotons >= nPhotonMin ) keepEvent = true;
00100
00101 if (keepEvent) nSelectedEvents++;
00102
00103 return keepEvent;
00104 }
00105
00106