CMS 3D CMS Logo

SUSY_HLT_PhotonMET.cc
Go to the documentation of this file.
7 
9  edm::LogInfo("SUSY_HLT_PhotonMET") << "Constructor SUSY_HLT_PhotonMET::SUSY_HLT_PhotonMET " << std::endl;
10  // Get parameters from configuration file
11  thePfMETCollection_ = consumes<reco::PFMETCollection>(ps.getParameter<edm::InputTag>("pfMETCollection"));
12  thePhotonCollection_ = consumes<reco::PhotonCollection>(ps.getParameter<edm::InputTag>("photonCollection"));
13  triggerResults_ = consumes<edm::TriggerResults>(ps.getParameter<edm::InputTag>("TriggerResults"));
14  triggerPath_ = ps.getParameter<std::string>("TriggerPath");
15  triggerPathBase_ = ps.getParameter<std::string>("TriggerPathBase");
16  ptThrOffline_ = ps.getUntrackedParameter<double>("ptThrOffline");
17  metThrOffline_ = ps.getUntrackedParameter<double>("metThrOffline");
18 }
19 
21  edm::LogInfo("SUSY_HLT_PhotonMET") << "Destructor SUSY_HLT_PhotonMET::~SUSY_HLT_PhotonMET " << std::endl;
22 }
23 
25  edm::LogInfo("SUSY_HLT_PhotonMET") << "SUSY_HLT_PhotonMET::bookHistograms" << std::endl;
26  // book at beginRun
27  bookHistos(ibooker_);
28 }
29 
31  edm::LogInfo("SUSY_HLT_PhotonMET") << "SUSY_HLT_PhotonMET::analyze" << std::endl;
32 
33  //-------------------------------
34  //--- MET
35  //-------------------------------
38  if (!pfMETCollection.isValid()) {
39  edm::LogError("SUSY_HLT_PhotonMET") << "invalid met collection"
40  << "\n";
41  return;
42  }
43  //-------------------------------
44  //--- Photon
45  //-------------------------------
48  if (!photonCollection.isValid()) {
49  edm::LogError("SUSY_HLT_PhotonMET") << "invalid egamma collection"
50  << "\n";
51  return;
52  }
53 
54  // check what is in the menu
56  e.getByToken(triggerResults_, hltresults);
57  if (!hltresults.isValid()) {
58  edm::LogError("SUSY_HLT_PhotonMET") << "invalid collection: TriggerResults"
59  << "\n";
60  return;
61  }
62 
63  // use only events with leading photon in barrel
64  if (photonCollection->empty() || abs(photonCollection->begin()->superCluster()->eta()) > 1.4442)
65  return;
66 
67  // get reco photon and met
68  float const recoPhotonPt = !photonCollection->empty() ? photonCollection->begin()->et() : 0;
69  float const recoMET = !pfMETCollection->empty() ? pfMETCollection->begin()->et() : 0;
70  h_recoPhotonPt->Fill(recoPhotonPt);
71  h_recoMet->Fill(recoMET);
72 
73  // the actual trigger efficiencies
74  bool hasFired = false, hasFiredBaseTrigger = false;
75  edm::TriggerNames const &trigNames = e.triggerNames(*hltresults);
76  unsigned int const numTriggers = trigNames.size();
77  for (unsigned int hltIndex = 0; hltIndex < numTriggers; ++hltIndex) {
78  if (trigNames.triggerName(hltIndex).find(triggerPath_) != std::string::npos && hltresults->wasrun(hltIndex) &&
79  hltresults->accept(hltIndex))
80  hasFired = true;
81  if (trigNames.triggerName(hltIndex).find(triggerPathBase_) != std::string::npos && hltresults->wasrun(hltIndex) &&
82  hltresults->accept(hltIndex))
83  hasFiredBaseTrigger = true;
84  }
85 
86  if (hasFiredBaseTrigger || !e.isRealData()) {
87  // passed base trigger
88  if (recoPhotonPt > ptThrOffline_)
89  h_metTurnOn_den->Fill(recoMET);
90  if (recoMET > metThrOffline_)
91  h_photonTurnOn_den->Fill(recoPhotonPt);
92  if (hasFired) {
93  // passed base and signal trigger
94  if (recoPhotonPt > ptThrOffline_)
95  h_metTurnOn_num->Fill(recoMET);
96  if (recoMET > metThrOffline_)
97  h_photonTurnOn_num->Fill(recoPhotonPt);
98  }
99  }
100 }
101 
103  ibooker_.cd();
104  ibooker_.setCurrentFolder("HLT/SUSYBSM/" + triggerPath_);
105 
106  // offline quantities
107  h_recoPhotonPt = ibooker_.book1D("recoPhotonPt", "reco Photon transverse momentum; p_{T} (GeV)", 20, 0, 1000);
108  h_recoMet = ibooker_.book1D("recoMet", "reco Missing transverse energy;E_{T}^{miss} (GeV)", 20, 0, 1000);
109  h_metTurnOn_num = ibooker_.book1D("pfMetTurnOn_num", "PF MET Turn On Numerator", 20, 0, 500);
110  h_metTurnOn_den = ibooker_.book1D("pfMetTurnOn_den", "PF MET Turn On Denominator", 20, 0, 500);
111  h_photonTurnOn_num = ibooker_.book1D("photonTurnOn_num", "Photon Turn On Numerator", 20, 0, 1000);
112  h_photonTurnOn_den = ibooker_.book1D("photonTurnOn_den", "Photon Turn On Denominator", 20, 0, 1000);
113 
114  ibooker_.cd();
115 }
116 
117 // define this as a plug-in
MonitorElement * h_recoMet
MonitorElement * h_metTurnOn_den
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MonitorElement * h_recoPhotonPt
MonitorElement * h_metTurnOn_num
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
~SUSY_HLT_PhotonMET() override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Log< level::Error, false > LogError
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
MonitorElement * h_photonTurnOn_den
edm::EDGetTokenT< reco::PhotonCollection > thePhotonCollection_
edm::EDGetTokenT< edm::TriggerResults > triggerResults_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Log< level::Info, false > LogInfo
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:57
edm::EDGetTokenT< reco::PFMETCollection > thePfMETCollection_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * h_photonTurnOn_num
std::string triggerPathBase_
SUSY_HLT_PhotonMET(const edm::ParameterSet &ps)
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
void bookHistos(DQMStore::IBooker &)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
Definition: Run.h:45