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