CMS 3D CMS Logo

B2GDoubleLeptonHLTValidation.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTriggerOffline/B2G
4 // Class: B2GDoubleLeptonHLTValidation
5 //
17 //
18 // Original Author: Clint Richardson (copy of B2GSingleLeptonHLTValidation)
19 // Created: Tue, 05 Apr 2016 14:27:00 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("B2GDoubleLeptonHLTValidation") << "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  // leptons come sorted so use only 2nd
64  if (nGoodE == 2)
65  elec_ = electrons->ptrAt(e - electrons->begin());
66  }
67  // Muons
69  if (!iEvent.getByToken(tokMuons_, muons))
70  edm::LogWarning("B2GDoubleLeptonHLTValidation") << "Muons collection not found \n";
71  unsigned int nGoodM = 0;
72  for (edm::View<reco::Muon>::const_iterator m = muons->begin(); m != muons->end(); ++m) {
73  if (!m->isPFMuon() || !m->isGlobalMuon())
74  continue;
75  if (m->pt() < ptMuons_)
76  continue;
77  if (fabs(m->eta()) > etaMuons_)
78  continue;
79  nGoodM++;
80  // leptons come sorted so use only 2nd
81  if (nGoodM == 2)
82  mu_ = muons->ptrAt(m - muons->begin());
83  }
84 
85  if (nGoodE >= minElectrons_ && nGoodM >= minMuons_ && nGoodE + nGoodM >= minLeptons_)
86  isAll_ = true;
87 
88  // Trigger
89  Handle<edm::TriggerResults> triggerTable;
90  if (!iEvent.getByToken(tokTrigger_, triggerTable))
91  edm::LogWarning("B2GDoubleLeptonHLTValidation") << "Trigger collection not found \n";
92  const edm::TriggerNames &triggerNames = iEvent.triggerNames(*triggerTable);
93  bool isInteresting = false;
94  for (unsigned int i = 0; i < triggerNames.triggerNames().size(); ++i) {
95  for (unsigned int j = 0; j < vsPaths_.size(); j++) {
96  if (triggerNames.triggerNames()[i].find(vsPaths_[j]) != std::string::npos) {
97  isInteresting = true;
98  break;
99  }
100  }
101  if (isInteresting)
102  break;
103  }
104 
105  if (isAll_ && isInteresting)
106  isSel_ = true;
107  else
108  isSel_ = false;
109 
110  // Histos
111  if (isAll_) {
112  // here and below, change to nGoodE/M instead of min since we are taking
113  // subleading
114  if (nGoodE > 1 && elec_.isNonnull()) {
115  hDenLeptonPt->Fill(elec_->pt());
117  }
118  if (nGoodM > 1 && mu_.isNonnull()) {
119  hDenLeptonPt->Fill(mu_->pt());
120  hDenLeptonEta->Fill(mu_->eta());
121  }
122  for (unsigned int idx = 0; idx < vsPaths_.size(); ++idx) {
123  hDenTriggerMon->Fill(idx + 0.5);
124  }
125  }
126  if (isSel_) {
127  if (nGoodE > 1 && elec_.isNonnull()) {
128  hNumLeptonPt->Fill(elec_->pt());
130  }
131  if (nGoodM > 1 && mu_.isNonnull()) {
132  hNumLeptonPt->Fill(mu_->pt());
133  hNumLeptonEta->Fill(mu_->eta());
134  }
135 
136  for (unsigned int i = 0; i < triggerNames.triggerNames().size(); ++i) {
137  for (unsigned int j = 0; j < vsPaths_.size(); j++) {
138  if (triggerNames.triggerNames()[i].find(vsPaths_[j]) != std::string::npos) {
139  hNumTriggerMon->Fill(j + 0.5);
140  }
141  }
142  }
143  }
144 }
145 
146 // ------------ booking histograms -----------
148  dbe.setCurrentFolder(sDir_);
149  hDenLeptonPt = dbe.book1D("PtLeptonAll", "PtLeptonAll", 50, 0., 2500.);
150  hDenLeptonEta = dbe.book1D("EtaLeptonAll", "EtaLeptonAll", 30, -3., 3.);
151  hNumLeptonPt = dbe.book1D("PtLeptonSel", "PtLeptonSel", 50, 0., 2500.);
152  hNumLeptonEta = dbe.book1D("EtaLeptonSel", "EtaLeptonSel", 30, -3., 3.);
153  // determine number of bins for trigger monitoring
154  unsigned int nPaths = vsPaths_.size();
155  // monitored trigger occupancy for single lepton triggers
156  hNumTriggerMon = dbe.book1D("TriggerMonSel", "TriggerMonSel", nPaths, 0., nPaths);
157  hDenTriggerMon = dbe.book1D("TriggerMonAll", "TriggerMonAll", nPaths, 0., nPaths);
158  // set bin labels for trigger monitoring
160 }
161 
162 // ------------ method fills 'descriptions' with the allowed parameters for the
163 // module ------------
165  // The following says we do not know what parameters are allowed so do no
166  // validation
167  // Please change this to state exactly what you do use, even if it is no
168  // parameters
170  desc.setUnknown();
171  descriptions.addDefault(desc);
172 }
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
B2GDoubleLeptonHLTValidation::elec_
edm::Ptr< reco::GsfElectron > elec_
Definition: B2GDoubleLeptonHLTValidation.h:75
edm::Run
Definition: Run.h:45
B2GDoubleLeptonHLTValidation::minLeptons_
unsigned int minLeptons_
Definition: B2GDoubleLeptonHLTValidation.h:92
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
B2GDoubleLeptonHLTValidation::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: B2GDoubleLeptonHLTValidation.cc:46
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
edm::Handle
Definition: AssociativeIterator.h:50
training_settings.idx
idx
Definition: training_settings.py:16
B2GDoubleLeptonHLTValidation::ptElectrons_
double ptElectrons_
Definition: B2GDoubleLeptonHLTValidation.h:78
B2GDoubleLeptonHLTValidation::hNumLeptonEta
MonitorElement * hNumLeptonEta
Definition: B2GDoubleLeptonHLTValidation.h:70
B2GDoubleLeptonHLTValidation::ptMuons_
double ptMuons_
Definition: B2GDoubleLeptonHLTValidation.h:86
MuonPFIsolation.h
MakerMacros.h
B2GDoubleLeptonHLTValidation::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: B2GDoubleLeptonHLTValidation.cc:164
L1TEGammaOffline_cfi.triggerNames
triggerNames
Definition: L1TEGammaOffline_cfi.py:40
Service.h
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
B2GDoubleLeptonHLTValidation::etaMuons_
double etaMuons_
Definition: B2GDoubleLeptonHLTValidation.h:87
B2GDoubleLeptonHLTValidation::vsPaths_
std::vector< std::string > vsPaths_
Definition: B2GDoubleLeptonHLTValidation.h:97
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
B2GDoubleLeptonHLTValidation::hDenTriggerMon
MonitorElement * hDenTriggerMon
Definition: B2GDoubleLeptonHLTValidation.h:73
edm::LogWarning
Definition: MessageLogger.h:141
B2GDoubleLeptonHLTValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: B2GDoubleLeptonHLTValidation.cc:147
B2GDoubleLeptonHLTValidation::hDenLeptonEta
MonitorElement * hDenLeptonEta
Definition: B2GDoubleLeptonHLTValidation.h:71
B2GDoubleLeptonHLTValidation::mu_
edm::Ptr< reco::Muon > mu_
Definition: B2GDoubleLeptonHLTValidation.h:83
Event.h
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
TriggerNames.h
iEvent
int iEvent
Definition: GenABIO.cc:224
B2GDoubleLeptonHLTValidation.h
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
B2GDoubleLeptonHLTValidation::tokTrigger_
edm::EDGetTokenT< edm::TriggerResults > tokTrigger_
Definition: B2GDoubleLeptonHLTValidation.h:96
B2GDoubleLeptonHLTValidation::minElectrons_
unsigned int minElectrons_
Definition: B2GDoubleLeptonHLTValidation.h:81
edm::EventSetup
Definition: EventSetup.h:57
HLTConfigProvider.h
B2GDoubleLeptonHLTValidation::hDenLeptonPt
MonitorElement * hDenLeptonPt
Definition: B2GDoubleLeptonHLTValidation.h:69
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
B2GDoubleLeptonHLTValidation::minMuons_
unsigned int minMuons_
Definition: B2GDoubleLeptonHLTValidation.h:89
B2GDoubleLeptonHLTValidation::etaElectrons_
double etaElectrons_
Definition: B2GDoubleLeptonHLTValidation.h:79
Frameworkfwd.h
B2GDoubleLeptonHLTValidation::triggerBinLabels
void triggerBinLabels(const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
Definition: B2GDoubleLeptonHLTValidation.h:103
edm::TriggerNames
Definition: TriggerNames.h:55
B2GDoubleLeptonHLTValidation::tokMuons_
edm::EDGetTokenT< edm::View< reco::Muon > > tokMuons_
Definition: B2GDoubleLeptonHLTValidation.h:85
B2GDoubleLeptonHLTValidation::isSel_
bool isSel_
Definition: B2GDoubleLeptonHLTValidation.h:100
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
B2GDoubleLeptonHLTValidation::isAll_
bool isAll_
Definition: B2GDoubleLeptonHLTValidation.h:99
B2GDoubleLeptonHLTValidation::tokElectrons_
edm::EDGetTokenT< edm::View< reco::GsfElectron > > tokElectrons_
Definition: B2GDoubleLeptonHLTValidation.h:77
ParameterSet.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
B2GDoubleLeptonHLTValidation::hNumTriggerMon
MonitorElement * hNumTriggerMon
Definition: B2GDoubleLeptonHLTValidation.h:72
B2GDoubleLeptonHLTValidation::sDir_
std::string sDir_
Definition: B2GDoubleLeptonHLTValidation.h:67
B2GDoubleLeptonHLTValidation::hNumLeptonPt
MonitorElement * hNumLeptonPt
Definition: B2GDoubleLeptonHLTValidation.h:68
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