CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
B2GDoubleLeptonHLTValidation Class Reference

#include <B2GDoubleLeptonHLTValidation.h>

Inheritance diagram for B2GDoubleLeptonHLTValidation:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

 B2GDoubleLeptonHLTValidation (const edm::ParameterSet &)
 
 ~B2GDoubleLeptonHLTValidation () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
std::string monitorPath (const std::string &label) const
 
void triggerBinLabels (const std::vector< std::string > &labels)
 set configurable labels for trigger monitoring histograms More...
 

Private Attributes

edm::Ptr< reco::GsfElectronelec_
 
double etaElectrons_
 
double etaMuons_
 
MonitorElementhDenLeptonEta
 
MonitorElementhDenLeptonPt
 
MonitorElementhDenTriggerMon
 
MonitorElementhNumLeptonEta
 
MonitorElementhNumLeptonPt
 
MonitorElementhNumTriggerMon
 
bool isAll_ = false
 
double isoElectrons_
 
double isoMuons_
 
bool isSel_ = false
 
unsigned int minElectrons_
 
unsigned int minLeptons_
 
unsigned int minMuons_
 
edm::Ptr< reco::Muonmu_
 
double ptElectrons_
 
double ptMuons_
 
std::string sDir_
 
std::string sElectrons_
 
std::string sMuons_
 
std::string sTrigger_
 
edm::EDGetTokenT< edm::View< reco::GsfElectron > > tokElectrons_
 
edm::EDGetTokenT< edm::View< reco::Muon > > tokMuons_
 
edm::EDGetTokenT< edm::TriggerResultstokTrigger_
 
std::vector< std::string > vsPaths_
 

Detailed Description

HLTriggerOffline/B2G/interface/B2GDoubleLeptonHLTValidation.h

Description: compute efficiencies of trigger paths on offline reco selection with respect to pt and eta

Implementation: harvesting

HLTriggerOffline/B2G/src/B2GDoubleLeptonHLTValidation.cc

Description:

Description: compute efficiencies of trigger paths on offline reco selection with respect to subleading lepton pt and eta

Implementation: harvesting

Definition at line 50 of file B2GDoubleLeptonHLTValidation.h.

Constructor & Destructor Documentation

B2GDoubleLeptonHLTValidation::B2GDoubleLeptonHLTValidation ( const edm::ParameterSet iConfig)
explicit

Definition at line 122 of file B2GDoubleLeptonHLTValidation.h.

References sElectrons_, sMuons_, sTrigger_, tokElectrons_, tokMuons_, and tokTrigger_.

123  : sDir_(iConfig.getUntrackedParameter<std::string>("sDir", "HLTValidation/B2G/Efficiencies/")),
124  sElectrons_(iConfig.getUntrackedParameter<std::string>("sElectrons", "gsfElectrons")),
125  ptElectrons_(iConfig.getUntrackedParameter<double>("ptElectrons", 0.)),
126  etaElectrons_(iConfig.getUntrackedParameter<double>("etaElectrons", 0.)),
127  isoElectrons_(iConfig.getUntrackedParameter<double>("isoElectrons", 0.)),
128  minElectrons_(iConfig.getUntrackedParameter<unsigned int>("minElectrons", 0)),
129  sMuons_(iConfig.getUntrackedParameter<std::string>("sMuons", "muons")),
130  ptMuons_(iConfig.getUntrackedParameter<double>("ptMuons", 0.)),
131  etaMuons_(iConfig.getUntrackedParameter<double>("etaMuons", 0.)),
132  isoMuons_(iConfig.getUntrackedParameter<double>("isoMuons", 0.)),
133  minMuons_(iConfig.getUntrackedParameter<unsigned int>("minMuons", 0)),
134  minLeptons_(iConfig.getUntrackedParameter<unsigned int>("minLeptons", 0)),
135  sTrigger_(iConfig.getUntrackedParameter<std::string>("sTrigger", "TriggerResults")),
136  vsPaths_(iConfig.getUntrackedParameter<std::vector<std::string>>("vsPaths"))
137 
138 {
139  // Electrons
140  tokElectrons_ = consumes<edm::View<reco::GsfElectron>>(edm::InputTag(sElectrons_));
141  // Muons
142  tokMuons_ = consumes<edm::View<reco::Muon>>(edm::InputTag(sMuons_));
143  // Trigger
144  tokTrigger_ = consumes<edm::TriggerResults>(edm::InputTag(sTrigger_, "", "HLT"));
145 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::TriggerResults > tokTrigger_
edm::EDGetTokenT< edm::View< reco::Muon > > tokMuons_
edm::EDGetTokenT< edm::View< reco::GsfElectron > > tokElectrons_
B2GDoubleLeptonHLTValidation::~B2GDoubleLeptonHLTValidation ( )
override

Definition at line 147 of file B2GDoubleLeptonHLTValidation.h.

References DEFINE_FWK_MODULE.

147  {
148  // do anything here that needs to be done at desctruction time
149  // (e.g. close files, deallocate resources etc.)
150 }

Member Function Documentation

void B2GDoubleLeptonHLTValidation::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 46 of file B2GDoubleLeptonHLTValidation.cc.

References MillePedeFileConverter_cfg::e, elec_, nano_cff::electrons, reco::LeafCandidate::eta(), etaElectrons_, etaMuons_, MonitorElement::Fill(), edm::Event::getByToken(), hDenLeptonEta, hDenLeptonPt, hDenTriggerMon, hNumLeptonEta, hNumLeptonPt, hNumTriggerMon, mps_fire::i, training_settings::idx, isAll_, edm::Ptr< T >::isNonnull(), isSel_, funct::m, minElectrons_, minLeptons_, minMuons_, mu_, extraflags_cff::muons, reco::LeafCandidate::pt(), ptElectrons_, ptMuons_, tokElectrons_, tokMuons_, tokTrigger_, edm::TriggerNames::triggerNames(), edm::Event::triggerNames(), and vsPaths_.

46  {
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 }
double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< edm::TriggerResults > tokTrigger_
double pt() const final
transverse momentum
edm::EDGetTokenT< edm::View< reco::Muon > > tokMuons_
Strings const & triggerNames() const
Definition: TriggerNames.cc:20
edm::EDGetTokenT< edm::View< reco::GsfElectron > > tokElectrons_
void Fill(long long x)
edm::Ptr< reco::GsfElectron > elec_
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:256
void B2GDoubleLeptonHLTValidation::bookHistograms ( DQMStore::IBooker dbe,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivate

Definition at line 147 of file B2GDoubleLeptonHLTValidation.cc.

References DQMStore::IBooker::book1D(), hDenLeptonEta, hDenLeptonPt, hDenTriggerMon, hNumLeptonEta, hNumLeptonPt, hNumTriggerMon, sDir_, DQMStore::IBooker::setCurrentFolder(), triggerBinLabels(), and vsPaths_.

147  {
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 }
void triggerBinLabels(const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
void B2GDoubleLeptonHLTValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 164 of file B2GDoubleLeptonHLTValidation.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

164  {
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 }
void addDefault(ParameterSetDescription const &psetDescription)
std::string B2GDoubleLeptonHLTValidation::monitorPath ( const std::string &  label) const
inlineprivate

deduce monitorPath from label, the label is expected to be of type 'selectionPath:monitorPath'

Definition at line 62 of file B2GDoubleLeptonHLTValidation.h.

References tablePrinter::labels, and triggerBinLabels().

Referenced by triggerBinLabels().

62 { return label.substr(label.find(':') + 1); };
char const * label
void B2GDoubleLeptonHLTValidation::triggerBinLabels ( const std::vector< std::string > &  labels)
inlineprivate

set configurable labels for trigger monitoring histograms

Definition at line 104 of file B2GDoubleLeptonHLTValidation.h.

References hDenTriggerMon, hNumTriggerMon, training_settings::idx, monitorPath(), and MonitorElement::setBinLabel().

Referenced by bookHistograms(), and monitorPath().

104  {
105  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
106  hNumTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
107  hDenTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
108  }
109 }
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::string monitorPath(const std::string &label) const

Member Data Documentation

edm::Ptr<reco::GsfElectron> B2GDoubleLeptonHLTValidation::elec_
private

Definition at line 76 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

double B2GDoubleLeptonHLTValidation::etaElectrons_
private

Definition at line 80 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

double B2GDoubleLeptonHLTValidation::etaMuons_
private

Definition at line 88 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

MonitorElement* B2GDoubleLeptonHLTValidation::hDenLeptonEta
private

Definition at line 72 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* B2GDoubleLeptonHLTValidation::hDenLeptonPt
private

Definition at line 70 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* B2GDoubleLeptonHLTValidation::hDenTriggerMon
private

Definition at line 74 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), bookHistograms(), and triggerBinLabels().

MonitorElement* B2GDoubleLeptonHLTValidation::hNumLeptonEta
private

Definition at line 71 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* B2GDoubleLeptonHLTValidation::hNumLeptonPt
private

Definition at line 69 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* B2GDoubleLeptonHLTValidation::hNumTriggerMon
private

Definition at line 73 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), bookHistograms(), and triggerBinLabels().

bool B2GDoubleLeptonHLTValidation::isAll_ = false
private

Definition at line 100 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

double B2GDoubleLeptonHLTValidation::isoElectrons_
private

Definition at line 81 of file B2GDoubleLeptonHLTValidation.h.

double B2GDoubleLeptonHLTValidation::isoMuons_
private

Definition at line 89 of file B2GDoubleLeptonHLTValidation.h.

bool B2GDoubleLeptonHLTValidation::isSel_ = false
private

Definition at line 101 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

unsigned int B2GDoubleLeptonHLTValidation::minElectrons_
private

Definition at line 82 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

unsigned int B2GDoubleLeptonHLTValidation::minLeptons_
private

Definition at line 93 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

unsigned int B2GDoubleLeptonHLTValidation::minMuons_
private

Definition at line 90 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

edm::Ptr<reco::Muon> B2GDoubleLeptonHLTValidation::mu_
private

Definition at line 84 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

double B2GDoubleLeptonHLTValidation::ptElectrons_
private

Definition at line 79 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

double B2GDoubleLeptonHLTValidation::ptMuons_
private

Definition at line 87 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

std::string B2GDoubleLeptonHLTValidation::sDir_
private

Definition at line 68 of file B2GDoubleLeptonHLTValidation.h.

Referenced by bookHistograms().

std::string B2GDoubleLeptonHLTValidation::sElectrons_
private

Definition at line 77 of file B2GDoubleLeptonHLTValidation.h.

Referenced by B2GDoubleLeptonHLTValidation().

std::string B2GDoubleLeptonHLTValidation::sMuons_
private

Definition at line 85 of file B2GDoubleLeptonHLTValidation.h.

Referenced by B2GDoubleLeptonHLTValidation().

std::string B2GDoubleLeptonHLTValidation::sTrigger_
private

Definition at line 96 of file B2GDoubleLeptonHLTValidation.h.

Referenced by B2GDoubleLeptonHLTValidation().

edm::EDGetTokenT<edm::View<reco::GsfElectron> > B2GDoubleLeptonHLTValidation::tokElectrons_
private

Definition at line 78 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and B2GDoubleLeptonHLTValidation().

edm::EDGetTokenT<edm::View<reco::Muon> > B2GDoubleLeptonHLTValidation::tokMuons_
private

Definition at line 86 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and B2GDoubleLeptonHLTValidation().

edm::EDGetTokenT<edm::TriggerResults> B2GDoubleLeptonHLTValidation::tokTrigger_
private

Definition at line 97 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and B2GDoubleLeptonHLTValidation().

std::vector<std::string> B2GDoubleLeptonHLTValidation::vsPaths_
private

Definition at line 98 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and bookHistograms().