CMS 3D CMS Logo

SUSY_HLT_PhotonHT.cc
Go to the documentation of this file.
7 
9  edm::LogInfo("SUSY_HLT_PhotonHT") << "Constructor SUSY_HLT_PhotonHT::SUSY_HLT_PhotonHT " << std::endl;
10  // Get parameters from configuration file
11  theTrigSummary_ = consumes<trigger::TriggerEvent>(ps.getParameter<edm::InputTag>("trigSummary"));
12  thePfMETCollection_ = consumes<reco::PFMETCollection>(ps.getParameter<edm::InputTag>("pfMETCollection"));
13  thePhotonCollection_ = consumes<reco::PhotonCollection>(ps.getParameter<edm::InputTag>("photonCollection"));
14  triggerResults_ = consumes<edm::TriggerResults>(ps.getParameter<edm::InputTag>("TriggerResults"));
15  triggerPath_ = ps.getParameter<std::string>("TriggerPath");
16  triggerPathAuxiliaryForHadronic_ = ps.getParameter<std::string>("TriggerPathAuxiliaryForHadronic");
17  triggerFilterPhoton_ = ps.getParameter<edm::InputTag>("TriggerFilterPhoton");
18  triggerFilterHt_ = ps.getParameter<edm::InputTag>("TriggerFilterHt");
19  ptThrOffline_ = ps.getUntrackedParameter<double>("ptThrOffline");
20  htThrOffline_ = ps.getUntrackedParameter<double>("htThrOffline");
21 }
22 
24  edm::LogInfo("SUSY_HLT_PhotonHT") << "Destructor SUSY_HLT_PhotonHT::~SUSY_HLT_PhotonHT " << std::endl;
25 }
26 
28  edm::LogInfo("SUSY_HLT_PhotonHT") << "SUSY_HLT_PhotonHT::bookHistograms" << std::endl;
29  // book at beginRun
30  bookHistos(ibooker_);
31 }
32 
34  edm::LogInfo("SUSY_HLT_PhotonHT") << "SUSY_HLT_PhotonHT::analyze" << std::endl;
35 
36  //-------------------------------
37  //--- MET / HT
38  //-------------------------------
41  if (!pfMETCollection.isValid()) {
42  edm::LogError("SUSY_HLT_PhotonHT") << "invalid met collection"
43  << "\n";
44  return;
45  }
46  //-------------------------------
47  //--- Photon
48  //-------------------------------
51  if (!photonCollection.isValid()) {
52  edm::LogError("SUSY_HLT_PhotonHT") << "invalid egamma collection"
53  << "\n";
54  return;
55  }
56 
57  // check what is in the menu
59  e.getByToken(triggerResults_, hltresults);
60  if (!hltresults.isValid()) {
61  edm::LogError("SUSY_HLT_PhotonHT") << "invalid collection: TriggerResults"
62  << "\n";
63  return;
64  }
65 
66  //-------------------------------
67  //--- Trigger
68  //-------------------------------
70  e.getByToken(theTrigSummary_, triggerSummary);
71  if (!triggerSummary.isValid()) {
72  edm::LogError("SUSY_HLT_PhotonHT") << "invalid collection: TriggerSummary"
73  << "\n";
74  return;
75  }
76 
77  // get online objects
79 
80  // get the photon object
81  size_t filterIndexPhoton = triggerSummary->filterIndex(triggerFilterPhoton_);
82  if (filterIndexPhoton < triggerSummary->sizeFilters()) {
83  const trigger::Keys &keys = triggerSummary->filterKeys(filterIndexPhoton);
84  if (!keys.empty()) {
85  // take the leading photon
86  float pt = triggerObjects[keys[0]].pt();
87  h_photonPt->Fill(pt);
88  }
89  }
90 
91  // get ht
92  size_t filterIndexHt = triggerSummary->filterIndex(triggerFilterHt_);
93  if (filterIndexHt < triggerSummary->sizeFilters()) {
94  const trigger::Keys &keys = triggerSummary->filterKeys(filterIndexHt);
95  if (!keys.empty()) {
96  float ht = triggerObjects[keys[0]].pt();
97  h_ht->Fill(ht);
98  }
99  }
100 
101  bool hasFired = false, hasFiredAuxiliaryForHadronicLeg = false;
102  const edm::TriggerNames &trigNames = e.triggerNames(*hltresults);
103  unsigned int numTriggers = trigNames.size();
104  for (unsigned int hltIndex = 0; hltIndex < numTriggers; ++hltIndex) {
105  if (trigNames.triggerName(hltIndex).find(triggerPath_) != std::string::npos && hltresults->wasrun(hltIndex) &&
106  hltresults->accept(hltIndex))
107  hasFired = true;
108  if (trigNames.triggerName(hltIndex).find(triggerPathAuxiliaryForHadronic_) != std::string::npos &&
109  hltresults->wasrun(hltIndex) && hltresults->accept(hltIndex))
110  hasFiredAuxiliaryForHadronicLeg = true;
111  }
112 
113  if (hasFiredAuxiliaryForHadronicLeg || !e.isRealData()) {
114  float recoPhotonPt = !photonCollection->empty() ? photonCollection->begin()->et() : 0;
115  float recoHt = !pfMETCollection->empty() ? pfMETCollection->begin()->et() : 0;
116 
117  if (hasFired) {
118  if (!photonCollection->empty() && recoHt >= htThrOffline_)
119  h_photonTurnOn_num->Fill(recoPhotonPt);
120  if (!pfMETCollection->empty() && recoPhotonPt >= ptThrOffline_)
121  h_htTurnOn_num->Fill(recoHt);
122  }
123  if (!photonCollection->empty() && recoHt >= htThrOffline_)
124  h_photonTurnOn_den->Fill(recoPhotonPt);
125  if (!pfMETCollection->empty() && recoPhotonPt >= ptThrOffline_)
126  h_htTurnOn_den->Fill(recoPhotonPt);
127  }
128 }
129 
131  ibooker_.cd();
132  ibooker_.setCurrentFolder("HLT/SUSYBSM/" + triggerPath_);
133 
134  // offline quantities
135  h_photonPt = ibooker_.book1D("photonPt", "Photon transverse momentum; p_{T} (GeV)", 20, 0, 500);
136  h_ht = ibooker_.book1D("ht", "Hadronic activity;H_{T} (GeV)", 20, 0, 2000);
137  h_htTurnOn_num = ibooker_.book1D("pfHtTurnOn_num", "PF HT Turn On Numerator", 20, 300, 800);
138  h_htTurnOn_den = ibooker_.book1D("pfHtTurnOn_den", "PF HT Turn On Denominator", 20, 300, 800);
139  h_photonTurnOn_num = ibooker_.book1D("photonTurnOn_num", "Photon Turn On Numerator", 20, 70, 130);
140  h_photonTurnOn_den = ibooker_.book1D("photonTurnOn_den", "Photon Turn On Denominator", 20, 70, 130);
141 
142  ibooker_.cd();
143 }
144 
145 // define this as a plug-in
MonitorElement * h_photonTurnOn_den
edm::EDGetTokenT< edm::TriggerResults > triggerResults_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
void bookHistos(DQMStore::IBooker &)
MonitorElement * h_ht
edm::InputTag triggerFilterHt_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::InputTag triggerFilterPhoton_
Log< level::Error, false > LogError
edm::EDGetTokenT< reco::PFMETCollection > thePfMETCollection_
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
MonitorElement * h_htTurnOn_den
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MonitorElement * h_photonPt
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
Log< level::Info, false > LogInfo
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:57
MonitorElement * h_htTurnOn_num
~SUSY_HLT_PhotonHT() override
std::vector< size_type > Keys
std::string triggerPathAuxiliaryForHadronic_
MonitorElement * h_photonTurnOn_num
std::string triggerPath_
edm::EDGetTokenT< reco::PhotonCollection > thePhotonCollection_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
edm::EDGetTokenT< trigger::TriggerEvent > theTrigSummary_
SUSY_HLT_PhotonHT(const edm::ParameterSet &ps)
Definition: Run.h:45