CMS 3D CMS Logo

TopSingleLeptonDQM.h
Go to the documentation of this file.
1 #ifndef TOPSINGLELEPTONDQM
2 #define TOPSINGLELEPTONDQM
3 
5 #include <string>
6 #include <vector>
7 
20 
49 namespace TopSingleLepton {
52 
54  public:
57 
58  public:
63 
65  void book(DQMStore::IBooker& ibooker);
67  void fill(const edm::Event& event, const edm::EventSetup& setup);
68 
69  private:
72  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':') + 1); };
75  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
76 
78  void triggerBinLabels(std::string channel, const std::vector<std::string> labels);
80  void fill(const edm::Event& event,
81  const edm::TriggerResults& triggerTable,
82  std::string channel,
83  const std::vector<std::string> labels) const;
84 
86  bool booked(const std::string histName) const { return hists_.find(histName) != hists_.end(); };
88  void fill(const std::string histName, double value) const {
89  if (booked(histName))
90  hists_.find(histName)->second->Fill(value);
91  };
93  void fill(const std::string histName, double xValue, double yValue) const {
94  if (booked(histName))
95  hists_.find(histName)->second->Fill(xValue, yValue);
96  };
98  void fill(const std::string histName, double xValue, double yValue, double zValue) const {
99  if (booked(histName))
100  hists_.find(histName)->second->Fill(xValue, yValue, zValue);
101  };
102 
103  private:
109  std::vector<edm::EDGetTokenT<edm::View<reco::MET> > > mets_;
119  std::vector<std::string> triggerPaths_;
120 
124 
136  // int eidPattern_;
137  // the cut for the MVA Id
138  double eidCutValue_;
139  // electron ISO things
140 
142 
144 
145  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > elecSelect_;
146 
149  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > pvSelect_;
150 
152  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > muonIso_;
153 
155  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > muonSelect_;
156 
159 
162 
163  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
166  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetlooseSelection_;
167  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetSelection_;
177 
179  int logged_;
180 
182  std::map<std::string, MonitorElement*> hists_;
184 
186  };
187 
188  inline void MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string> labels) {
189  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
190  hists_[channel + "Mon_"]->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
191  hists_[channel + "Eff_"]->setBinLabel(
192  idx + 1, "[" + selectionPath(labels[idx]) + "]|[" + monitorPath(labels[idx]) + "]", 1);
193  }
194  }
195 
197  const edm::TriggerResults& triggerTable,
198  std::string channel,
199  const std::vector<std::string> labels) const {
200  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
201  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
202  fill(channel + "Mon_", idx + 0.5);
203  // take care to fill triggerMon_ before evts is being called
204  int evts = hists_.find(channel + "Mon_")->second->getBinContent(idx + 1);
205  double value = hists_.find(channel + "Eff_")->second->getBinContent(idx + 1);
206  fill(
207  channel + "Eff_", idx + 0.5, 1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) - value));
208  }
209  }
210  }
211 } // namespace TopSingleLepton
212 
213 #include <utility>
214 
219 
224 
263 // using TopSingleLepton::MonitorEnsemble;
265 
267 public:
271  ~TopSingleLeptonDQM() override{};
272 
274  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
275 
276 protected:
277  //Book histograms
278  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
279 
280 private:
283  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
286  std::string selectionStep(const std::string& label) { return label.substr(label.find(':') + 1); };
287 
288 private:
292  std::vector<std::string> triggerPaths_;
294  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
295 
300  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
301 
304  std::vector<std::string> selectionOrder_;
310  std::map<std::string, std::pair<edm::ParameterSet, std::unique_ptr<TopSingleLepton::MonitorEnsemble> > > selection_;
311  std::unique_ptr<SelectionStep<reco::PFCandidate> > MuonStep;
312  std::unique_ptr<SelectionStep<reco::PFCandidate> > ElectronStep;
313  std::unique_ptr<SelectionStep<reco::Vertex> > PvStep;
314  std::unique_ptr<SelectionStep<reco::MET> > METStep;
315  std::vector<std::unique_ptr<SelectionStep<reco::Jet> > > JetSteps;
316  std::vector<std::unique_ptr<SelectionStep<reco::CaloJet> > > CaloJetSteps;
317  std::vector<std::unique_ptr<SelectionStep<reco::PFJet> > > PFJetSteps;
318 
319  std::vector<edm::ParameterSet> sel_;
321 };
322 
323 #endif
324 
325 /* Local Variables: */
326 /* show-trailing-whitespace: t */
327 /* truncate-lines: t */
328 /* End: */
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
TopSingleLepton::MonitorEnsemble::pvs_
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
Definition: TopSingleLeptonDQM.h:114
TopSingleLepton::MonitorEnsemble::jetSelect_
std::string jetSelect_
extra selection on jets
Definition: TopSingleLeptonDQM.h:165
TopSingleLeptonDQM::sel_
std::vector< edm::ParameterSet > sel_
Definition: TopSingleLeptonDQM.h:319
TopSingleLeptonDQM::PFJetSteps
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
Definition: TopSingleLeptonDQM.h:317
TopSingleLeptonDQM::beamspot__
edm::EDGetTokenT< reco::BeamSpot > beamspot__
Definition: TopSingleLeptonDQM.h:298
TopSingleLepton::MonitorEnsemble::book
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
Definition: TopSingleLeptonDQM.cc:172
TriggerResults.h
TopSingleLepton::MonitorEnsemble::booked
bool booked(const std::string histName) const
check if histogram was booked
Definition: TopSingleLeptonDQM.h:86
TopSingleLepton::MonitorEnsemble::label_
std::string label_
instance label
Definition: TopSingleLeptonDQM.h:107
TopSingleLeptonDQM::analyze
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
do this during the event loop
Definition: TopSingleLeptonDQM.cc:742
PFCandidate.h
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
JetCorrector.h
DQMOneEDAnalyzer
Definition: DQMOneEDAnalyzer.h:20
Jet.h
TopSingleLepton::MonitorEnsemble::includeBTag_
bool includeBTag_
Definition: TopSingleLeptonDQM.h:170
TopSingleLepton::MonitorEnsemble::btagVtxWP_
double btagVtxWP_
Definition: TopSingleLeptonDQM.h:174
TopSingleLepton::MonitorEnsemble::btagPurWP_
double btagPurWP_
Definition: TopSingleLeptonDQM.h:174
TopSingleLeptonDQM::PvStep
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
Definition: TopSingleLeptonDQM.h:313
TopSingleLepton::MonitorEnsemble::Level
Level
different verbosity levels
Definition: TopSingleLeptonDQM.h:56
TopSingleLeptonDQM::selection_
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< TopSingleLepton::MonitorEnsemble > > > selection_
Definition: TopSingleLeptonDQM.h:310
TopSingleLepton::MonitorEnsemble::pvSelect_
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
Definition: TopSingleLeptonDQM.h:149
TopSingleLepton::MonitorEnsemble::jetlooseSelection_
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetlooseSelection_
Definition: TopSingleLeptonDQM.h:166
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
TopSingleLeptonDQM::JetSteps
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
Definition: TopSingleLeptonDQM.h:315
TopSingleLepton::MonitorEnsemble::btagVtx_
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
Definition: TopSingleLeptonDQM.h:172
DQMOneEDAnalyzer.h
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
TopSingleLeptonDQM::ElectronStep
std::unique_ptr< SelectionStep< reco::PFCandidate > > ElectronStep
Definition: TopSingleLeptonDQM.h:312
TopSingleLepton::MonitorEnsemble::triggerBinLabels
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
Definition: TopSingleLeptonDQM.h:188
TopSingleLepton::MonitorEnsemble::jetCorrector_
std::string jetCorrector_
jetCorrector
Definition: TopSingleLeptonDQM.h:158
accept
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
edm::EDConsumerBase
Definition: EDConsumerBase.h:70
TopSingleLepton::MonitorEnsemble::fill
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
Definition: TopSingleLeptonDQM.h:93
TopSingleLeptonDQM::setup_
edm::ParameterSet setup_
Definition: TopSingleLeptonDQM.h:320
TopSingleLepton::MonitorEnsemble::rhoTag
edm::InputTag rhoTag
Definition: TopSingleLeptonDQM.h:141
TopSingleLepton::MonitorEnsemble::fill
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
Definition: TopSingleLeptonDQM.cc:329
BeamSpot.h
TopSingleLepton::MonitorEnsemble::electronId_
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
Definition: TopSingleLeptonDQM.h:122
CaloMET.h
TopSingleLeptonDQM::beamspotSelect_
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
Definition: TopSingleLeptonDQM.h:300
Service.h
TopSingleLeptonDQM::triggerTable__
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
Definition: TopSingleLeptonDQM.h:286
TopSingleLeptonDQM::METStep
std::unique_ptr< SelectionStep< reco::MET > > METStep
Definition: TopSingleLeptonDQM.h:314
TopSingleLepton::MonitorEnsemble::btagEffWP_
double btagEffWP_
btag working points
Definition: TopSingleLeptonDQM.h:174
TopSingleLepton::MonitorEnsemble::MonitorEnsemble
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
default contructor
Definition: TopSingleLeptonDQM.cc:24
TopSingleLepton::MonitorEnsemble::btagEff_
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
Definition: TopSingleLeptonDQM.h:172
TopSingleLeptonDQM::~TopSingleLeptonDQM
~TopSingleLeptonDQM() override
default destructor
Definition: TopSingleLeptonDQM.h:271
JetCorrector.h
GsfElectron.h
TopSingleLepton::MonitorEnsemble
Definition: TopSingleLeptonDQM.h:53
EDGetToken.h
TopSingleLeptonDQM
define MonitorEnsembple to be used
Definition: TopSingleLeptonDQM.h:266
TopSingleLeptonDQM::triggerPaths_
std::vector< std::string > triggerPaths_
trigger paths
Definition: TopSingleLeptonDQM.h:292
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TopSingleLepton::MonitorEnsemble::jetIDLabel_
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
Definition: TopSingleLeptonDQM.h:161
Vertex.h
TopSingleLepton::MonitorEnsemble::muonIso_
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonIso_
extra isolation criterion on muon
Definition: TopSingleLeptonDQM.h:152
TopSingleLepton::MonitorEnsemble::btagPur_
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
Definition: TopSingleLeptonDQM.h:172
TopSingleLeptonDQM::selectionStep
std::string selectionStep(const std::string &label)
Definition: TopSingleLeptonDQM.h:286
TopSingleLepton::MonitorEnsemble::eidCutValue_
double eidCutValue_
Definition: TopSingleLeptonDQM.h:138
TopSingleLepton::MonitorEnsemble::logged_
int logged_
number of logged interesting events
Definition: TopSingleLeptonDQM.h:179
TopSingleLeptonDQM::objectType
std::string objectType(const std::string &label)
Definition: TopSingleLeptonDQM.h:283
TopSingleLepton
Definition: TopSingleLeptonDQM.cc:15
edm::ParameterSet
Definition: ParameterSet.h:47
EDConsumerBase.h
TopSingleLeptonDQM::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: TopSingleLeptonDQM.cc:737
TopSingleLepton::MonitorEnsemble::hists_
std::map< std::string, MonitorElement * > hists_
histogram container
Definition: TopSingleLeptonDQM.h:182
TopSingleLepton::MonitorEnsemble::fill
void fill(const std::string histName, double xValue, double yValue, double zValue) const
fill histogram if it had been booked before (2-dim version)
Definition: TopSingleLeptonDQM.h:98
TopSingleLeptonDQM::MuonStep
std::unique_ptr< SelectionStep< reco::PFCandidate > > MuonStep
Definition: TopSingleLeptonDQM.h:311
TopSingleLeptonDQM::TopSingleLeptonDQM
TopSingleLeptonDQM(const edm::ParameterSet &cfg)
default constructor
Definition: TopSingleLeptonDQM.cc:672
TriggerNames.h
TopSingleLeptonDQM::vertexSelect_
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
Definition: TopSingleLeptonDQM.h:294
TopSingleLepton::MonitorEnsemble::btagCSVWP_
double btagCSVWP_
Definition: TopSingleLeptonDQM.h:174
TopSingleLepton::MonitorEnsemble::STANDARD
Definition: TopSingleLeptonDQM.h:56
value
Definition: value.py:1
TopSingleLepton::MonitorEnsemble::muonSelect_
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonSelect_
extra selection on muons
Definition: TopSingleLeptonDQM.h:155
TopSingleLepton::MonitorEnsemble::elecSelect_
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > elecSelect_
extra selection on electrons
Definition: TopSingleLeptonDQM.h:145
TopSingleLeptonDQM::selectionOrder_
std::vector< std::string > selectionOrder_
Definition: TopSingleLeptonDQM.h:304
TopSingleLeptonDQM::beamspot_
edm::InputTag beamspot_
beamspot
Definition: TopSingleLeptonDQM.h:297
edm::EventSetup
Definition: EventSetup.h:57
TopSingleLepton::MonitorEnsemble::muons_
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
Definition: TopSingleLeptonDQM.h:112
TopSingleLepton::MonitorEnsemble::btagCSV_
edm::EDGetTokenT< reco::JetTagCollection > btagCSV_
Definition: TopSingleLeptonDQM.h:172
TopSingleLepton::MonitorEnsemble::triggerPaths_
std::vector< std::string > triggerPaths_
Definition: TopSingleLeptonDQM.h:119
looper.cfg
cfg
Definition: looper.py:297
ValueMap.h
TopSingleLepton::MonitorEnsemble::VERBOSE
Definition: TopSingleLeptonDQM.h:56
TopSingleLepton::MonitorEnsemble::mets_
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
Definition: TopSingleLeptonDQM.h:109
TopSingleLepton::MonitorEnsemble::triggerTable_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
Definition: TopSingleLeptonDQM.h:116
TopSingleLepton::MonitorEnsemble::tmpConsumerBase
edm::EDConsumerBase tmpConsumerBase
Definition: TopSingleLeptonDQM.h:183
TopSingleLepton::MonitorEnsemble::jetIDSelect_
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
Definition: TopSingleLeptonDQM.h:163
TopSingleLepton::MonitorEnsemble::jets_
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
Definition: TopSingleLeptonDQM.h:111
TopSingleLepton::MonitorEnsemble::lowerEdge_
double lowerEdge_
mass window upper and lower edge
Definition: TopSingleLeptonDQM.h:176
Frameworkfwd.h
phase2tkutil::DQMStore
dqm::reco::DQMStore DQMStore
Definition: TrackerPhase2DQMUtil.h:16
TopSingleLepton::MonitorEnsemble::monitorPath
std::string monitorPath(const std::string &label) const
Definition: TopSingleLeptonDQM.h:72
TopSingleLepton::MonitorEnsemble::upperEdge_
double upperEdge_
Definition: TopSingleLeptonDQM.h:176
MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: SiPixelSCurveCalibrationAnalysis.h:55
dqm::implementation::IBooker
Definition: DQMStore.h:43
TopSingleLepton::MonitorEnsemble::verbosity_
Level verbosity_
verbosity level for booking
Definition: TopSingleLeptonDQM.h:101
ConsumesCollector.h
ParameterSet.h
TopSingleLepton::MonitorEnsemble::directory_
std::string directory_
Definition: TopSingleLeptonDQM.h:185
TopSingleLepton::MonitorEnsemble::mJetCorrector
edm::EDGetTokenT< reco::JetCorrector > mJetCorrector
Definition: TopSingleLeptonDQM.h:123
TopSingleLepton::MonitorEnsemble::fill
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
Definition: TopSingleLeptonDQM.h:88
TopSingleLeptonDQM::CaloJetSteps
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
Definition: TopSingleLeptonDQM.h:316
TopSingleLepton::MonitorEnsemble::selectionPath
std::string selectionPath(const std::string &label) const
Definition: TopSingleLeptonDQM.h:75
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
TopSingleLepton::MonitorEnsemble::jetSelection_
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetSelection_
Definition: TopSingleLeptonDQM.h:167
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
label
const char * label
Definition: PFTauDecayModeTools.cc:11
edm::TriggerResults
Definition: TriggerResults.h:35
TopSingleLepton::MonitorEnsemble::~MonitorEnsemble
~MonitorEnsemble()
default destructor
Definition: TopSingleLeptonDQM.h:62
TopDQMHelpers.h
TopSingleLepton::MonitorEnsemble::elecs_
edm::EDGetTokenT< edm::View< reco::PFCandidate > > elecs_
Definition: TopSingleLeptonDQM.h:113
TopSingleLepton::MonitorEnsemble::DEBUG
Definition: TopSingleLeptonDQM.h:56