CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TopSingleLeptonDQM.h
Go to the documentation of this file.
1 #ifndef TOPSINGLELEPTONDQM
2 #define TOPSINGLELEPTONDQM
3 
4 #include <string>
5 #include <vector>
10 
50 namespace TopSingleLepton {
51 
53  public:
55  enum Level {
59  };
60 
61  public:
63  MonitorEnsemble(const char* label, const edm::ParameterSet& cfg,
67 
71  void fill(const edm::Event& event, const edm::EventSetup& setup);
72 
73  private:
77  return label.substr(label.find(':') + 1);
78  };
82  return label.substr(0, label.find(':'));
83  };
84 
86  void triggerBinLabels(std::string channel,
87  const std::vector<std::string> labels);
89  void fill(const edm::Event& event, const edm::TriggerResults& triggerTable,
90  std::string channel, const std::vector<std::string> labels) const;
91 
93  bool booked(const std::string histName) const {
94  return hists_.find(histName.c_str()) != hists_.end();
95  };
97  void fill(const std::string histName, double value) const {
98  if (booked(histName.c_str()))
99  hists_.find(histName.c_str())->second->Fill(value);
100  };
102  void fill(const std::string histName, double xValue, double yValue) const {
103  if (booked(histName.c_str()))
104  hists_.find(histName.c_str())->second->Fill(xValue, yValue);
105  };
107  void fill(const std::string histName, double xValue, double yValue,
108  double zValue) const {
109  if (booked(histName.c_str()))
110  hists_.find(histName.c_str())->second->Fill(xValue, yValue, zValue);
111  };
112 
113  private:
119  std::vector<edm::EDGetTokenT<edm::View<reco::MET> > > mets_;
129  std::vector<std::string> triggerPaths_;
130 
144  // int eidPattern_;
145  // the cut for the MVA Id
146  double eidCutValue_;
151 
155 
158 
161 
176  btagCSV_;
181 
183  int logged_;
187  std::map<std::string, MonitorElement*> hists_;
189 };
190 
192  std::string channel, const std::vector<std::string> labels) {
193  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
194  hists_[(channel + "Mon_").c_str()]
195  ->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
196  hists_[(channel + "Eff_").c_str()]
197  ->setBinLabel(idx + 1, "[" + selectionPath(labels[idx]) + "]|[" +
198  monitorPath(labels[idx]) + "]",
199  1);
200  }
201 }
202 
204  const edm::TriggerResults& triggerTable,
205  std::string channel,
206  const std::vector<std::string> labels) const {
207  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
208  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
209  fill((channel + "Mon_").c_str(), idx + 0.5);
210  // take care to fill triggerMon_ before evts is being called
211  int evts = hists_.find((channel + "Mon_").c_str())
212  ->second->getBinContent(idx + 1);
213  double value = hists_.find((channel + "Eff_").c_str())
214  ->second->getBinContent(idx + 1);
215  fill(
216  (channel + "Eff_").c_str(), idx + 0.5,
217  1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) -
218  value));
219  }
220  }
221 }
222 }
223 
224 #include <utility>
225 
231 
236 
275 // using TopSingleLepton::MonitorEnsemble;
277 
279  public:
284  if (vertexSelect_) delete vertexSelect_;
285  if (beamspotSelect_) delete beamspotSelect_;
286  if (MuonStep) delete MuonStep;
287  if (ElectronStep) delete ElectronStep;
288  if (PvStep) delete PvStep;
289  if (METStep) delete METStep;
290  for (unsigned int i = 0; i < JetSteps.size(); i++)
291  if (JetSteps[i]) delete JetSteps[i];
292  for (unsigned int i = 0; i < CaloJetSteps.size(); i++)
293  if (CaloJetSteps[i]) delete CaloJetSteps[i];
294  for (unsigned int i = 0; i < PFJetSteps.size(); i++)
295  if (PFJetSteps[i]) delete PFJetSteps[i];
296  };
297 
299  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup);
300 
301  private:
305  return label.substr(0, label.find(':'));
306  };
310  return label.substr(label.find(':') + 1);
311  };
312 
313  private:
317  std::vector<std::string> triggerPaths_;
320 
326 
329  std::vector<std::string> selectionOrder_;
336  std::pair<edm::ParameterSet, TopSingleLepton::MonitorEnsemble*> >
342  std::vector<SelectionStep<reco::Jet>*> JetSteps;
343  std::vector<SelectionStep<reco::CaloJet>*> CaloJetSteps;
344  std::vector<SelectionStep<reco::PFJet>*> PFJetSteps;
345 };
346 
347 #endif
348 
349 /* Local Variables: */
350 /* show-trailing-whitespace: t */
351 /* truncate-lines: t */
352 /* End: */
std::map< std::string, MonitorElement * > hists_
histogram container
std::string selectionPath(const std::string &label) const
void fill(const std::string histName, double xValue, double yValue, double zValue) const
fill histogram if it had been booked before (2-dim version)
int logged_
number of logged interesting events
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
int i
Definition: DBlmapReader.cc:9
double btagEffWP_
btag working points
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
default contructor
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
SelectionStep< reco::MET > * METStep
std::vector< std::string > triggerPaths_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
SelectionStep< reco::PFCandidate > * ElectronStep
define MonitorEnsembple to be used
StringCutObjectSelector< reco::BeamSpot > * beamspotSelect_
string cut selector
TopSingleLeptonDQM(const edm::ParameterSet &cfg)
default constructor
edm::EDGetTokenT< reco::BeamSpot > beamspot__
edm::EDGetTokenT< reco::JetTagCollection > btagCSV_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:25
std::vector< std::string > triggerPaths_
trigger paths
std::vector< std::string > selectionOrder_
StringCutObjectSelector< reco::PFCandidate > * elecIso_
extra isolation criterion on electron
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
std::string selectionStep(const std::string &label)
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
StringCutObjectSelector< reco::PFCandidate > * muonIso_
extra isolation criterion on muon
Level verbosity_
verbosity level for booking
StringCutObjectSelector< reco::Vertex > * pvSelect_
std::vector< SelectionStep< reco::PFJet > * > PFJetSteps
double lowerEdge_
mass window upper and lower edge
U second(std::pair< T, U > const &p)
SelectionStep< reco::PFCandidate > * MuonStep
StringCutObjectSelector< reco::PFCandidate > * elecSelect_
extra selection on electrons
std::map< std::string, std::pair< edm::ParameterSet, TopSingleLepton::MonitorEnsemble * > > selection_
edm::InputTag beamspot_
beamspot
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
void book(std::string directory)
book histograms in subdirectory directory
~MonitorEnsemble()
default destructor
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
edm::EDGetTokenT< edm::View< reco::PFCandidate > > elecs_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
SelectionStep< reco::Vertex > * PvStep
std::string label_
instance label
std::vector< SelectionStep< reco::CaloJet > * > CaloJetSteps
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
Level
different verbosity levels
std::string objectType(const std::string &label)
StringCutObjectSelector< reco::PFCandidate > * muonSelect_
extra selection on muons
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
std::string jetCorrector_
jetCorrector
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
~TopSingleLeptonDQM()
default destructor
std::string monitorPath(const std::string &label) const
std::vector< SelectionStep< reco::Jet > * > JetSteps
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
do this during the event loop
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
StringCutObjectSelector< reco::Vertex > * vertexSelect_
string cut selector
bool booked(const std::string histName) const
check if histogram was booked
DQMStore * store_
storage manager