File indexing completed on 2024-04-06 12:18:58
0001 #include "DataFormats/HLTReco/interface/TriggerObject.h"
0002 #include "FWCore/Common/interface/TriggerNames.h"
0003 #include "FWCore/Framework/interface/Frameworkfwd.h"
0004 #include "FWCore/Framework/interface/MakerMacros.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 #include "HLTriggerOffline/SUSYBSM/interface/SUSY_HLT_PhotonMET.h"
0007
0008 SUSY_HLT_PhotonMET::SUSY_HLT_PhotonMET(const edm::ParameterSet &ps) {
0009 edm::LogInfo("SUSY_HLT_PhotonMET") << "Constructor SUSY_HLT_PhotonMET::SUSY_HLT_PhotonMET " << std::endl;
0010
0011 thePfMETCollection_ = consumes<reco::PFMETCollection>(ps.getParameter<edm::InputTag>("pfMETCollection"));
0012 thePhotonCollection_ = consumes<reco::PhotonCollection>(ps.getParameter<edm::InputTag>("photonCollection"));
0013 triggerResults_ = consumes<edm::TriggerResults>(ps.getParameter<edm::InputTag>("TriggerResults"));
0014 triggerPath_ = ps.getParameter<std::string>("TriggerPath");
0015 triggerPathBase_ = ps.getParameter<std::string>("TriggerPathBase");
0016 ptThrOffline_ = ps.getUntrackedParameter<double>("ptThrOffline");
0017 metThrOffline_ = ps.getUntrackedParameter<double>("metThrOffline");
0018 }
0019
0020 SUSY_HLT_PhotonMET::~SUSY_HLT_PhotonMET() {
0021 edm::LogInfo("SUSY_HLT_PhotonMET") << "Destructor SUSY_HLT_PhotonMET::~SUSY_HLT_PhotonMET " << std::endl;
0022 }
0023
0024 void SUSY_HLT_PhotonMET::bookHistograms(DQMStore::IBooker &ibooker_, edm::Run const &, edm::EventSetup const &) {
0025 edm::LogInfo("SUSY_HLT_PhotonMET") << "SUSY_HLT_PhotonMET::bookHistograms" << std::endl;
0026
0027 bookHistos(ibooker_);
0028 }
0029
0030 void SUSY_HLT_PhotonMET::analyze(edm::Event const &e, edm::EventSetup const &eSetup) {
0031 edm::LogInfo("SUSY_HLT_PhotonMET") << "SUSY_HLT_PhotonMET::analyze" << std::endl;
0032
0033
0034
0035
0036 edm::Handle<reco::PFMETCollection> pfMETCollection;
0037 e.getByToken(thePfMETCollection_, pfMETCollection);
0038 if (!pfMETCollection.isValid()) {
0039 edm::LogError("SUSY_HLT_PhotonMET") << "invalid met collection"
0040 << "\n";
0041 return;
0042 }
0043
0044
0045
0046 edm::Handle<reco::PhotonCollection> photonCollection;
0047 e.getByToken(thePhotonCollection_, photonCollection);
0048 if (!photonCollection.isValid()) {
0049 edm::LogError("SUSY_HLT_PhotonMET") << "invalid egamma collection"
0050 << "\n";
0051 return;
0052 }
0053
0054
0055 edm::Handle<edm::TriggerResults> hltresults;
0056 e.getByToken(triggerResults_, hltresults);
0057 if (!hltresults.isValid()) {
0058 edm::LogError("SUSY_HLT_PhotonMET") << "invalid collection: TriggerResults"
0059 << "\n";
0060 return;
0061 }
0062
0063
0064 if (photonCollection->empty() || abs(photonCollection->begin()->superCluster()->eta()) > 1.4442)
0065 return;
0066
0067
0068 float const recoPhotonPt = !photonCollection->empty() ? photonCollection->begin()->et() : 0;
0069 float const recoMET = !pfMETCollection->empty() ? pfMETCollection->begin()->et() : 0;
0070 h_recoPhotonPt->Fill(recoPhotonPt);
0071 h_recoMet->Fill(recoMET);
0072
0073
0074 bool hasFired = false, hasFiredBaseTrigger = false;
0075 edm::TriggerNames const &trigNames = e.triggerNames(*hltresults);
0076 unsigned int const numTriggers = trigNames.size();
0077 for (unsigned int hltIndex = 0; hltIndex < numTriggers; ++hltIndex) {
0078 if (trigNames.triggerName(hltIndex).find(triggerPath_) != std::string::npos && hltresults->wasrun(hltIndex) &&
0079 hltresults->accept(hltIndex))
0080 hasFired = true;
0081 if (trigNames.triggerName(hltIndex).find(triggerPathBase_) != std::string::npos && hltresults->wasrun(hltIndex) &&
0082 hltresults->accept(hltIndex))
0083 hasFiredBaseTrigger = true;
0084 }
0085
0086 if (hasFiredBaseTrigger || !e.isRealData()) {
0087
0088 if (recoPhotonPt > ptThrOffline_)
0089 h_metTurnOn_den->Fill(recoMET);
0090 if (recoMET > metThrOffline_)
0091 h_photonTurnOn_den->Fill(recoPhotonPt);
0092 if (hasFired) {
0093
0094 if (recoPhotonPt > ptThrOffline_)
0095 h_metTurnOn_num->Fill(recoMET);
0096 if (recoMET > metThrOffline_)
0097 h_photonTurnOn_num->Fill(recoPhotonPt);
0098 }
0099 }
0100 }
0101
0102 void SUSY_HLT_PhotonMET::bookHistos(DQMStore::IBooker &ibooker_) {
0103 ibooker_.cd();
0104 ibooker_.setCurrentFolder("HLT/SUSYBSM/" + triggerPath_);
0105
0106
0107 h_recoPhotonPt = ibooker_.book1D("recoPhotonPt", "reco Photon transverse momentum; p_{T} (GeV)", 20, 0, 1000);
0108 h_recoMet = ibooker_.book1D("recoMet", "reco Missing transverse energy;E_{T}^{miss} (GeV)", 20, 0, 1000);
0109 h_metTurnOn_num = ibooker_.book1D("pfMetTurnOn_num", "PF MET Turn On Numerator", 20, 0, 500);
0110 h_metTurnOn_den = ibooker_.book1D("pfMetTurnOn_den", "PF MET Turn On Denominator", 20, 0, 500);
0111 h_photonTurnOn_num = ibooker_.book1D("photonTurnOn_num", "Photon Turn On Numerator", 20, 0, 1000);
0112 h_photonTurnOn_den = ibooker_.book1D("photonTurnOn_den", "Photon Turn On Denominator", 20, 0, 1000);
0113
0114 ibooker_.cd();
0115 }
0116
0117
0118 DEFINE_FWK_MODULE(SUSY_HLT_PhotonMET);