CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SingleTopTChannelLeptonDQM.h
Go to the documentation of this file.
1 #ifndef SINGLETOPTCHANNELLEPTONDQM
2 #define SINGLETOPTCHANNELLEPTONDQM
3 
4 #include <string>
5 #include <vector>
6 
8 
22 
51 namespace SingleTopTChannelLepton {
54 
56  public:
59 
60  public:
62  MonitorEnsemble(const char* label,
63  const edm::ParameterSet& cfg,
64  const edm::VParameterSet& vcfg,
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(':')); };
81 
83  void triggerBinLabels(std::string channel, const std::vector<std::string> labels);
85  void fill(const edm::Event& event,
86  const edm::TriggerResults& triggerTable,
87  std::string channel,
88  const std::vector<std::string> labels) const;
89 
91  bool booked(const std::string histName) const { return hists_.find(histName) != hists_.end(); };
93  void fill(const std::string histName, double value) const {
94  if (booked(histName))
95  hists_.find(histName)->second->Fill(value);
96  };
98  void fill(const std::string histName, double xValue, double yValue) const {
99  if (booked(histName))
100  hists_.find(histName)->second->Fill(xValue, yValue);
101  };
103  void fill(const std::string histName, double xValue, double yValue, double zValue) const {
104  if (booked(histName))
105  hists_.find(histName)->second->Fill(xValue, yValue, zValue);
106  };
107 
108  private:
114  std::vector<edm::EDGetTokenT<edm::View<reco::MET> > > mets_;
115  // std::vector<edm::InputTag> mets_;
122 
123  // edm::InputTag elecs_, elecs_gsf_, muons_, muons_reco_, jets_, pvs_;
124 
126  // edm::InputTag triggerTable_;
128 
131  std::vector<std::string> triggerPaths_;
132 
134  // edm::InputTag electronId_;
147  // int eidPattern_;
148  // the cut for the MVA Id
149  double eidCutValue_;
153  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > elecSelect_;
155 
158  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > pvSelect_;
159 
161  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > muonIso_;
162 
164  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate> > muonSelect_;
169 
171  std::unique_ptr<StringCutObjectSelector<reco::JetID> > jetIDSelect_;
172  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetlooseSelection_;
173  std::unique_ptr<StringCutObjectSelector<reco::PFJet> > jetSelection_;
181  // edm::InputTag btagEff_, btagPur_, btagVtx_, btagCombVtx_;
183 
188 
190  int logged_;
193  std::map<std::string, MonitorElement*> hists_;
195 
197 
198  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > muonSelect;
199  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > muonIso;
200 
201  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > elecSelect;
202  std::unique_ptr<StringCutObjectSelector<reco::PFCandidate, true> > elecIso;
203  };
204 
205  inline void MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string> labels) {
206  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
207  hists_[channel + "Mon_"]->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
208  hists_[channel + "Eff_"]->setBinLabel(
209  idx + 1, "[" + selectionPath(labels[idx]) + "]|[" + monitorPath(labels[idx]) + "]", 1);
210  }
211  }
212 
214  const edm::TriggerResults& triggerTable,
215  std::string channel,
216  const std::vector<std::string> labels) const {
217  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
218  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
219  fill(channel + "Mon_", idx + 0.5);
220  // take care to fill triggerMon_ before evts is being called
221  int evts = hists_.find(channel + "Mon_")->second->getBinContent(idx + 1);
222  double value = hists_.find(channel + "Eff_")->second->getBinContent(idx + 1);
223  fill(
224  channel + "Eff_", idx + 0.5, 1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) - value));
225  }
226  }
227  }
228 } // namespace SingleTopTChannelLepton
229 
230 #include <utility>
231 
236 
241 
273 // using SingleTopTChannelLepton::MonitorEnsemble;
275 
277 public:
282 
284  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
285 
286 protected:
287  //Book histograms
288  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
289 
290 private:
293  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
296  std::string selectionStep(const std::string& label) { return label.substr(label.find(':') + 1); };
297 
298 private:
301 
303  std::vector<std::string> triggerPaths_;
308  std::unique_ptr<StringCutObjectSelector<reco::Vertex> > vertexSelect_;
309 
314  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot> > beamspotSelect_;
315 
318  std::vector<std::string> selectionOrder_;
324  std::map<std::string, std::pair<edm::ParameterSet, std::unique_ptr<SingleTopTChannelLepton::MonitorEnsemble> > >
326 
327  std::unique_ptr<SelectionStep<reco::Muon> > MuonStep;
328  std::unique_ptr<SelectionStep<reco::PFCandidate> > PFMuonStep;
329  std::unique_ptr<SelectionStep<reco::GsfElectron> > ElectronStep;
330  std::unique_ptr<SelectionStep<reco::PFCandidate> > PFElectronStep;
331  std::unique_ptr<SelectionStep<reco::Vertex> > PvStep;
332 
333  std::vector<std::unique_ptr<SelectionStep<reco::Jet> > > JetSteps;
334  std::vector<std::unique_ptr<SelectionStep<reco::CaloJet> > > CaloJetSteps;
335  std::vector<std::unique_ptr<SelectionStep<reco::PFJet> > > PFJetSteps;
336 
337  std::unique_ptr<SelectionStep<reco::MET> > METStep;
338  std::vector<edm::ParameterSet> sel;
339 };
340 
341 #endif
std::vector< std::string > selectionOrder_
std::map< std::string, MonitorElement * > hists_
std::string objectType(const std::string &label)
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
tuple cfg
Definition: looper.py:296
std::vector< std::string > triggerPaths_
trigger paths
Level verbosity_
verbosity level for booking
~SingleTopTChannelLeptonDQM() override
default destructor
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetlooseSelection_
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > elecSelect
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:34
int logged_
number of logged interesting events
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
define MonitorEnsembple to be used
bool booked(const std::string histName) const
check if histogram was booked
edm::EDGetTokenT< reco::JetTagCollection > btagCombVtx_
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
SingleTopTChannelLeptonDQM(const edm::ParameterSet &cfg)
default constructor
dqm::reco::DQMStore DQMStore
edm::InputTag vertex_
primary vertex
char const * label
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonSelect_
extra selection on muons
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > muonIso_
extra isolation criterion on muon
double lowerEdge_
mass window upper and lower edge
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
std::vector< edm::ParameterSet > sel
std::string monitorPath(const std::string &label) const
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_gsf_
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
edm::ESGetToken< JetCorrector, JetCorrectionsRecord > jetCorrector_
jetCorrector
void fill(const std::string histName, double xValue, double yValue, double zValue) const
fill histogram if it had been booked before (2-dim version)
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > muonIso
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > elecIso
std::unique_ptr< SelectionStep< reco::PFCandidate > > PFElectronStep
std::string selectionPath(const std::string &label) const
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
edm::EDGetTokenT< reco::JetTagCollection > btagCSV_
std::string selectionStep(const std::string &label)
std::unique_ptr< SelectionStep< reco::GsfElectron > > ElectronStep
dqm::legacy::MonitorElement MonitorElement
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
edm::EDGetTokenT< edm::View< reco::PFCandidate > > elecs_
std::unique_ptr< SelectionStep< reco::MET > > METStep
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
edm::EDGetTokenT< reco::Vertex > vertex__
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, const edm::VParameterSet &vcfg, edm::ConsumesCollector &&iC)
default contructor
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
edm::EDGetTokenT< reco::BeamSpot > beamspot__
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
std::unique_ptr< StringCutObjectSelector< reco::PFJet > > jetSelection_
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
do this during the event loop
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< SingleTopTChannelLepton::MonitorEnsemble > > > selection_
std::unique_ptr< SelectionStep< reco::Muon > > MuonStep
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > elecSelect_
extra selection on electrons
Definition: Run.h:45
std::unique_ptr< SelectionStep< reco::PFCandidate > > PFMuonStep
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > muonSelect
std::string elecIso_
extra isolation criterion on electron