CMS 3D CMS Logo

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

#include <B2GHadronicHLTValidation.h>

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

Public Member Functions

 B2GHadronicHLTValidation (const edm::ParameterSet &)
 
 ~B2GHadronicHLTValidation () 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

double etaJets_
 
MonitorElementhDenJetEta
 
MonitorElementhDenJetPt
 
MonitorElementhDenTriggerMon
 
MonitorElementhNumJetEta
 
MonitorElementhNumJetPt
 
MonitorElementhNumTriggerMon
 
double htMin_
 
bool isAll_ = false
 
bool isSel_ = false
 
edm::Ptr< reco::Jetjet_
 
unsigned int minJets_
 
double ptJets0_
 
double ptJets1_
 
double ptJets_
 
std::string sDir_
 
std::string sJets_
 
std::string sTrigger_
 
edm::EDGetTokenT< edm::View< reco::Jet > > tokJets_
 
edm::EDGetTokenT< edm::TriggerResultstokTrigger_
 
std::vector< std::string > vsPaths_
 

Detailed Description

HLTriggerOffline/B2G/interface/B2GHadronicHLTValidation.h

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

Implementation: harvesting

HLTriggerOffline/B2G/src/B2GHadronicHLTValidation.cc

Description:

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

Implementation: harvesting

Definition at line 50 of file B2GHadronicHLTValidation.h.

Constructor & Destructor Documentation

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

Definition at line 112 of file B2GHadronicHLTValidation.h.

References sJets_, sTrigger_, tokJets_, and tokTrigger_.

113  : sDir_(iConfig.getUntrackedParameter<std::string>("sDir", "HLTValidation/B2G/Efficiencies/")),
114  sJets_(iConfig.getUntrackedParameter<std::string>("sJets", "ak5PFJets")),
115  ptJets_(iConfig.getUntrackedParameter<double>("ptJets", 0.)),
116  ptJets0_(iConfig.getUntrackedParameter<double>("ptJets0", 0.)),
117  ptJets1_(iConfig.getUntrackedParameter<double>("ptJets1", 0.)),
118  etaJets_(iConfig.getUntrackedParameter<double>("etaJets", 0.)),
119  minJets_(iConfig.getUntrackedParameter<unsigned int>("minJets", 0)),
120  htMin_(iConfig.getUntrackedParameter<double>("htMin", 0.0)),
121  sTrigger_(iConfig.getUntrackedParameter<std::string>("sTrigger", "TriggerResults")),
122  vsPaths_(iConfig.getUntrackedParameter<std::vector<std::string>>("vsPaths"))
123 
124 {
125  // Jets
126  tokJets_ = consumes<edm::View<reco::Jet>>(edm::InputTag(sJets_));
127  // Trigger
128  tokTrigger_ = consumes<edm::TriggerResults>(edm::InputTag(sTrigger_, "", "HLT"));
129 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::TriggerResults > tokTrigger_
edm::EDGetTokenT< edm::View< reco::Jet > > tokJets_
std::vector< std::string > vsPaths_
B2GHadronicHLTValidation::~B2GHadronicHLTValidation ( )
override

Definition at line 131 of file B2GHadronicHLTValidation.h.

References DEFINE_FWK_MODULE.

131  {
132  // do anything here that needs to be done at desctruction time
133  // (e.g. close files, deallocate resources etc.)
134 }

Member Function Documentation

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

Definition at line 45 of file B2GHadronicHLTValidation.cc.

References reco::LeafCandidate::eta(), etaJets_, MonitorElement::Fill(), edm::Event::getByToken(), hDenJetEta, hDenJetPt, hDenTriggerMon, hNumJetEta, hNumJetPt, hNumTriggerMon, htMin_, mps_fire::i, training_settings::idx, isAll_, edm::Ptr< T >::isNonnull(), isSel_, jet_, fwrapper::jets, minJets_, dataset::name, reco::LeafCandidate::pt(), ptJets0_, ptJets1_, ptJets_, tokJets_, tokTrigger_, edm::TriggerNames::triggerNames(), edm::Event::triggerNames(), and vsPaths_.

45  {
46  using namespace edm;
47 
48  isAll_ = false;
49  isSel_ = false;
50 
51  // Jets
53  if (!iEvent.getByToken(tokJets_, jets))
54  edm::LogWarning("B2GHadronicHLTValidation") << "Jets collection not found \n";
55  unsigned int nGoodJ = 0;
56  double ht = 0.0;
57  // Check to see if we want asymmetric jet pt cuts
58  if (ptJets0_ > 0.0 || ptJets1_ > 0.0) {
59  if (ptJets0_ > 0.0) {
60  if (!jets->empty() && jets->at(0).pt() > ptJets0_) {
61  nGoodJ++;
62  jet_ = jets->ptrAt(0);
63  }
64  }
65  if (ptJets1_ > 0.0) {
66  if (jets->size() > 1 && jets->at(1).pt() > ptJets1_) {
67  nGoodJ++;
68  jet_ = jets->ptrAt(1);
69  }
70  }
71  } else if (minJets_ > 0 || htMin_ > 0) {
72  for (edm::View<reco::Jet>::const_iterator j = jets->begin(); j != jets->end(); ++j) {
73  if (j->pt() < ptJets_)
74  continue;
75  if (fabs(j->eta()) > etaJets_)
76  continue;
77  nGoodJ++;
78  ht += j->pt();
79  if (nGoodJ == minJets_)
80  jet_ = jets->ptrAt(j - jets->begin());
81  }
82  }
83 
84  if (nGoodJ >= minJets_ || ht > htMin_)
85  isAll_ = true;
86 
87  // Trigger
88  Handle<edm::TriggerResults> triggerTable;
89  if (!iEvent.getByToken(tokTrigger_, triggerTable))
90  edm::LogWarning("B2GHadronicHLTValidation") << "Trigger collection not found \n";
91  const edm::TriggerNames &triggerNames = iEvent.triggerNames(*triggerTable);
92  bool isInteresting = false;
93  for (unsigned int i = 0; i < triggerNames.triggerNames().size(); ++i) {
94  TString name = triggerNames.triggerNames()[i].c_str();
95  for (unsigned int j = 0; j < vsPaths_.size(); j++) {
96  if (name.Contains(TString(vsPaths_[j]), TString::kIgnoreCase)) {
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  if (jet_.isNonnull()) {
113  hDenJetPt->Fill(jet_->pt());
114  hDenJetEta->Fill(jet_->eta());
115  }
116  for (unsigned int idx = 0; idx < vsPaths_.size(); ++idx) {
117  hDenTriggerMon->Fill(idx + 0.5);
118  }
119  }
120  if (isSel_) {
121  hNumJetPt->Fill(jet_->pt());
122  hNumJetEta->Fill(jet_->eta());
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  hNumTriggerMon->Fill(j + 0.5);
128  }
129  }
130  }
131  }
132 }
double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
double pt() const final
transverse momentum
Strings const & triggerNames() const
Definition: TriggerNames.cc:20
void Fill(long long x)
edm::EDGetTokenT< edm::TriggerResults > tokTrigger_
vector< PseudoJet > jets
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::EDGetTokenT< edm::View< reco::Jet > > tokJets_
std::vector< std::string > vsPaths_
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:256
void B2GHadronicHLTValidation::bookHistograms ( DQMStore::IBooker dbe,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivate

Definition at line 135 of file B2GHadronicHLTValidation.cc.

References DQMStore::IBooker::book1D(), hDenJetEta, hDenJetPt, hDenTriggerMon, hNumJetEta, hNumJetPt, hNumTriggerMon, sDir_, DQMStore::IBooker::setCurrentFolder(), triggerBinLabels(), and vsPaths_.

135  {
136  dbe.setCurrentFolder(sDir_);
137  hDenJetPt = dbe.book1D("PtLastJetAll", "PtLastJetAll", 60, 0., 3000.);
138  hDenJetEta = dbe.book1D("EtaLastJetAll", "EtaLastJetAll", 30, -3., 3.);
139  hNumJetPt = dbe.book1D("PtLastJetSel", "PtLastJetSel", 60, 0., 3000.);
140  hNumJetEta = dbe.book1D("EtaLastJetSel", "EtaLastJetSel", 30, -3., 3.);
141  // determine number of bins for trigger monitoring
142  unsigned int nPaths = vsPaths_.size();
143  // monitored trigger occupancy for single lepton triggers
144  hNumTriggerMon = dbe.book1D("TriggerMonSel", "TriggerMonSel", nPaths, 0., nPaths);
145  hDenTriggerMon = dbe.book1D("TriggerMonAll", "TriggerMonAll", nPaths, 0., nPaths);
146  // set bin labels for trigger monitoring
148 }
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
void triggerBinLabels(const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
std::vector< std::string > vsPaths_
void B2GHadronicHLTValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 152 of file B2GHadronicHLTValidation.cc.

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

152  {
153  // The following says we do not know what parameters are allowed so do no
154  // validation
155  // Please change this to state exactly what you do use, even if it is no
156  // parameters
158  desc.setUnknown();
159  descriptions.addDefault(desc);
160 }
void addDefault(ParameterSetDescription const &psetDescription)
std::string B2GHadronicHLTValidation::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 B2GHadronicHLTValidation.h.

References tablePrinter::labels, and triggerBinLabels().

Referenced by triggerBinLabels().

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

set configurable labels for trigger monitoring histograms

Definition at line 94 of file B2GHadronicHLTValidation.h.

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

Referenced by bookHistograms(), and monitorPath().

94  {
95  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
96  hNumTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
97  hDenTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
98  }
99 }
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

double B2GHadronicHLTValidation::etaJets_
private

Definition at line 82 of file B2GHadronicHLTValidation.h.

Referenced by analyze().

MonitorElement* B2GHadronicHLTValidation::hDenJetEta
private

Definition at line 72 of file B2GHadronicHLTValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* B2GHadronicHLTValidation::hDenJetPt
private

Definition at line 70 of file B2GHadronicHLTValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* B2GHadronicHLTValidation::hDenTriggerMon
private

Definition at line 74 of file B2GHadronicHLTValidation.h.

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

MonitorElement* B2GHadronicHLTValidation::hNumJetEta
private

Definition at line 71 of file B2GHadronicHLTValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* B2GHadronicHLTValidation::hNumJetPt
private

Definition at line 69 of file B2GHadronicHLTValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* B2GHadronicHLTValidation::hNumTriggerMon
private

Definition at line 73 of file B2GHadronicHLTValidation.h.

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

double B2GHadronicHLTValidation::htMin_
private

Definition at line 84 of file B2GHadronicHLTValidation.h.

Referenced by analyze().

bool B2GHadronicHLTValidation::isAll_ = false
private

Definition at line 90 of file B2GHadronicHLTValidation.h.

Referenced by analyze().

bool B2GHadronicHLTValidation::isSel_ = false
private

Definition at line 91 of file B2GHadronicHLTValidation.h.

Referenced by analyze().

edm::Ptr<reco::Jet> B2GHadronicHLTValidation::jet_
private

Definition at line 76 of file B2GHadronicHLTValidation.h.

Referenced by analyze().

unsigned int B2GHadronicHLTValidation::minJets_
private

Definition at line 83 of file B2GHadronicHLTValidation.h.

Referenced by analyze().

double B2GHadronicHLTValidation::ptJets0_
private

Definition at line 80 of file B2GHadronicHLTValidation.h.

Referenced by analyze().

double B2GHadronicHLTValidation::ptJets1_
private

Definition at line 81 of file B2GHadronicHLTValidation.h.

Referenced by analyze().

double B2GHadronicHLTValidation::ptJets_
private

Definition at line 79 of file B2GHadronicHLTValidation.h.

Referenced by analyze().

std::string B2GHadronicHLTValidation::sDir_
private

Definition at line 68 of file B2GHadronicHLTValidation.h.

Referenced by bookHistograms().

std::string B2GHadronicHLTValidation::sJets_
private

Definition at line 77 of file B2GHadronicHLTValidation.h.

Referenced by B2GHadronicHLTValidation().

std::string B2GHadronicHLTValidation::sTrigger_
private

Definition at line 86 of file B2GHadronicHLTValidation.h.

Referenced by B2GHadronicHLTValidation().

edm::EDGetTokenT<edm::View<reco::Jet> > B2GHadronicHLTValidation::tokJets_
private

Definition at line 78 of file B2GHadronicHLTValidation.h.

Referenced by analyze(), and B2GHadronicHLTValidation().

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

Definition at line 87 of file B2GHadronicHLTValidation.h.

Referenced by analyze(), and B2GHadronicHLTValidation().

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

Definition at line 88 of file B2GHadronicHLTValidation.h.

Referenced by analyze(), and bookHistograms().