CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

 B2GDoubleLeptonHLTValidation (const edm::ParameterSet &)
 
 ~B2GDoubleLeptonHLTValidation () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr
< DQMEDAnalyzerGlobalCache
initializeGlobalCache (edm::ParameterSet const &)
 

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::TriggerResults
tokTrigger_
 
std::vector< std::string > vsPaths_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

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 49 of file B2GDoubleLeptonHLTValidation.h.

Constructor & Destructor Documentation

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

Definition at line 121 of file B2GDoubleLeptonHLTValidation.h.

References HLT_FULL_cff::InputTag, sElectrons_, sMuons_, sTrigger_, tokElectrons_, tokMuons_, and tokTrigger_.

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

Definition at line 146 of file B2GDoubleLeptonHLTValidation.h.

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

Member Function Documentation

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

Reimplemented from DQMEDAnalyzer.

Definition at line 46 of file B2GDoubleLeptonHLTValidation.cc.

References alignCSCRings::e, elec_, HI_PhotonSkim_cff::electrons, etaElectrons_, etaMuons_, dqm::impl::MonitorElement::Fill(), edm::Event::getByToken(), hDenLeptonEta, hDenLeptonPt, hDenTriggerMon, hNumLeptonEta, hNumLeptonPt, hNumTriggerMon, mps_fire::i, isAll_, edm::Ptr< T >::isNonnull(), isSel_, dqmiolumiharvest::j, visualization-live-secondInstance_cfg::m, minElectrons_, minLeptons_, minMuons_, mu_, patZpeak::muons, ptElectrons_, ptMuons_, tokElectrons_, tokMuons_, tokTrigger_, L1TMuonDQMOffline_cfi::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());
116  hDenLeptonEta->Fill(elec_->eta());
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());
129  hNumLeptonEta->Fill(elec_->eta());
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 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< edm::TriggerResults > tokTrigger_
edm::EDGetTokenT< edm::View< reco::Muon > > tokMuons_
edm::EDGetTokenT< edm::View< reco::GsfElectron > > tokElectrons_
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:275
void Fill(long long x)
edm::Ptr< reco::GsfElectron > elec_
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
tuple muons
Definition: patZpeak.py:41
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
void B2GDoubleLeptonHLTValidation::bookHistograms ( DQMStore::IBooker dbe,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 147 of file B2GDoubleLeptonHLTValidation.cc.

References dqm::implementation::IBooker::book1D(), hDenLeptonEta, hDenLeptonPt, hDenTriggerMon, hNumLeptonEta, hNumLeptonPt, hNumTriggerMon, sDir_, dqm::implementation::NavigatorBase::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 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
void triggerBinLabels(const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
void B2GDoubleLeptonHLTValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 164 of file B2GDoubleLeptonHLTValidation.cc.

References edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, 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 61 of file B2GDoubleLeptonHLTValidation.h.

Referenced by triggerBinLabels().

61 { 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 103 of file B2GDoubleLeptonHLTValidation.h.

References hDenTriggerMon, hNumTriggerMon, monitorPath(), and dqm::impl::MonitorElement::setBinLabel().

Referenced by bookHistograms().

103  {
104  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
105  hNumTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
106  hDenTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
107  }
108 }
virtual 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 75 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

double B2GDoubleLeptonHLTValidation::etaElectrons_
private

Definition at line 79 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

double B2GDoubleLeptonHLTValidation::etaMuons_
private

Definition at line 87 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

MonitorElement* B2GDoubleLeptonHLTValidation::hDenLeptonEta
private

Definition at line 71 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* B2GDoubleLeptonHLTValidation::hDenLeptonPt
private

Definition at line 69 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* B2GDoubleLeptonHLTValidation::hDenTriggerMon
private

Definition at line 73 of file B2GDoubleLeptonHLTValidation.h.

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

MonitorElement* B2GDoubleLeptonHLTValidation::hNumLeptonEta
private

Definition at line 70 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* B2GDoubleLeptonHLTValidation::hNumLeptonPt
private

Definition at line 68 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* B2GDoubleLeptonHLTValidation::hNumTriggerMon
private

Definition at line 72 of file B2GDoubleLeptonHLTValidation.h.

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

bool B2GDoubleLeptonHLTValidation::isAll_ = false
private

Definition at line 99 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

double B2GDoubleLeptonHLTValidation::isoElectrons_
private

Definition at line 80 of file B2GDoubleLeptonHLTValidation.h.

double B2GDoubleLeptonHLTValidation::isoMuons_
private

Definition at line 88 of file B2GDoubleLeptonHLTValidation.h.

bool B2GDoubleLeptonHLTValidation::isSel_ = false
private

Definition at line 100 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

unsigned int B2GDoubleLeptonHLTValidation::minElectrons_
private

Definition at line 81 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

unsigned int B2GDoubleLeptonHLTValidation::minLeptons_
private

Definition at line 92 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

unsigned int B2GDoubleLeptonHLTValidation::minMuons_
private

Definition at line 89 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

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

Definition at line 83 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

double B2GDoubleLeptonHLTValidation::ptElectrons_
private

Definition at line 78 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

double B2GDoubleLeptonHLTValidation::ptMuons_
private

Definition at line 86 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze().

std::string B2GDoubleLeptonHLTValidation::sDir_
private

Definition at line 67 of file B2GDoubleLeptonHLTValidation.h.

Referenced by bookHistograms().

std::string B2GDoubleLeptonHLTValidation::sElectrons_
private

Definition at line 76 of file B2GDoubleLeptonHLTValidation.h.

Referenced by B2GDoubleLeptonHLTValidation().

std::string B2GDoubleLeptonHLTValidation::sMuons_
private

Definition at line 84 of file B2GDoubleLeptonHLTValidation.h.

Referenced by B2GDoubleLeptonHLTValidation().

std::string B2GDoubleLeptonHLTValidation::sTrigger_
private

Definition at line 95 of file B2GDoubleLeptonHLTValidation.h.

Referenced by B2GDoubleLeptonHLTValidation().

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

Definition at line 77 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and B2GDoubleLeptonHLTValidation().

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

Definition at line 85 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and B2GDoubleLeptonHLTValidation().

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

Definition at line 96 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and B2GDoubleLeptonHLTValidation().

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

Definition at line 97 of file B2GDoubleLeptonHLTValidation.h.

Referenced by analyze(), and bookHistograms().