CMS 3D CMS Logo

TopSingleLeptonDQM_miniAOD.h
Go to the documentation of this file.
1 #ifndef TOPSINGLELEPTONDQM_MINIAOD
2 #define TOPSINGLELEPTONDQM_MINIAOD
3 
5 #include <string>
6 #include <vector>
8 
20 
25 
26 namespace TopSingleLepton_miniAOD {
29 
31  public:
34 
35  public:
40 
42  void book(DQMStore::IBooker& ibooker);
44  void fill(const edm::Event& event, const edm::EventSetup& setup);
45 
46  private:
49  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':') + 1); };
52  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
53 
55  void triggerBinLabels(std::string channel, const std::vector<std::string> labels);
57  void fill(const edm::Event& event,
58  const edm::TriggerResults& triggerTable,
59  std::string channel,
60  const std::vector<std::string> labels) const;
61 
63  bool booked(const std::string histName) const { return hists_.find(histName) != hists_.end(); };
65  void fill(const std::string histName, double value) const {
66  if (booked(histName))
67  hists_.find(histName)->second->Fill(value);
68  };
70  void fill(const std::string histName, double xValue, double yValue) const {
71  if (booked(histName))
72  hists_.find(histName)->second->Fill(xValue, yValue);
73  };
75  void fill(const std::string histName, double xValue, double yValue, double zValue) const {
76  if (booked(histName))
77  hists_.find(histName)->second->Fill(xValue, yValue, zValue);
78  };
79 
80  private:
86  std::vector<edm::EDGetTokenT<edm::View<pat::MET> > > mets_;
96  std::vector<std::string> triggerPaths_;
97 
99 
102 
103  double eidCutValue_;
105  std::unique_ptr<StringCutObjectSelector<pat::Electron> > elecIso_;
107  std::unique_ptr<StringCutObjectSelector<pat::Electron> > elecSelect_;
108 
111  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > pvSelect_;
112 
114  std::unique_ptr<StringCutObjectSelector<pat::Muon> > muonIso_;
115 
117  std::unique_ptr<StringCutObjectSelector<pat::Muon> > muonSelect_;
118 
124  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
128  std::unique_ptr<StringCutObjectSelector<pat::Jet> > jetSelect;
138 
140  int logged_;
141 
143  std::map<std::string, MonitorElement*> hists_;
146  };
147 
148  inline void MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string> labels) {
149  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
150  hists_[channel + "Mon_"]->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
151  hists_[channel + "Eff_"]->setBinLabel(
152  idx + 1, "[" + selectionPath(labels[idx]) + "]|[" + monitorPath(labels[idx]) + "]", 1);
153  }
154  }
155 
157  const edm::TriggerResults& triggerTable,
158  std::string channel,
159  const std::vector<std::string> labels) const {
160  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
161  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
162  fill(channel + "Mon_", idx + 0.5);
163  // take care to fill triggerMon_ before evts is being called
164  int evts = hists_.find(channel + "Mon_")->second->getBinContent(idx + 1);
165  double value = hists_.find(channel + "Eff_")->second->getBinContent(idx + 1);
166  fill(
167  channel + "Eff_", idx + 0.5, 1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) - value));
168  }
169  }
170  }
171 } // namespace TopSingleLepton_miniAOD
172 
173 #include <utility>
174 
179 
184 
186 public:
191 
193  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
194 
195 protected:
196  //Book histograms
197  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
198 
199 private:
202  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
205  std::string selectionStep(const std::string& label) { return label.substr(label.find(':') + 1); };
206 
207 private:
211  std::vector<std::string> triggerPaths_;
213  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
214 
219  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
220 
223  std::vector<std::string> selectionOrder_;
229  std::map<std::string, std::pair<edm::ParameterSet, std::unique_ptr<TopSingleLepton_miniAOD::MonitorEnsemble> > >
231  std::unique_ptr<SelectionStep<pat::Muon> > MuonStep;
232  std::unique_ptr<SelectionStep<pat::Electron> > ElectronStep;
233  std::unique_ptr<SelectionStep<reco::Vertex> > PvStep;
234  std::unique_ptr<SelectionStep<pat::MET> > METStep;
235  std::vector<std::unique_ptr<SelectionStep<pat::Jet> > > JetSteps;
236 
237  std::vector<edm::ParameterSet> sel_;
239 };
240 
241 #endif
242 
243 /* Local Variables: */
244 /* show-trailing-whitespace: t */
245 /* truncate-lines: t */
246 /* End: */
TopSingleLepton_miniAOD::MonitorEnsemble::hists_
std::map< std::string, MonitorElement * > hists_
histogram container
Definition: TopSingleLeptonDQM_miniAOD.h:143
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
TopSingleLepton_miniAOD::MonitorEnsemble::tmpConsumerBase
edm::EDConsumerBase tmpConsumerBase
Definition: TopSingleLeptonDQM_miniAOD.h:144
TopSingleLeptonDQM_miniAOD::beamspot__
edm::EDGetTokenT< reco::BeamSpot > beamspot__
Definition: TopSingleLeptonDQM_miniAOD.h:217
TopSingleLepton_miniAOD::MonitorEnsemble::btagEffWP_
double btagEffWP_
btag working points
Definition: TopSingleLeptonDQM_miniAOD.h:135
TopSingleLepton_miniAOD::MonitorEnsemble::elecs_
edm::EDGetTokenT< edm::View< pat::Electron > > elecs_
Definition: TopSingleLeptonDQM_miniAOD.h:90
TopSingleLepton_miniAOD::MonitorEnsemble::label_
std::string label_
instance label
Definition: TopSingleLeptonDQM_miniAOD.h:84
TopSingleLepton_miniAOD::MonitorEnsemble::jetIDSelect_
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
Definition: TopSingleLeptonDQM_miniAOD.h:124
TriggerResults.h
PFCandidate.h
TopSingleLepton_miniAOD::MonitorEnsemble::mets_
std::vector< edm::EDGetTokenT< edm::View< pat::MET > > > mets_
considers a vector of METs
Definition: TopSingleLeptonDQM_miniAOD.h:86
TopSingleLepton_miniAOD::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_miniAOD.h:75
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
JetCorrector.h
Muon.h
TopSingleLeptonDQM_miniAOD::triggerTable__
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
Definition: TopSingleLeptonDQM_miniAOD.h:205
TopSingleLepton_miniAOD::MonitorEnsemble::rhoTag
edm::InputTag rhoTag
Definition: TopSingleLeptonDQM_miniAOD.h:98
TopSingleLepton_miniAOD::MonitorEnsemble::elecIso_
std::unique_ptr< StringCutObjectSelector< pat::Electron > > elecIso_
extra isolation criterion on electron
Definition: TopSingleLeptonDQM_miniAOD.h:105
DQMOneEDAnalyzer
Definition: DQMOneEDAnalyzer.h:20
Jet.h
TopSingleLepton_miniAOD::MonitorEnsemble
Definition: TopSingleLeptonDQM_miniAOD.h:30
TopSingleLepton_miniAOD::MonitorEnsemble::selectionPath
std::string selectionPath(const std::string &label) const
Definition: TopSingleLeptonDQM_miniAOD.h:52
TopSingleLepton_miniAOD::MonitorEnsemble::book
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
Definition: TopSingleLeptonDQM_miniAOD.cc:171
TopSingleLeptonDQM_miniAOD::beamspotSelect_
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
Definition: TopSingleLeptonDQM_miniAOD.h:219
TopSingleLeptonDQM_miniAOD::selection_
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< TopSingleLepton_miniAOD::MonitorEnsemble > > > selection_
Definition: TopSingleLeptonDQM_miniAOD.h:230
TopSingleLepton_miniAOD::MonitorEnsemble::booked
bool booked(const std::string histName) const
check if histogram was booked
Definition: TopSingleLeptonDQM_miniAOD.h:63
TopSingleLeptonDQM_miniAOD::selectionOrder_
std::vector< std::string > selectionOrder_
Definition: TopSingleLeptonDQM_miniAOD.h:223
TopSingleLepton_miniAOD
Definition: TopSingleLeptonDQM_miniAOD.cc:22
TopSingleLeptonDQM_miniAOD::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: TopSingleLeptonDQM_miniAOD.cc:766
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
TopSingleLeptonDQM_miniAOD::triggerPaths_
std::vector< std::string > triggerPaths_
trigger paths
Definition: TopSingleLeptonDQM_miniAOD.h:211
DQMOneEDAnalyzer.h
TopSingleLepton_miniAOD::MonitorEnsemble::directory_
std::string directory_
Definition: TopSingleLeptonDQM_miniAOD.h:145
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
TopSingleLepton_miniAOD::MonitorEnsemble::jetSelect_
std::string jetSelect_
Definition: TopSingleLeptonDQM_miniAOD.h:127
accept
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
edm::EDConsumerBase
Definition: EDConsumerBase.h:71
TopSingleLepton_miniAOD::MonitorEnsemble::btagVtxWP_
double btagVtxWP_
Definition: TopSingleLeptonDQM_miniAOD.h:135
TopSingleLeptonDQM_miniAOD::setup_
edm::ParameterSet setup_
Definition: TopSingleLeptonDQM_miniAOD.h:238
TopSingleLeptonDQM_miniAOD::METStep
std::unique_ptr< SelectionStep< pat::MET > > METStep
Definition: TopSingleLeptonDQM_miniAOD.h:234
BeamSpot.h
TopSingleLepton_miniAOD::MonitorEnsemble::pvSelect_
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
Definition: TopSingleLeptonDQM_miniAOD.h:111
CaloMET.h
TopSingleLepton_miniAOD::MonitorEnsemble::elecSelect_
std::unique_ptr< StringCutObjectSelector< pat::Electron > > elecSelect_
extra selection on electrons
Definition: TopSingleLeptonDQM_miniAOD.h:107
Service.h
TopSingleLeptonDQM_miniAOD::analyze
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
do this during the event loop
Definition: TopSingleLeptonDQM_miniAOD.cc:771
TopSingleLeptonDQM_miniAOD::MuonStep
std::unique_ptr< SelectionStep< pat::Muon > > MuonStep
Definition: TopSingleLeptonDQM_miniAOD.h:231
TopSingleLepton_miniAOD::MonitorEnsemble::btagCSV_
edm::EDGetTokenT< reco::JetTagCollection > btagCSV_
Definition: TopSingleLeptonDQM_miniAOD.h:133
TopSingleLeptonDQM_miniAOD::~TopSingleLeptonDQM_miniAOD
~TopSingleLeptonDQM_miniAOD() override
default destructor
Definition: TopSingleLeptonDQM_miniAOD.h:190
TopSingleLepton_miniAOD::MonitorEnsemble::verbosity_
Level verbosity_
verbosity level for booking
Definition: TopSingleLeptonDQM_miniAOD.h:78
TopSingleLeptonDQM_miniAOD::PvStep
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
Definition: TopSingleLeptonDQM_miniAOD.h:233
TopSingleLepton_miniAOD::MonitorEnsemble::MonitorEnsemble
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
default contructor
Definition: TopSingleLeptonDQM_miniAOD.cc:31
TopSingleLepton_miniAOD::MonitorEnsemble::lowerEdge_
double lowerEdge_
mass window upper and lower edge
Definition: TopSingleLeptonDQM_miniAOD.h:137
GsfElectron.h
EDGetToken.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Vertex.h
TopSingleLeptonDQM_miniAOD::TopSingleLeptonDQM_miniAOD
TopSingleLeptonDQM_miniAOD(const edm::ParameterSet &cfg)
default constructor
Definition: TopSingleLeptonDQM_miniAOD.cc:708
TopSingleLepton_miniAOD::MonitorEnsemble::jetIDLabel_
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
Definition: TopSingleLeptonDQM_miniAOD.h:122
TopSingleLepton_miniAOD::MonitorEnsemble::btagCSVWP_
double btagCSVWP_
Definition: TopSingleLeptonDQM_miniAOD.h:135
TopSingleLeptonDQM_miniAOD
Definition: TopSingleLeptonDQM_miniAOD.h:185
TopSingleLeptonDQM_miniAOD::sel_
std::vector< edm::ParameterSet > sel_
Definition: TopSingleLeptonDQM_miniAOD.h:237
TopSingleLepton_miniAOD::MonitorEnsemble::btagEff_
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
Definition: TopSingleLeptonDQM_miniAOD.h:133
TopSingleLepton_miniAOD::MonitorEnsemble::STANDARD
Definition: TopSingleLeptonDQM_miniAOD.h:33
edm::ParameterSet
Definition: ParameterSet.h:47
EDConsumerBase.h
TopSingleLeptonDQM_miniAOD::beamspot_
edm::InputTag beamspot_
beamspot
Definition: TopSingleLeptonDQM_miniAOD.h:216
TopSingleLepton_miniAOD::MonitorEnsemble::upperEdge_
double upperEdge_
Definition: TopSingleLeptonDQM_miniAOD.h:137
TopSingleLepton_miniAOD::MonitorEnsemble::triggerTable_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
Definition: TopSingleLeptonDQM_miniAOD.h:93
TopSingleLepton_miniAOD::MonitorEnsemble::triggerPaths_
std::vector< std::string > triggerPaths_
Definition: TopSingleLeptonDQM_miniAOD.h:96
TriggerNames.h
TopSingleLepton_miniAOD::MonitorEnsemble::includeBTag_
bool includeBTag_
Definition: TopSingleLeptonDQM_miniAOD.h:131
TopSingleLepton_miniAOD::MonitorEnsemble::btagVtx_
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
Definition: TopSingleLeptonDQM_miniAOD.h:133
value
Definition: value.py:1
TopSingleLepton_miniAOD::MonitorEnsemble::pvs_
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
Definition: TopSingleLeptonDQM_miniAOD.h:91
TopSingleLepton_miniAOD::MonitorEnsemble::~MonitorEnsemble
~MonitorEnsemble()
default destructor
Definition: TopSingleLeptonDQM_miniAOD.h:39
edm::EventSetup
Definition: EventSetup.h:58
TopSingleLepton_miniAOD::MonitorEnsemble::muonIso_
std::unique_ptr< StringCutObjectSelector< pat::Muon > > muonIso_
extra isolation criterion on muon
Definition: TopSingleLeptonDQM_miniAOD.h:114
TopSingleLepton_miniAOD::MonitorEnsemble::jets_
edm::EDGetTokenT< edm::View< pat::Jet > > jets_
input sources for monitoring
Definition: TopSingleLeptonDQM_miniAOD.h:88
TopSingleLeptonDQM_miniAOD::ElectronStep
std::unique_ptr< SelectionStep< pat::Electron > > ElectronStep
Definition: TopSingleLeptonDQM_miniAOD.h:232
TopSingleLepton_miniAOD::MonitorEnsemble::triggerBinLabels
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
Definition: TopSingleLeptonDQM_miniAOD.h:148
MET.h
Jet.h
TopSingleLepton_miniAOD::MonitorEnsemble::Level
Level
different verbosity levels
Definition: TopSingleLeptonDQM_miniAOD.h:33
TopSingleLepton_miniAOD::MonitorEnsemble::monitorPath
std::string monitorPath(const std::string &label) const
Definition: TopSingleLeptonDQM_miniAOD.h:49
TopSingleLeptonDQM_miniAOD::vertexSelect_
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
Definition: TopSingleLeptonDQM_miniAOD.h:213
looper.cfg
cfg
Definition: looper.py:297
ValueMap.h
TopSingleLepton_miniAOD::MonitorEnsemble::electronId_
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
Definition: TopSingleLeptonDQM_miniAOD.h:101
TopSingleLepton_miniAOD::MonitorEnsemble::muonSelect_
std::unique_ptr< StringCutObjectSelector< pat::Muon > > muonSelect_
extra selection on muons
Definition: TopSingleLeptonDQM_miniAOD.h:117
TopSingleLepton_miniAOD::MonitorEnsemble::btagPur_
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
Definition: TopSingleLeptonDQM_miniAOD.h:133
TopSingleLepton_miniAOD::MonitorEnsemble::eidCutValue_
double eidCutValue_
Definition: TopSingleLeptonDQM_miniAOD.h:103
Frameworkfwd.h
TopSingleLepton_miniAOD::MonitorEnsemble::jetSelect
std::unique_ptr< StringCutObjectSelector< pat::Jet > > jetSelect
Definition: TopSingleLeptonDQM_miniAOD.h:128
phase2tkutil::DQMStore
dqm::reco::DQMStore DQMStore
Definition: TrackerPhase2DQMUtil.h:16
TopSingleLepton_miniAOD::MonitorEnsemble::logged_
int logged_
number of logged interesting events
Definition: TopSingleLeptonDQM_miniAOD.h:140
TopSingleLepton_miniAOD::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_miniAOD.h:70
TopSingleLepton_miniAOD::MonitorEnsemble::jetCorrector_
std::string jetCorrector_
jetCorrector
Definition: TopSingleLeptonDQM_miniAOD.h:120
TopSingleLepton_miniAOD::MonitorEnsemble::DEBUG
Definition: TopSingleLeptonDQM_miniAOD.h:33
MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: SiPixelSCurveCalibrationAnalysis.h:55
dqm::implementation::IBooker
Definition: DQMStore.h:43
Electron.h
ConsumesCollector.h
TopSingleLeptonDQM_miniAOD::objectType
std::string objectType(const std::string &label)
Definition: TopSingleLeptonDQM_miniAOD.h:202
ParameterSet.h
TopSingleLepton_miniAOD::MonitorEnsemble::VERBOSE
Definition: TopSingleLeptonDQM_miniAOD.h:33
TopSingleLepton_miniAOD::MonitorEnsemble::muons_
edm::EDGetTokenT< edm::View< pat::Muon > > muons_
Definition: TopSingleLeptonDQM_miniAOD.h:89
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
TopSingleLepton_miniAOD::MonitorEnsemble::fill
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
Definition: TopSingleLeptonDQM_miniAOD.cc:344
TopSingleLeptonDQM_miniAOD::JetSteps
std::vector< std::unique_ptr< SelectionStep< pat::Jet > > > JetSteps
Definition: TopSingleLeptonDQM_miniAOD.h:235
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_miniAOD::MonitorEnsemble::btagPurWP_
double btagPurWP_
Definition: TopSingleLeptonDQM_miniAOD.h:135
TopSingleLepton_miniAOD::MonitorEnsemble::fill
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
Definition: TopSingleLeptonDQM_miniAOD.h:65
TopSingleLeptonDQM_miniAOD::selectionStep
std::string selectionStep(const std::string &label)
Definition: TopSingleLeptonDQM_miniAOD.h:205
TopDQMHelpers.h