CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
monitor.cc
Go to the documentation of this file.
3 
5 {
6  auto addFunc = [&](std::string name) {
7  auto bin = binMap_.find(name);
8  if (bin == binMap_.end()) {
9  int index = binMap_.size();
10  binMap_[name] = index + 1;
11  } else {
12  throw cms::Exception("counterAlreadyExists") << "Name: " << name;
13  }
14  };
15 
16  addFunc("total events" );
17  addFunc("baseline" );
18  addFunc("opposite sign" );
19  addFunc("full lepton selection" );
20  addFunc("extra lepton veto" );
21  addFunc("met > 20 GeV" );
22  addFunc("mll > 12 GeV" );
23  addFunc("|mll - mZ| > 15 GeV" );
24  addFunc("minMET > 20 GeV" );
25  addFunc("minMET > 40 GeV for ee/mm" );
26  addFunc("dPhiDiLepJet < 165 dg for ee/mm" );
27  addFunc("SoftMuons==0" );
28  addFunc("top veto" );
29  addFunc("ptll > 45 GeV" );
30  addFunc("njets == 0" );
31  addFunc("max(lep1.pt(),lep2.pt())>30" );
32  addFunc("min(lep1.pt(),lep2.pt())>25" );
33  addFunc("njets == 1" );
34  addFunc("njets == 2 or 3" );
35  addFunc("abs(jet1.eta())<4.7 && abs(jet2.eta())<4.7");
36  addFunc("no central jets" );
37 
38  int maxBin = binMap_.size();
39  iBooker.setCurrentFolder("PhysicsHWW");
40  cutflowHist_[0] = iBooker.book1D("cutflow_mm", "HWW cutflow mm", maxBin, 0, maxBin);
41  cutflowHist_[1] = iBooker.book1D("cutflow_ee", "HWW cutflow ee", maxBin, 0, maxBin);
42  cutflowHist_[2] = iBooker.book1D("cutflow_em", "HWW cutflow em", maxBin, 0, maxBin);
43  cutflowHist_[3] = iBooker.book1D("cutflow_me", "HWW cutflow me", maxBin, 0, maxBin);
44 
45  for (auto it = binMap_.begin(); it != binMap_.end(); ++it) {
46  for (int i = 0; i < 4; ++i) {
47  cutflowHist_[i]->setBinContent(it->second, 0);
48  cutflowHist_[i]->setBinLabel(it->second, it->first.c_str(), 1);
49  }
50  }
51 }
52 
53 void EventMonitor::count(HypothesisType type, const char* name, double weight) {
54  auto bin = binMap_.find(name);
55  if (bin != binMap_.end()) {
56  cutflowHist_[type]->Fill(bin->second);
57  } else {
58  throw cms::Exception("counterNotFound") << "Name: " << name;
59  }
60 }
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
MonitorElement * cutflowHist_[4]
Definition: monitor.h:21
void setBinContent(int binx, double content)
set content of bin (1-D)
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void Fill(long long x)
void count(HypothesisType type, const char *name, double weight=1.0)
Definition: monitor.cc:53
EventMonitor(DQMStore::IBooker &iBooker)
Definition: monitor.cc:4
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
std::map< std::string, int > binMap_
Definition: monitor.h:20
int weight
Definition: histoStyle.py:50