CMS 3D CMS Logo

B2GSingleLeptonHLTValidation.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTriggerOffline/B2G
4 // Class: B2GSingleLeptonHLTValidation
5 //
17 //
18 // Original Author: Elvire Bouvier
19 // Created: Thu, 16 Jan 2014 16:27:35 GMT
20 //
21 //
23 
24 // system include files
25 #include <memory>
26 
27 // user include files
29 
32 
35 
40 #include "TString.h"
41 //
42 // member functions
43 //
44 
45 // ------------ method called for each event ------------
47  using namespace edm;
48 
49  isAll_ = false;
50  isSel_ = false;
51 
52  // Electrons
54  if (!iEvent.getByToken(tokElectrons_, electrons))
55  edm::LogWarning("B2GSingleLeptonHLTValidation") << "Electrons collection not found \n";
56  unsigned int nGoodE = 0;
57  for (edm::View<reco::GsfElectron>::const_iterator e = electrons->begin(); e != electrons->end(); ++e) {
58  if (e->pt() < ptElectrons_)
59  continue;
60  if (fabs(e->eta()) > etaElectrons_)
61  continue;
62  nGoodE++;
63  if (nGoodE == 1)
64  elec_ = electrons->ptrAt(e - electrons->begin());
65  }
66  // Muons
68  if (!iEvent.getByToken(tokMuons_, muons))
69  edm::LogWarning("B2GSingleLeptonHLTValidation") << "Muons collection not found \n";
70  unsigned int nGoodM = 0;
71  for (edm::View<reco::Muon>::const_iterator m = muons->begin(); m != muons->end(); ++m) {
72  if (!m->isPFMuon() || !m->isGlobalMuon())
73  continue;
74  if (m->pt() < ptMuons_)
75  continue;
76  if (fabs(m->eta()) > etaMuons_)
77  continue;
78  nGoodM++;
79  if (nGoodM == 1)
80  mu_ = muons->ptrAt(m - muons->begin());
81  }
82  // Jets
84  if (!iEvent.getByToken(tokJets_, jets))
85  edm::LogWarning("B2GSingleLeptonHLTValidation") << "Jets collection not found \n";
86  unsigned int nGoodJ = 0;
87 
88  // Check to see if we want asymmetric jet pt cuts
89  if (ptJets0_ > 0.0 || ptJets1_ > 0.0) {
90  if (ptJets0_ > 0.0) {
91  if (!jets->empty() && jets->at(0).pt() > ptJets0_) {
92  nGoodJ++;
93  jet_ = jets->ptrAt(0);
94  }
95  }
96  if (ptJets1_ > 0.0) {
97  if (jets->size() > 1 && jets->at(1).pt() > ptJets1_) {
98  nGoodJ++;
99  jet_ = jets->ptrAt(1);
100  }
101  }
102  } else {
103  for (edm::View<reco::Jet>::const_iterator j = jets->begin(); j != jets->end(); ++j) {
104  if (j->pt() < ptJets_)
105  continue;
106  if (fabs(j->eta()) > etaJets_)
107  continue;
108  nGoodJ++;
109  if (nGoodJ == minJets_)
110  jet_ = jets->ptrAt(j - jets->begin());
111  }
112  }
113 
114  if (nGoodE >= minElectrons_ && nGoodM >= minMuons_ && nGoodJ >= minJets_)
115  isAll_ = true;
116 
117  // Trigger
118  Handle<edm::TriggerResults> triggerTable;
119  if (!iEvent.getByToken(tokTrigger_, triggerTable))
120  edm::LogWarning("B2GSingleLeptonHLTValidation") << "Trigger collection not found \n";
121  const edm::TriggerNames &triggerNames = iEvent.triggerNames(*triggerTable);
122  bool isInteresting = false;
123  for (unsigned int i = 0; i < triggerNames.triggerNames().size(); ++i) {
124  TString name = triggerNames.triggerNames()[i].c_str();
125  for (unsigned int j = 0; j < vsPaths_.size(); j++) {
126  if (name.Contains(TString(vsPaths_[j]), TString::kIgnoreCase)) {
127  isInteresting = true;
128  break;
129  }
130  }
131  if (isInteresting)
132  break;
133  }
134 
135  if (isAll_ && isInteresting)
136  isSel_ = true;
137  else
138  isSel_ = false;
139 
140  // Histos
141  if (isAll_) {
142  if (minElectrons_ > 0 && elec_.isNonnull()) {
143  hDenLeptonPt->Fill(elec_->pt());
145  }
146  if (minMuons_ > 0 && mu_.isNonnull()) {
147  hDenLeptonPt->Fill(mu_->pt());
148  hDenLeptonEta->Fill(mu_->eta());
149  }
150  if (jet_.isNonnull()) {
151  hDenJetPt->Fill(jet_->pt());
152  hDenJetEta->Fill(jet_->eta());
153  }
154  for (unsigned int idx = 0; idx < vsPaths_.size(); ++idx) {
155  hDenTriggerMon->Fill(idx + 0.5);
156  }
157  }
158  if (isSel_) {
159  if (minElectrons_ > 0 && elec_.isNonnull()) {
160  hNumLeptonPt->Fill(elec_->pt());
162  }
163  if (minMuons_ > 0 && mu_.isNonnull()) {
164  hNumLeptonPt->Fill(mu_->pt());
165  hNumLeptonEta->Fill(mu_->eta());
166  }
167  if (jet_.isNonnull()) {
168  hNumJetPt->Fill(jet_->pt());
169  hNumJetEta->Fill(jet_->eta());
170  }
171  for (unsigned int i = 0; i < triggerNames.triggerNames().size(); ++i) {
172  TString name = triggerNames.triggerNames()[i].c_str();
173  for (unsigned int j = 0; j < vsPaths_.size(); j++) {
174  if (name.Contains(TString(vsPaths_[j]), TString::kIgnoreCase)) {
175  hNumTriggerMon->Fill(j + 0.5);
176  }
177  }
178  }
179  }
180 }
181 
182 // ------------ booking histograms -----------
184  dbe.setCurrentFolder(sDir_);
185  hDenLeptonPt = dbe.book1D("PtLeptonAll", "PtLeptonAll", 50, 0., 2500.);
186  hDenLeptonEta = dbe.book1D("EtaLeptonAll", "EtaLeptonAll", 30, -3., 3.);
187  hDenJetPt = dbe.book1D("PtLastJetAll", "PtLastJetAll", 60, 0., 3000.);
188  hDenJetEta = dbe.book1D("EtaLastJetAll", "EtaLastJetAll", 30, -3., 3.);
189  hNumLeptonPt = dbe.book1D("PtLeptonSel", "PtLeptonSel", 50, 0., 2500.);
190  hNumLeptonEta = dbe.book1D("EtaLeptonSel", "EtaLeptonSel", 30, -3., 3.);
191  hNumJetPt = dbe.book1D("PtLastJetSel", "PtLastJetSel", 60, 0., 3000.);
192  hNumJetEta = dbe.book1D("EtaLastJetSel", "EtaLastJetSel", 30, -3., 3.);
193  // determine number of bins for trigger monitoring
194  unsigned int nPaths = vsPaths_.size();
195  // monitored trigger occupancy for single lepton triggers
196  hNumTriggerMon = dbe.book1D("TriggerMonSel", "TriggerMonSel", nPaths, 0., nPaths);
197  hDenTriggerMon = dbe.book1D("TriggerMonAll", "TriggerMonAll", nPaths, 0., nPaths);
198  // set bin labels for trigger monitoring
200 }
201 
202 // ------------ method fills 'descriptions' with the allowed parameters for the
203 // module ------------
205  // The following says we do not know what parameters are allowed so do no
206  // validation
207  // Please change this to state exactly what you do use, even if it is no
208  // parameters
210  desc.setUnknown();
211  descriptions.addDefault(desc);
212 }
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
B2GSingleLeptonHLTValidation::hNumJetPt
MonitorElement * hNumJetPt
Definition: B2GSingleLeptonHLTValidation.h:72
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
B2GSingleLeptonHLTValidation::isSel_
bool isSel_
Definition: B2GSingleLeptonHLTValidation.h:109
B2GSingleLeptonHLTValidation::ptJets0_
double ptJets0_
Definition: B2GSingleLeptonHLTValidation.h:99
B2GSingleLeptonHLTValidation::hNumTriggerMon
MonitorElement * hNumTriggerMon
Definition: B2GSingleLeptonHLTValidation.h:76
B2GSingleLeptonHLTValidation::hDenJetEta
MonitorElement * hDenJetEta
Definition: B2GSingleLeptonHLTValidation.h:75
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
B2GSingleLeptonHLTValidation::tokElectrons_
edm::EDGetTokenT< edm::View< reco::GsfElectron > > tokElectrons_
Definition: B2GSingleLeptonHLTValidation.h:81
B2GSingleLeptonHLTValidation::triggerBinLabels
void triggerBinLabels(const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
Definition: B2GSingleLeptonHLTValidation.h:112
B2GSingleLeptonHLTValidation::ptJets_
double ptJets_
Definition: B2GSingleLeptonHLTValidation.h:98
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
B2GSingleLeptonHLTValidation::hDenLeptonEta
MonitorElement * hDenLeptonEta
Definition: B2GSingleLeptonHLTValidation.h:71
B2GSingleLeptonHLTValidation::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: B2GSingleLeptonHLTValidation.cc:46
edm::Handle
Definition: AssociativeIterator.h:50
B2GSingleLeptonHLTValidation::vsPaths_
std::vector< std::string > vsPaths_
Definition: B2GSingleLeptonHLTValidation.h:106
B2GSingleLeptonHLTValidation::hDenJetPt
MonitorElement * hDenJetPt
Definition: B2GSingleLeptonHLTValidation.h:73
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
B2GSingleLeptonHLTValidation::hNumLeptonPt
MonitorElement * hNumLeptonPt
Definition: B2GSingleLeptonHLTValidation.h:68
B2GSingleLeptonHLTValidation::jet_
edm::Ptr< reco::Jet > jet_
Definition: B2GSingleLeptonHLTValidation.h:95
MuonPFIsolation.h
MakerMacros.h
B2GSingleLeptonHLTValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: B2GSingleLeptonHLTValidation.cc:183
B2GSingleLeptonHLTValidation::sDir_
std::string sDir_
Definition: B2GSingleLeptonHLTValidation.h:67
L1TEGammaOffline_cfi.triggerNames
triggerNames
Definition: L1TEGammaOffline_cfi.py:40
Service.h
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:79
B2GSingleLeptonHLTValidation::minElectrons_
unsigned int minElectrons_
Definition: B2GSingleLeptonHLTValidation.h:85
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
B2GSingleLeptonHLTValidation::etaMuons_
double etaMuons_
Definition: B2GSingleLeptonHLTValidation.h:91
B2GSingleLeptonHLTValidation::isAll_
bool isAll_
Definition: B2GSingleLeptonHLTValidation.h:108
B2GSingleLeptonHLTValidation::minJets_
unsigned int minJets_
Definition: B2GSingleLeptonHLTValidation.h:102
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
B2GSingleLeptonHLTValidation::hNumLeptonEta
MonitorElement * hNumLeptonEta
Definition: B2GSingleLeptonHLTValidation.h:70
Event.h
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
B2GSingleLeptonHLTValidation::hDenTriggerMon
MonitorElement * hDenTriggerMon
Definition: B2GSingleLeptonHLTValidation.h:77
B2GSingleLeptonHLTValidation::tokJets_
edm::EDGetTokenT< edm::View< reco::Jet > > tokJets_
Definition: B2GSingleLeptonHLTValidation.h:97
TriggerNames.h
iEvent
int iEvent
Definition: GenABIO.cc:224
B2GSingleLeptonHLTValidation::hNumJetEta
MonitorElement * hNumJetEta
Definition: B2GSingleLeptonHLTValidation.h:74
B2GSingleLeptonHLTValidation::etaElectrons_
double etaElectrons_
Definition: B2GSingleLeptonHLTValidation.h:83
B2GSingleLeptonHLTValidation.h
edm::EventSetup
Definition: EventSetup.h:58
B2GSingleLeptonHLTValidation::ptElectrons_
double ptElectrons_
Definition: B2GSingleLeptonHLTValidation.h:82
HLTConfigProvider.h
B2GSingleLeptonHLTValidation::tokMuons_
edm::EDGetTokenT< edm::View< reco::Muon > > tokMuons_
Definition: B2GSingleLeptonHLTValidation.h:89
B2GSingleLeptonHLTValidation::ptMuons_
double ptMuons_
Definition: B2GSingleLeptonHLTValidation.h:90
B2GSingleLeptonHLTValidation::mu_
edm::Ptr< reco::Muon > mu_
Definition: B2GSingleLeptonHLTValidation.h:87
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
B2GSingleLeptonHLTValidation::tokTrigger_
edm::EDGetTokenT< edm::TriggerResults > tokTrigger_
Definition: B2GSingleLeptonHLTValidation.h:105
B2GSingleLeptonHLTValidation::hDenLeptonPt
MonitorElement * hDenLeptonPt
Definition: B2GSingleLeptonHLTValidation.h:69
B2GSingleLeptonHLTValidation::ptJets1_
double ptJets1_
Definition: B2GSingleLeptonHLTValidation.h:100
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
Frameworkfwd.h
edm::TriggerNames
Definition: TriggerNames.h:55
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
B2GSingleLeptonHLTValidation::elec_
edm::Ptr< reco::GsfElectron > elec_
Definition: B2GSingleLeptonHLTValidation.h:79
edm::Ptr::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
dqm::implementation::IBooker
Definition: DQMStore.h:43
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
ParameterSet.h
B2GSingleLeptonHLTValidation::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: B2GSingleLeptonHLTValidation.cc:204
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
B2GSingleLeptonHLTValidation::minMuons_
unsigned int minMuons_
Definition: B2GSingleLeptonHLTValidation.h:93
edm::Event
Definition: Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::Log
Definition: MessageLogger.h:70
B2GSingleLeptonHLTValidation::etaJets_
double etaJets_
Definition: B2GSingleLeptonHLTValidation.h:101
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
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37