CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TopDiLeptonOfflineDQM.h
Go to the documentation of this file.
1 #ifndef TOPDILEPTONOFFLINEDQM
2 #define TOPDILEPTONOFFLINEDQM
3 
4 #include <string>
5 #include <vector>
6 
10 
50 namespace TopDiLeptonOffline {
51 
53  public:
55  enum Level {
59  };
64  enum DecayChannel {
69  };
70 
71  public:
74  MonitorEnsemble(const char* label, const edm::ParameterSet& cfg,
78 
82  void fill(const edm::Event& event, const edm::EventSetup& setup);
83 
84  private:
88  return label.substr(label.find(':') + 1);
89  };
93  return label.substr(0, label.find(':'));
94  };
96  DecayChannel decayChannel(const std::vector<const reco::PFCandidate*>& muons,
97  const std::vector<const reco::PFCandidate*>& elecs)
98  const;
99 
103  void triggerBinLabels(std::string channel,
104  const std::vector<std::string> labels);
106  void fill(const edm::Event& event, const edm::TriggerResults& triggerTable,
107  std::string channel, const std::vector<std::string> labels) const;
108 
110  bool booked(const std::string histName) const {
111  return hists_.find(histName.c_str()) != hists_.end();
112  };
114  void fill(const std::string histName, double value) const {
115  if (booked(histName.c_str()))
116  hists_.find(histName.c_str())->second->Fill(value);
117  };
119  void fill(const std::string histName, double xValue, double yValue) const {
120  if (booked(histName.c_str()))
121  hists_.find(histName.c_str())->second->Fill(xValue, yValue);
122  };
124  void fill(const std::string histName, double xValue, double yValue,
125  double zValue) const {
126  if (booked(histName.c_str()))
127  hists_.find(histName.c_str())->second->Fill(xValue, yValue, zValue);
128  };
129 
130  private:
139 
141  std::vector<edm::EDGetTokenT<edm::View<reco::MET> > > mets_;
142 
147  std::vector<std::string> elecMuPaths_;
149  std::vector<std::string> diMuonPaths_;
150 
164  // int eidPattern_;
165  // the cut for the MVA Id
166  double eidCutValue_;
171 
174 
177 
189 
195  std::map<std::string, MonitorElement*> hists_;
196 };
197 
199  // set axes titles for selected events
200  hists_[hist.c_str()]->getTH1()->SetOption("TEXT");
201  hists_[hist.c_str()]->setBinLabel(1, "Run", 1);
202  hists_[hist.c_str()]->setBinLabel(2, "Block", 1);
203  hists_[hist.c_str()]->setBinLabel(3, "Event", 1);
204  hists_[hist.c_str()]->setBinLabel(6, "pt_{L2L3}(jet1)", 1);
205  hists_[hist.c_str()]->setBinLabel(7, "pt_{L2L3}(jet2)", 1);
206  hists_[hist.c_str()]->setBinLabel(8, "MET_{Calo}", 1);
207  hists_[hist.c_str()]->setAxisTitle("logged evts", 2);
208 
209  if (hist == "diMuonLogger_") {
210  hists_[hist.c_str()]->setBinLabel(4, "pt(muon)", 1);
211  hists_[hist.c_str()]->setBinLabel(5, "pt(muon)", 1);
212  }
213  if (hist == "diElecLogger_") {
214  hists_[hist.c_str()]->setBinLabel(4, "pt(elec)", 1);
215  hists_[hist.c_str()]->setBinLabel(5, "pt(elec)", 1);
216  }
217  if (hist == "elecMuLogger_") {
218  hists_[hist.c_str()]->setBinLabel(4, "pt(elec)", 1);
219  hists_[hist.c_str()]->setBinLabel(5, "pt(muon)", 1);
220  }
221 }
222 
224  std::string channel, const std::vector<std::string> labels) {
225  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
226  hists_[(channel + "Mon_").c_str()]
227  ->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
228  hists_[(channel + "Eff_").c_str()]
229  ->setBinLabel(idx + 1, "[" + selectionPath(labels[idx]) + "]|[" +
230  monitorPath(labels[idx]) + "]",
231  1);
232  }
233 }
234 
236  const edm::TriggerResults& triggerTable,
237  std::string channel,
238  const std::vector<std::string> labels) const {
239  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
240  if (accept(event, triggerTable, monitorPath(labels[idx]))) {
241  fill((channel + "Mon_").c_str(), idx + 0.5);
242  // take care to fill triggerMon_ before evts is being called
243  int evts = hists_.find((channel + "Mon_").c_str())
244  ->second->getBinContent(idx + 1);
245  double value = hists_.find((channel + "Eff_").c_str())
246  ->second->getBinContent(idx + 1);
247  fill(
248  (channel + "Eff_").c_str(), idx + 0.5,
249  1. / evts * (accept(event, triggerTable, selectionPath(labels[idx])) -
250  value));
251  }
252  }
253 }
254 
256  const std::vector<const reco::PFCandidate*>& muons,
257  const std::vector<const reco::PFCandidate*>& elecs) const {
259  if (muons.size() > 1) {
260  type = DIMUON;
261  } else if (elecs.size() > 1) {
262  type = DIELEC;
263  } else if (!elecs.empty() && !muons.empty()) {
264  type = ELECMU;
265  }
266  return type;
267 }
268 }
269 
270 #include <utility>
271 
276 
281 
319 // using TopDiLeptonOffline::MonitorEnsemble;
321 
323  public:
328  if (beamspotSelect_) delete beamspotSelect_;
329  if (vertexSelect_) delete vertexSelect_;
330 
331  if (MuonStep) delete MuonStep;
332 
333  if (ElectronStep) delete ElectronStep;
334 
335  if (PvStep) delete PvStep;
336 
337  if (METStep) delete METStep;
338 
339  for (unsigned int i = 0; i < JetSteps.size(); i++)
340 
341  if (JetSteps[i]) delete JetSteps[i];
342 
343  for (unsigned int i = 0; i < CaloJetSteps.size(); i++)
344 
345  if (CaloJetSteps[i]) delete CaloJetSteps[i];
346 
347  for (unsigned int i = 0; i < PFJetSteps.size(); i++)
348 
349  if (PFJetSteps[i]) delete PFJetSteps[i];
350  }
351 
353  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup);
354 
355  private:
359  return label.substr(0, label.find(':'));
360  };
364  return label.substr(label.find(':') + 1);
365  };
366 
367  private:
371  std::vector<std::string> triggerPaths_;
380 
383  std::vector<std::string> selectionOrder_;
390  std::pair<edm::ParameterSet, TopDiLeptonOffline::MonitorEnsemble*> >
396  std::vector<SelectionStep<reco::Jet>*> JetSteps;
397  std::vector<SelectionStep<reco::CaloJet>*> CaloJetSteps;
398  std::vector<SelectionStep<reco::PFJet>*> PFJetSteps;
399 };
400 
401 #endif
type
Definition: HCALResponse.h:21
StringCutObjectSelector< reco::Vertex > * vertexSelect_
string cut selector
std::string selectionPath(const std::string &label) const
std::string selectionStep(const std::string &label)
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > selectionOrder_
~TopDiLeptonOfflineDQM()
default destructor
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
std::map< std::string, std::pair< edm::ParameterSet, TopDiLeptonOffline::MonitorEnsemble * > > selection_
Level verbosity_
verbosity level for booking
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
define MonitorEnsembple to be used
SelectionStep< reco::MET > * METStep
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
do this during the event loop
SelectionStep< reco::PFCandidate > * ElectronStep
void loggerBinLabels(std::string hist)
set labels for event logging histograms
std::string monitorPath(const std::string &label) const
SelectionStep< reco::Vertex > * PvStep
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:25
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
bool booked(const std::string histName) const
check if histogram was booked
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
U second(std::pair< T, U > const &p)
SelectionStep< reco::PFCandidate > * MuonStep
std::vector< SelectionStep< reco::CaloJet > * > CaloJetSteps
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
StringCutObjectSelector< reco::PFCandidate > * elecIso_
extra isolation criterion on electron
double lowerEdge_
mass window upper and lower edge
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
std::vector< std::string > elecMuPaths_
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
StringCutObjectSelector< reco::PFCandidate, true > * muonIso_
extra isolation criterion on muon
StringCutObjectSelector< reco::BeamSpot > * beamspotSelect_
string cut selector
TopDiLeptonOfflineDQM(const edm::ParameterSet &cfg)
default constructor
void book(std::string directory)
book histograms in subdirectory directory
StringCutObjectSelector< reco::PFCandidate > * elecSelect_
extra selection on electrons
int elecMuLogged_
number of logged interesting events
std::vector< std::string > diMuonPaths_
trigger paths for di muon channel
reco::LeafCandidate::LorentzVector LorentzVector
std::vector< SelectionStep< reco::Jet > * > JetSteps
std::map< std::string, MonitorElement * > hists_
histogram container
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
tuple muons
Definition: patZpeak.py:38
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::vector< std::string > triggerPaths_
trigger paths
std::string objectType(const std::string &label)
StringCutObjectSelector< reco::PFCandidate, true > * muonSelect_
extra selection on muons
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
DecayChannel decayChannel(const std::vector< const reco::PFCandidate * > &muons, const std::vector< const reco::PFCandidate * > &elecs) const
determine dileptonic decay channel
void fill(const std::string histName, double xValue, double yValue, double zValue) const
fill histogram if it had been booked before (2-dim version)
std::vector< SelectionStep< reco::PFJet > * > PFJetSteps
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: LeafCandidate.h:28
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
edm::EDGetTokenT< edm::View< reco::PFCandidate > > elecs_