CMS 3D CMS Logo

SUSY_HLT_InclusiveHT.cc
Go to the documentation of this file.
7 
9  edm::LogInfo("SUSY_HLT_InclusiveHT") << "Constructor SUSY_HLT_InclusiveHT::SUSY_HLT_InclusiveHT " << 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  thePfJetCollection_ = consumes<reco::PFJetCollection>(ps.getParameter<edm::InputTag>("pfJetCollection"));
14  theCaloJetCollection_ = consumes<reco::CaloJetCollection>(ps.getParameter<edm::InputTag>("caloJetCollection"));
15  triggerResults_ = consumes<edm::TriggerResults>(ps.getParameter<edm::InputTag>("TriggerResults"));
16  triggerPath_ = ps.getParameter<std::string>("TriggerPath");
17  triggerPathAuxiliaryForHadronic_ = ps.getParameter<std::string>("TriggerPathAuxiliaryForHadronic");
18  triggerFilter_ = ps.getParameter<edm::InputTag>("TriggerFilter");
19  ptThrJet_ = ps.getUntrackedParameter<double>("PtThrJet");
20  etaThrJet_ = ps.getUntrackedParameter<double>("EtaThrJet");
21 }
22 
24  edm::LogInfo("SUSY_HLT_InclusiveHT") << "Destructor SUSY_HLT_InclusiveHT::~SUSY_HLT_InclusiveHT " << std::endl;
25 }
26 
28  edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::beginRun" << std::endl;
29 }
30 
32  edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::bookHistograms" << std::endl;
33  // book at beginRun
34  bookHistos(ibooker_);
35 }
36 
38  edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::analyze" << std::endl;
39 
40  //-------------------------------
41  //--- MET
42  //-------------------------------
43  edm::Handle<reco::PFMETCollection> pfMETCollection;
44  e.getByToken(thePfMETCollection_, pfMETCollection);
45  if (!pfMETCollection.isValid()) {
46  edm::LogError("SUSY_HLT_InclusiveHT") << "invalid collection: PFMET"
47  << "\n";
48  return;
49  }
50  //-------------------------------
51  //--- Jets
52  //-------------------------------
53  edm::Handle<reco::PFJetCollection> pfJetCollection;
54  e.getByToken(thePfJetCollection_, pfJetCollection);
55  if (!pfJetCollection.isValid()) {
56  edm::LogError("SUSY_HLT_InclusiveHT") << "invalid collection: PFJets"
57  << "\n";
58  return;
59  }
60  edm::Handle<reco::CaloJetCollection> caloJetCollection;
61  e.getByToken(theCaloJetCollection_, caloJetCollection);
62  if (!caloJetCollection.isValid()) {
63  edm::LogError("SUSY_HLT_InclusiveHT") << "invalid collection: CaloJets"
64  << "\n";
65  return;
66  }
67 
68  // check what is in the menu
70  e.getByToken(triggerResults_, hltresults);
71  if (!hltresults.isValid()) {
72  edm::LogError("SUSY_HLT_InclusiveHT") << "invalid collection: TriggerResults"
73  << "\n";
74  return;
75  }
76 
77  //-------------------------------
78  //--- Trigger
79  //-------------------------------
81  e.getByToken(theTrigSummary_, triggerSummary);
82  if (!triggerSummary.isValid()) {
83  edm::LogError("SUSY_HLT_InclusiveHT") << "invalid collection: TriggerSummary"
84  << "\n";
85  return;
86  }
87 
88  // get online objects
89  size_t filterIndex = triggerSummary->filterIndex(triggerFilter_);
91  if (!(filterIndex >= triggerSummary->sizeFilters())) {
92  const trigger::Keys &keys = triggerSummary->filterKeys(filterIndex);
93  for (size_t j = 0; j < keys.size(); ++j) {
94  trigger::TriggerObject foundObject = triggerObjects[keys[j]];
95  // if(foundObject.id() == 85 && foundObject.pt() > 40.0 &&
96  // fabs(foundObject.eta()) < 3.0){
97  // h_triggerJetPt->Fill(foundObject.pt());
98  // h_triggerJetEta->Fill(foundObject.eta());
99  // h_triggerJetPhi->Fill(foundObject.phi());
100  //}
101  if (foundObject.id() == 87) {
102  h_triggerMetPt->Fill(foundObject.pt());
103  h_triggerMetPhi->Fill(foundObject.phi());
104  }
105  if (foundObject.id() == 89) {
106  h_triggerHT->Fill(foundObject.pt());
107  }
108  }
109  }
110 
111  bool hasFired = false, hasFiredAuxiliaryForHadronicLeg = false;
112  const edm::TriggerNames &trigNames = e.triggerNames(*hltresults);
113  unsigned int numTriggers = trigNames.size();
114  for (unsigned int hltIndex = 0; hltIndex < numTriggers; ++hltIndex) {
115  if (trigNames.triggerName(hltIndex).find(triggerPath_) != std::string::npos && hltresults->wasrun(hltIndex) &&
116  hltresults->accept(hltIndex))
117  hasFired = true;
118  if (trigNames.triggerName(hltIndex).find(triggerPathAuxiliaryForHadronic_) != std::string::npos &&
119  hltresults->wasrun(hltIndex) && hltresults->accept(hltIndex))
120  hasFiredAuxiliaryForHadronicLeg = true;
121  }
122 
123  if (hasFiredAuxiliaryForHadronicLeg || !e.isRealData()) {
124  float caloHT = 0.0;
125  float pfHT = 0.0;
126  for (reco::PFJetCollection::const_iterator i_pfjet = pfJetCollection->begin(); i_pfjet != pfJetCollection->end();
127  ++i_pfjet) {
128  if (i_pfjet->pt() < ptThrJet_)
129  continue;
130  if (fabs(i_pfjet->eta()) > etaThrJet_)
131  continue;
132  pfHT += i_pfjet->pt();
133  }
134 
135  if (hasFired) {
136  for (reco::CaloJetCollection::const_iterator i_calojet = caloJetCollection->begin();
137  i_calojet != caloJetCollection->end();
138  ++i_calojet) {
139  if (i_calojet->pt() < ptThrJet_)
140  continue;
141  if (fabs(i_calojet->eta()) > etaThrJet_)
142  continue;
143  h_caloJetPt->Fill(i_calojet->pt());
144  h_caloJetEta->Fill(i_calojet->eta());
145  h_caloJetPhi->Fill(i_calojet->phi());
146  caloHT += i_calojet->pt();
147  }
148  for (reco::PFJetCollection::const_iterator i_pfjet = pfJetCollection->begin(); i_pfjet != pfJetCollection->end();
149  ++i_pfjet) {
150  if (i_pfjet->pt() < ptThrJet_)
151  continue;
152  if (fabs(i_pfjet->eta()) > etaThrJet_)
153  continue;
154  h_pfJetPt->Fill(i_pfjet->pt());
155  h_pfJetEta->Fill(i_pfjet->eta());
156  h_pfJetPhi->Fill(i_pfjet->phi());
157  }
158  h_pfMet->Fill(pfMETCollection->begin()->et());
159  h_pfMetPhi->Fill(pfMETCollection->begin()->phi());
160  h_pfHT->Fill(pfHT);
161  h_caloHT->Fill(caloHT);
162 
163  h_pfMetTurnOn_num->Fill(pfMETCollection->begin()->et());
164  h_pfHTTurnOn_num->Fill(pfHT);
165  }
166  // fill denominator histograms for all events, used for turn on curves
167  h_pfMetTurnOn_den->Fill(pfMETCollection->begin()->et());
168  h_pfHTTurnOn_den->Fill(pfHT);
169  }
170 }
171 
173  edm::LogInfo("SUSY_HLT_InclusiveHT") << "SUSY_HLT_InclusiveHT::endRun" << std::endl;
174 }
175 
177  ibooker_.cd();
178  ibooker_.setCurrentFolder("HLT/SUSYBSM/" + triggerPath_);
179 
180  // offline quantities
181  h_pfMet = ibooker_.book1D("pfMet", "PF Missing E_{T}; GeV", 20, 0.0, 500.0);
182  h_pfMetPhi = ibooker_.book1D("pfMetPhi", "PF MET Phi", 20, -3.5, 3.5);
183  h_pfHT = ibooker_.book1D("pfHT", "PF H_{T}; GeV", 30, 0.0, 1500.0);
184  h_caloHT = ibooker_.book1D("caloHT", "Calo H_{T}; GeV", 30, 0.0, 1500.0);
185  h_pfJetPt = ibooker_.book1D("pfJetPt", "PFJet P_{T}; GeV", 20, 0.0, 500.0);
186  h_pfJetEta = ibooker_.book1D("pfJetEta", "PFJet Eta", 20, -3.0, 3.0);
187  h_pfJetPhi = ibooker_.book1D("pfJetPhi", "PFJet Phi", 20, -3.5, 3.5);
188  h_caloJetPt = ibooker_.book1D("caloJetPt", "CaloJet P_{T}; GeV", 20, 0.0, 500.0);
189  h_caloJetEta = ibooker_.book1D("caloJetEta", "CaloJet Eta", 20, -3.0, 3.0);
190  h_caloJetPhi = ibooker_.book1D("caloJetPhi", "CaloJet Phi", 20, -3.5, 3.5);
191 
192  // online quantities
193  // h_triggerJetPt = ibooker_.book1D("triggerJetPt", "Trigger Jet Pt; GeV", 20,
194  // 0.0, 500.0); h_triggerJetEta = ibooker_.book1D("triggerJetEta", "Trigger
195  // Jet Eta", 20, -3.0, 3.0); h_triggerJetPhi =
196  // ibooker_.book1D("triggerJetPhi", "Trigger Jet Phi", 20, -3.5, 3.5);
197  h_triggerMetPt = ibooker_.book1D("triggerMetPt", "Trigger Met Pt; GeV", 20, 0.0, 500.0);
198  h_triggerMetPhi = ibooker_.book1D("triggerMetPhi", "Trigger Met Phi", 20, -3.5, 3.5);
199  h_triggerHT = ibooker_.book1D("triggerHT", "Trigger HT; GeV", 30, 0.0, 1500.0);
200 
201  // num and den hists to be divided in harvesting step to make turn on curves
202  h_pfMetTurnOn_num = ibooker_.book1D("pfMetTurnOn_num", "PF MET Turn On Numerator", 20, 0.0, 500.0);
203  h_pfMetTurnOn_den = ibooker_.book1D("pfMetTurnOn_den", "PF MET Turn OnDenominator", 20, 0.0, 500.0);
204  h_pfHTTurnOn_num = ibooker_.book1D("pfHTTurnOn_num", "PF HT Turn On Numerator", 30, 0.0, 1500.0);
205  h_pfHTTurnOn_den = ibooker_.book1D("pfHTTurnOn_den", "PF HT Turn On Denominator", 30, 0.0, 1500.0);
206 
207  ibooker_.cd();
208 }
209 
210 // define this as a plug-in
MonitorElement * h_pfHTTurnOn_num
SUSY_HLT_InclusiveHT(const edm::ParameterSet &ps)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool wasrun() const
Was at least one path run?
int id() const
getters
Definition: TriggerObject.h:55
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:135
std::string triggerPathAuxiliaryForHadronic_
MonitorElement * h_caloHT
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
float phi() const
Definition: TriggerObject.h:58
bool accept() const
Has at least one path accepted the event?
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:123
MonitorElement * h_pfJetEta
MonitorElement * h_pfHTTurnOn_den
void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
Strings::size_type size() const
Definition: TriggerNames.cc:31
bool isRealData() const
Definition: EventBase.h:62
edm::EDGetTokenT< reco::PFJetCollection > thePfJetCollection_
void Fill(long long x)
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
edm::EDGetTokenT< trigger::TriggerEvent > theTrigSummary_
bool isValid() const
Definition: HandleBase.h:74
MonitorElement * h_pfMetPhi
MonitorElement * h_pfMetTurnOn_num
edm::EDGetTokenT< edm::TriggerResults > triggerResults_
MonitorElement * h_caloJetEta
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
MonitorElement * h_pfJetPt
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:74
MonitorElement * h_triggerMetPt
MonitorElement * h_triggerHT
void bookHistos(DQMStore::IBooker &)
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:22
std::vector< size_type > Keys
MonitorElement * h_caloJetPt
MonitorElement * h_pfMetTurnOn_den
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
MonitorElement * h_pfMet
MonitorElement * h_caloJetPhi
MonitorElement * h_triggerMetPhi
MonitorElement * h_pfJetPhi
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:256
edm::EDGetTokenT< reco::CaloJetCollection > theCaloJetCollection_
edm::EDGetTokenT< reco::PFMETCollection > thePfMETCollection_
Definition: Run.h:45