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
MessageLogger.h
trigNames
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:57
triggerMatchMonitor_cfi.triggerObjects
triggerObjects
Definition: triggerMatchMonitor_cfi.py:15
HLTBitAnalyser_cfi.hltresults
hltresults
Definition: HLTBitAnalyser_cfi.py:13
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
edm::Run
Definition: Run.h:45
SUSY_HLT_PhotonHT::htThrOffline_
double htThrOffline_
Definition: SUSY_HLT_PhotonHT.h:53
SUSY_HLT_PhotonHT::h_htTurnOn_den
MonitorElement * h_htTurnOn_den
Definition: SUSY_HLT_PhotonHT.h:59
edm::LogInfo
Definition: MessageLogger.h:254
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
SUSY_HLT_PhotonHT::triggerFilterPhoton_
edm::InputTag triggerFilterPhoton_
Definition: SUSY_HLT_PhotonHT.h:50
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
SUSY_HLT_PhotonHT::triggerPathAuxiliaryForHadronic_
std::string triggerPathAuxiliaryForHadronic_
Definition: SUSY_HLT_PhotonHT.h:49
HLTMuonOfflineAnalyzer_cfi.triggerSummary
triggerSummary
Definition: HLTMuonOfflineAnalyzer_cfi.py:86
edm::Handle< reco::PFMETCollection >
SUSY_HLT_PhotonHT::triggerFilterHt_
edm::InputTag triggerFilterHt_
Definition: SUSY_HLT_PhotonHT.h:51
SUSY_HLT_PhotonHT::h_htTurnOn_num
MonitorElement * h_htTurnOn_num
Definition: SUSY_HLT_PhotonHT.h:58
MakerMacros.h
SUSY_HLT_PhotonHT::thePfMETCollection_
edm::EDGetTokenT< reco::PFMETCollection > thePfMETCollection_
Definition: SUSY_HLT_PhotonHT.h:43
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
SUSY_HLT_PhotonHT::h_ht
MonitorElement * h_ht
Definition: SUSY_HLT_PhotonHT.h:57
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
SUSY_HLT_PhotonHT::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: SUSY_HLT_PhotonHT.cc:27
SUSY_HLT_PhotonHT::triggerResults_
edm::EDGetTokenT< edm::TriggerResults > triggerResults_
Definition: SUSY_HLT_PhotonHT.h:45
trigger::TriggerObjectCollection
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
SUSY_HLT_PhotonHT::triggerPath_
std::string triggerPath_
Definition: SUSY_HLT_PhotonHT.h:48
TriggerNames.h
SUSY_HLT_PhotonHT::analyze
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
Definition: SUSY_HLT_PhotonHT.cc:33
trigger::Keys
std::vector< size_type > Keys
Definition: TriggerTypeDefs.h:19
SUSY_HLT_PhotonHT::bookHistos
void bookHistos(DQMStore::IBooker &)
Definition: SUSY_HLT_PhotonHT.cc:130
edm::EventSetup
Definition: EventSetup.h:57
TriggerObject.h
SUSY_HLT_PhotonHT::thePhotonCollection_
edm::EDGetTokenT< reco::PhotonCollection > thePhotonCollection_
Definition: SUSY_HLT_PhotonHT.h:44
SUSY_HLT_PhotonHT::~SUSY_HLT_PhotonHT
~SUSY_HLT_PhotonHT() override
Definition: SUSY_HLT_PhotonHT.cc:23
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
SUSY_HLT_PhotonHT::h_photonPt
MonitorElement * h_photonPt
Definition: SUSY_HLT_PhotonHT.h:56
B2GDQM_cfi.pfMETCollection
pfMETCollection
Definition: B2GDQM_cfi.py:27
Frameworkfwd.h
SUSY_HLT_PhotonHT::ptThrOffline_
double ptThrOffline_
Definition: SUSY_HLT_PhotonHT.h:52
edm::TriggerNames
Definition: TriggerNames.h:55
dqm::implementation::IBooker
Definition: DQMStore.h:43
SUSY_HLT_PhotonHT.h
ExoticaDQM_cfi.photonCollection
photonCollection
Definition: ExoticaDQM_cfi.py:17
edm::Event
Definition: Event.h:73
SUSY_HLT_PhotonHT::theTrigSummary_
edm::EDGetTokenT< trigger::TriggerEvent > theTrigSummary_
Definition: SUSY_HLT_PhotonHT.h:46
edm::InputTag
Definition: InputTag.h:15
SUSY_HLT_PhotonHT::SUSY_HLT_PhotonHT
SUSY_HLT_PhotonHT(const edm::ParameterSet &ps)
Definition: SUSY_HLT_PhotonHT.cc:8
SUSY_HLT_PhotonHT::h_photonTurnOn_num
MonitorElement * h_photonTurnOn_num
Definition: SUSY_HLT_PhotonHT.h:60
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
SUSY_HLT_PhotonHT::h_photonTurnOn_den
MonitorElement * h_photonTurnOn_den
Definition: SUSY_HLT_PhotonHT.h:61
SUSY_HLT_PhotonHT
Definition: SUSY_HLT_PhotonHT.h:29
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37