CMS 3D CMS Logo

TopDiLeptonOfflineDQM.h
Go to the documentation of this file.
1 #ifndef TOPDILEPTONOFFLINEDQM
2 #define TOPDILEPTONOFFLINEDQM
3 
5 
6 #include <string>
7 #include <vector>
8 
48 namespace TopDiLeptonOffline {
51 
53  public:
61 
62  public:
68 
70  void book(DQMStore::IBooker& ibooker);
72  void fill(const edm::Event& event, const edm::EventSetup& setup);
73 
74  private:
77  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':') + 1); };
80  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
82  DecayChannel decayChannel(const std::vector<const reco::PFCandidate*>& muons,
83  const std::vector<const reco::PFCandidate*>& elecs) const;
84 
88  void triggerBinLabels(std::string channel, const std::vector<std::string> labels);
90  void fill(const edm::Event& event,
91  const edm::TriggerResults& triggerTable,
92  std::string channel,
93  const std::vector<std::string> labels) const;
94 
96  bool booked(const std::string histName) const { return hists_.find(histName) != hists_.end(); };
98  void fill(const std::string histName, double value) const {
99  if (booked(histName))
100  hists_.find(histName)->second->Fill(value);
101  };
103  void fill(const std::string histName, double xValue, double yValue) const {
104  if (booked(histName))
105  hists_.find(histName)->second->Fill(xValue, yValue);
106  };
108  void fill(const std::string histName, double xValue, double yValue, double zValue) const {
109  if (booked(histName))
110  hists_.find(histName)->second->Fill(xValue, yValue, zValue);
111  };
112 
113  private:
122 
124  std::vector<edm::EDGetTokenT<edm::View<reco::MET> > > mets_;
125 
130  std::vector<std::string> elecMuPaths_;
132  std::vector<std::string> diMuonPaths_;
133 
147  // int eidPattern_;
148  // the cut for the MVA Id
149  double eidCutValue_;
151  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > elecIso_;
153  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > elecSelect_;
154 
156  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > muonIso_;
157 
159  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > muonSelect_;
160 
166  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
172 
177  std::map<std::string, MonitorElement*> hists_;
178 
180  };
181 
183  // set axes titles for selected events
184  hists_[hist]->getTH1()->SetOption("TEXT");
185  hists_[hist]->setBinLabel(1, "Run", 1);
186  hists_[hist]->setBinLabel(2, "Block", 1);
187  hists_[hist]->setBinLabel(3, "Event", 1);
188  hists_[hist]->setBinLabel(6, "pt_{L2L3}(jet1)", 1);
189  hists_[hist]->setBinLabel(7, "pt_{L2L3}(jet2)", 1);
190  hists_[hist]->setBinLabel(8, "MET_{Calo}", 1);
191  hists_[hist]->setAxisTitle("logged evts", 2);
192 
193  if (hist == "diMuonLogger_") {
194  hists_[hist]->setBinLabel(4, "pt(muon)", 1);
195  hists_[hist]->setBinLabel(5, "pt(muon)", 1);
196  }
197  if (hist == "diElecLogger_") {
198  hists_[hist]->setBinLabel(4, "pt(elec)", 1);
199  hists_[hist]->setBinLabel(5, "pt(elec)", 1);
200  }
201  if (hist == "elecMuLogger_") {
202  hists_[hist]->setBinLabel(4, "pt(elec)", 1);
203  hists_[hist]->setBinLabel(5, "pt(muon)", 1);
204  }
205  }
206 
207  inline void MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string> labels) {
208  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
209  hists_[channel + "Mon_"]->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
210  hists_[channel + "Eff_"]->setBinLabel(
211  idx + 1, "[" + selectionPath(labels[idx]) + "]|[" + monitorPath(labels[idx]) + "]", 1);
212  }
213  }
214 
216  const edm::TriggerResults& triggerTable,
217  std::string channel,
218  const std::vector<std::string> labels) const {
219  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
220  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
221  fill(channel + "Mon_", idx + 0.5);
222  // take care to fill triggerMon_ before evts is being called
223  int evts = hists_.find(channel + "Mon_")->second->getBinContent(idx + 1);
224  double value = hists_.find(channel + "Eff_")->second->getBinContent(idx + 1);
225  fill(
226  channel + "Eff_", idx + 0.5, 1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) - value));
227  }
228  }
229  }
230 
232  const std::vector<const reco::PFCandidate*>& muons, const std::vector<const reco::PFCandidate*>& elecs) const {
234  if (muons.size() > 1) {
235  type = DIMUON;
236  } else if (elecs.size() > 1) {
237  type = DIELEC;
238  } else if (!elecs.empty() && !muons.empty()) {
239  type = ELECMU;
240  }
241  return type;
242  }
243 } // namespace TopDiLeptonOffline
244 
245 #include <utility>
246 
250 
255 
293 // using TopDiLeptonOffline::MonitorEnsemble;
295 
297 public:
302 
304  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
305 
306 protected:
307  //Book histograms
308  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
309 
310 private:
313  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
316  std::string selectionStep(const std::string& label) { return label.substr(label.find(':') + 1); };
317 
318 private:
322  std::vector<std::string> triggerPaths_;
326  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
330  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
331 
334  std::vector<std::string> selectionOrder_;
340  std::map<std::string, std::pair<edm::ParameterSet, std::unique_ptr<TopDiLeptonOffline::MonitorEnsemble> > > selection_;
341  std::unique_ptr<SelectionStep<reco::PFCandidate> > MuonStep;
342  std::unique_ptr<SelectionStep<reco::PFCandidate> > ElectronStep;
343  std::unique_ptr<SelectionStep<reco::Vertex> > PvStep;
344  std::unique_ptr<SelectionStep<reco::MET> > METStep;
345  std::vector<std::unique_ptr<SelectionStep<reco::Jet> > > JetSteps;
346  std::vector<std::unique_ptr<SelectionStep<reco::CaloJet> > > CaloJetSteps;
347  std::vector<std::unique_ptr<SelectionStep<reco::PFJet> > > PFJetSteps;
348 
349  std::vector<edm::ParameterSet> sel_;
351 };
352 
353 #endif
TopDiLeptonOfflineDQM::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: TopDiLeptonOfflineDQM.cc:767
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
TopDiLeptonOfflineDQM::sel_
std::vector< edm::ParameterSet > sel_
Definition: TopDiLeptonOfflineDQM.h:349
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
TopDiLeptonOffline::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: TopDiLeptonOfflineDQM.h:103
TopDiLeptonOfflineDQM::vertexSelect_
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
Definition: TopDiLeptonOfflineDQM.h:326
TopDiLeptonOffline::MonitorEnsemble::Level
Level
different verbosity levels
Definition: TopDiLeptonOfflineDQM.h:55
TopDiLeptonOffline::MonitorEnsemble::elecSelect_
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > elecSelect_
extra selection on electrons
Definition: TopDiLeptonOfflineDQM.h:153
TopDiLeptonOffline::MonitorEnsemble::mets_
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
Definition: TopDiLeptonOfflineDQM.h:124
TopDiLeptonOfflineDQM
define MonitorEnsembple to be used
Definition: TopDiLeptonOfflineDQM.h:296
TopDiLeptonOffline::MonitorEnsemble::fill
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
Definition: TopDiLeptonOfflineDQM.h:98
TopDiLeptonOffline::MonitorEnsemble
Definition: TopDiLeptonOfflineDQM.h:52
TriggerResults.h
TopDiLeptonOffline::MonitorEnsemble::diMuonPaths_
std::vector< std::string > diMuonPaths_
trigger paths for di muon channel
Definition: TopDiLeptonOfflineDQM.h:132
PFCandidate.h
TopDiLeptonOffline::MonitorEnsemble::LorentzVector
reco::LeafCandidate::LorentzVector LorentzVector
Definition: TopDiLeptonOfflineDQM.h:58
edm::Run
Definition: Run.h:45
TopDiLeptonOfflineDQM::TopDiLeptonOfflineDQM
TopDiLeptonOfflineDQM(const edm::ParameterSet &cfg)
default constructor
Definition: TopDiLeptonOfflineDQM.cc:697
edm::EDGetTokenT
Definition: EDGetToken.h:33
JetCorrector.h
TopDiLeptonOffline::MonitorEnsemble::decayChannel
DecayChannel decayChannel(const std::vector< const reco::PFCandidate * > &muons, const std::vector< const reco::PFCandidate * > &elecs) const
determine dileptonic decay channel
Definition: TopDiLeptonOfflineDQM.h:231
TopDiLeptonOfflineDQM::selectionOrder_
std::vector< std::string > selectionOrder_
Definition: TopDiLeptonOfflineDQM.h:334
TopDiLeptonOfflineDQM::objectType
std::string objectType(const std::string &label)
Definition: TopDiLeptonOfflineDQM.h:313
DQMOneEDAnalyzer
Definition: DQMOneEDAnalyzer.h:20
Jet.h
TopDiLeptonOffline::MonitorEnsemble::loggerBinLabels
void loggerBinLabels(std::string hist)
set labels for event logging histograms
Definition: TopDiLeptonOfflineDQM.h:182
TopDiLeptonOffline::MonitorEnsemble::DIMUON
Definition: TopDiLeptonOfflineDQM.h:60
TopDiLeptonOffline::MonitorEnsemble::DEBUG
Definition: TopDiLeptonOfflineDQM.h:55
TopDiLeptonOffline::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: TopDiLeptonOfflineDQM.h:108
TopDiLeptonOffline::MonitorEnsemble::jetIDLabel_
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
Definition: TopDiLeptonOfflineDQM.h:164
TopDiLeptonOfflineDQM::JetSteps
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
Definition: TopDiLeptonOfflineDQM.h:345
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
TopDiLeptonOffline::MonitorEnsemble::muons_
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
Definition: TopDiLeptonOfflineDQM.h:120
DQMOneEDAnalyzer.h
TopDiLeptonOffline::MonitorEnsemble::triggerTable_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
Definition: TopDiLeptonOfflineDQM.h:127
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
TopDiLeptonOffline::MonitorEnsemble::jetIDSelect_
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
Definition: TopDiLeptonOfflineDQM.h:166
TopDiLeptonOfflineDQM::PvStep
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
Definition: TopDiLeptonOfflineDQM.h:343
accept
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
TopDiLeptonOffline::MonitorEnsemble::electronId_
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
Definition: TopDiLeptonOfflineDQM.h:135
TopDiLeptonOffline::MonitorEnsemble::triggerBinLabels
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
Definition: TopDiLeptonOfflineDQM.h:207
TopDiLeptonOffline::MonitorEnsemble::NONE
Definition: TopDiLeptonOfflineDQM.h:60
TopDiLeptonOffline::MonitorEnsemble::jetCorrector_
edm::ESGetToken< JetCorrector, JetCorrectionsRecord > jetCorrector_
jetCorrector
Definition: TopDiLeptonOfflineDQM.h:162
BeamSpot.h
CaloMET.h
TopDiLeptonOffline::MonitorEnsemble::elecMuPaths_
std::vector< std::string > elecMuPaths_
Definition: TopDiLeptonOfflineDQM.h:130
TopDiLeptonOffline::MonitorEnsemble::directory_
std::string directory_
Definition: TopDiLeptonOfflineDQM.h:179
Service.h
TopDiLeptonOffline::MonitorEnsemble::DecayChannel
DecayChannel
different decay channels
Definition: TopDiLeptonOfflineDQM.h:60
DecayChannel
Definition: DecayChannel.h:22
TopDiLeptonOfflineDQM::~TopDiLeptonOfflineDQM
~TopDiLeptonOfflineDQM() override
default destructor
Definition: TopDiLeptonOfflineDQM.h:301
TopDiLeptonOffline::MonitorEnsemble::VERBOSE
Definition: TopDiLeptonOfflineDQM.h:55
TopDiLeptonOffline::MonitorEnsemble::ELECMU
Definition: TopDiLeptonOfflineDQM.h:60
singleTopDQM_cfi.elecs
elecs
Definition: singleTopDQM_cfi.py:41
TopDiLeptonOffline::MonitorEnsemble::label_
std::string label_
instance label
Definition: TopDiLeptonOfflineDQM.h:117
TopDiLeptonOffline::MonitorEnsemble::lowerEdge_
double lowerEdge_
mass window upper and lower edge
Definition: TopDiLeptonOfflineDQM.h:171
GsfElectron.h
TopDiLeptonOfflineDQM::analyze
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
do this during the event loop
Definition: TopDiLeptonOfflineDQM.cc:772
EDGetToken.h
TopDiLeptonOfflineDQM::beamspotSelect_
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
Definition: TopDiLeptonOfflineDQM.h:330
TopDiLeptonOfflineDQM::PFJetSteps
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
Definition: TopDiLeptonOfflineDQM.h:347
TopDiLeptonOfflineDQM::ElectronStep
std::unique_ptr< SelectionStep< reco::PFCandidate > > ElectronStep
Definition: TopDiLeptonOfflineDQM.h:342
TopDiLeptonOffline::MonitorEnsemble::eidCutValue_
double eidCutValue_
Definition: TopDiLeptonOfflineDQM.h:149
TopDiLeptonOfflineDQM::vertex_
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
Definition: TopDiLeptonOfflineDQM.h:324
TopDiLeptonOfflineDQM::selectionStep
std::string selectionStep(const std::string &label)
Definition: TopDiLeptonOfflineDQM.h:316
TopDiLeptonOffline::MonitorEnsemble::diMuonLogged_
int diMuonLogged_
Definition: TopDiLeptonOfflineDQM.h:174
edm::ParameterSet
Definition: ParameterSet.h:47
TopDiLeptonOffline::MonitorEnsemble::elecMuLogged_
int elecMuLogged_
number of logged interesting events
Definition: TopDiLeptonOfflineDQM.h:174
TopDiLeptonOfflineDQM::METStep
std::unique_ptr< SelectionStep< reco::MET > > METStep
Definition: TopDiLeptonOfflineDQM.h:344
EDConsumerBase.h
TopDiLeptonOfflineDQM::beamspot_
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
Definition: TopDiLeptonOfflineDQM.h:328
TopDiLeptonOffline::MonitorEnsemble::upperEdge_
double upperEdge_
Definition: TopDiLeptonOfflineDQM.h:171
deltaR.h
TopDiLeptonOffline::MonitorEnsemble::monitorPath
std::string monitorPath(const std::string &label) const
Definition: TopDiLeptonOfflineDQM.h:77
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
gpuVertexFinder::hist
__shared__ Hist hist
Definition: gpuClusterTracksDBSCAN.h:48
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
TriggerNames.h
TopDiLeptonOffline::MonitorEnsemble::diElecLogged_
int diElecLogged_
Definition: TopDiLeptonOfflineDQM.h:174
value
Definition: value.py:1
TopDiLeptonOfflineDQM::setup_
edm::ParameterSet setup_
Definition: TopDiLeptonOfflineDQM.h:350
edm::EventSetup
Definition: EventSetup.h:58
TopDiLeptonOffline::MonitorEnsemble::elecIso_
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > elecIso_
extra isolation criterion on electron
Definition: TopDiLeptonOfflineDQM.h:151
TopDiLeptonOffline::MonitorEnsemble::~MonitorEnsemble
~MonitorEnsemble()
default destructor
Definition: TopDiLeptonOfflineDQM.h:67
edm::ESGetToken< JetCorrector, JetCorrectionsRecord >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
looper.cfg
cfg
Definition: looper.py:296
TopDiLeptonOffline::MonitorEnsemble::book
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
Definition: TopDiLeptonOfflineDQM.cc:135
ValueMap.h
TopDiLeptonOffline::MonitorEnsemble::muonSelect_
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > muonSelect_
extra selection on muons
Definition: TopDiLeptonOfflineDQM.h:159
TopDiLeptonOffline::MonitorEnsemble::DIELEC
Definition: TopDiLeptonOfflineDQM.h:60
Vertex.h
TopDiLeptonOfflineDQM::MuonStep
std::unique_ptr< SelectionStep< reco::PFCandidate > > MuonStep
Definition: TopDiLeptonOfflineDQM.h:341
Frameworkfwd.h
TopDiLeptonOffline
Definition: TopDiLeptonOfflineDQM.cc:16
TopDiLeptonOfflineDQM::CaloJetSteps
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
Definition: TopDiLeptonOfflineDQM.h:346
phase2tkutil::DQMStore
dqm::reco::DQMStore DQMStore
Definition: TrackerPhase2DQMUtil.h:16
TopDiLeptonOfflineDQM::triggerPaths_
std::vector< std::string > triggerPaths_
trigger paths
Definition: TopDiLeptonOfflineDQM.h:322
TopDiLeptonOffline::MonitorEnsemble::jetSelect_
std::string jetSelect_
Definition: TopDiLeptonOfflineDQM.h:169
TopDiLeptonOfflineDQM::triggerTable_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
Definition: TopDiLeptonOfflineDQM.h:316
MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: SiPixelSCurveCalibrationAnalysis.h:55
dqm::implementation::IBooker
Definition: DQMStore.h:43
TopDiLeptonOffline::MonitorEnsemble::elecs_
edm::EDGetTokenT< edm::View< reco::PFCandidate > > elecs_
Definition: TopDiLeptonOfflineDQM.h:121
TopDiLeptonOfflineDQM::selection_
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< TopDiLeptonOffline::MonitorEnsemble > > > selection_
Definition: TopDiLeptonOfflineDQM.h:340
ConsumesCollector.h
ParameterSet.h
TopDiLeptonOffline::MonitorEnsemble::booked
bool booked(const std::string histName) const
check if histogram was booked
Definition: TopDiLeptonOfflineDQM.h:96
TopDiLeptonOffline::MonitorEnsemble::STANDARD
Definition: TopDiLeptonOfflineDQM.h:55
event
Definition: event.py:1
TopDiLeptonOffline::MonitorEnsemble::verbosity_
Level verbosity_
verbosity level for booking
Definition: TopDiLeptonOfflineDQM.h:111
TopDiLeptonOffline::MonitorEnsemble::jets_
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
Definition: TopDiLeptonOfflineDQM.h:119
edm::Event
Definition: Event.h:73
TopDiLeptonOffline::MonitorEnsemble::MonitorEnsemble
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Definition: TopDiLeptonOfflineDQM.cc:18
TopDiLeptonOffline::MonitorEnsemble::muonIso_
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > muonIso_
extra isolation criterion on muon
Definition: TopDiLeptonOfflineDQM.h:156
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
label
const char * label
Definition: PFTauDecayModeTools.cc:11
edm::TriggerResults
Definition: TriggerResults.h:35
TopDiLeptonOffline::MonitorEnsemble::hists_
std::map< std::string, MonitorElement * > hists_
Definition: TopDiLeptonOfflineDQM.h:177
TopDiLeptonOffline::MonitorEnsemble::fill
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
Definition: TopDiLeptonOfflineDQM.cc:290
reco::LeafCandidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: LeafCandidate.h:23
TopDQMHelpers.h
TopDiLeptonOffline::MonitorEnsemble::selectionPath
std::string selectionPath(const std::string &label) const
Definition: TopDiLeptonOfflineDQM.h:80