CMS 3D CMS Logo

ElectronDqmAnalyzerBase.cc
Go to the documentation of this file.
1 
3 //#include "DQMServices/Core/interface/DQMStore.h"
7 #include "TMath.h"
8 #include "TFile.h"
9 #include "TH1F.h"
10 #include "TH1I.h"
11 #include "TH2F.h"
12 #include "TProfile.h"
13 #include "TTree.h"
14 #include <iostream>
15 #include <algorithm>
16 #include <sstream>
17 
19  : bookPrefix_("ele"), bookIndex_(0), histoNamesReady(false) {
20  verbosity_ = conf.getUntrackedParameter<int>("Verbosity");
21  finalStep_ = conf.getParameter<std::string>("FinalStep");
22  inputFile_ = conf.getParameter<std::string>("InputFile");
23  outputFile_ = conf.getParameter<std::string>("OutputFile");
24  inputInternalPath_ = conf.getParameter<std::string>("InputFolderName");
25  outputInternalPath_ = conf.getParameter<std::string>("OutputFolderName");
26 }
27 
29 
31 
33 
34 void ElectronDqmAnalyzerBase::setBookEfficiencyFlag(const bool &eff_flag) { bookEfficiencyFlag_ = eff_flag; }
35 
36 void ElectronDqmAnalyzerBase::setBookStatOverflowFlag(const bool &statOverflow_flag) {
37  bookStatOverflowFlag_ = statOverflow_flag;
38 }
39 
41  if (bookPrefix_.empty()) {
42  return name;
43  }
44  std::ostringstream oss;
45  oss << bookPrefix_;
46  if (bookIndex_ >= 0) {
47  oss << bookIndex_++;
48  }
49  oss << "_" << name;
50  return oss.str();
51 }
52 
54  edm::LogInfo("DQMAnalyzeBase::bookHistograms") << std::endl;
55 }
56 
58  const std::string &name,
59  const std::string &title,
60  int nchX,
61  double lowX,
62  double highX,
63  const std::string &titleX,
64  const std::string &titleY,
65  Option_t *option) {
67  MonitorElement *me = iBooker.book1D(newName(name), title, nchX, lowX, highX);
68  if (!titleX.empty()) {
69  me->setAxisTitle(titleX);
70  }
71  if (!titleY.empty()) {
72  me->setAxisTitle(titleY, 2);
73  }
74  if (TString(option) != "") {
75  me->setOption(option);
76  }
78  me->setStatOverflows(kTRUE);
79  }
80  return me;
81 }
82 
84  const std::string &name,
85  const std::string &title,
86  int nchX,
87  double lowX,
88  double highX,
89  const std::string &titleX,
90  const std::string &titleY,
91  Option_t *option) {
93  MonitorElement *me = iBooker.book1D(newName(name), title, nchX, lowX, highX);
94  if (me->getTH1F()->GetSumw2N() == 0)
95  me->enableSumw2();
96  if (!titleX.empty()) {
97  me->setAxisTitle(titleX);
98  }
99  if (!titleY.empty()) {
100  me->setAxisTitle(titleY, 2);
101  }
102  if (TString(option) != "") {
103  me->setOption(option);
104  }
105  if (bookStatOverflowFlag_) {
106  me->setStatOverflows(kTRUE);
107  }
108  return me;
109 }
110 
112  const std::string &name,
113  const std::string &title,
114  int nchX,
115  double lowX,
116  double highX,
117  int nchY,
118  double lowY,
119  double highY,
120  const std::string &titleX,
121  const std::string &titleY,
122  Option_t *option) {
124  MonitorElement *me = iBooker.book2D(newName(name), title, nchX, lowX, highX, nchY, lowY, highY);
125  if (!titleX.empty()) {
126  me->setAxisTitle(titleX);
127  }
128  if (!titleY.empty()) {
129  me->setAxisTitle(titleY, 2);
130  }
131  if (TString(option) != "") {
132  me->setOption(option);
133  }
134  if (bookStatOverflowFlag_) {
135  me->setStatOverflows(kTRUE);
136  }
137  return me;
138 }
139 
141  const std::string &name,
142  const std::string &title,
143  int nchX,
144  double lowX,
145  double highX,
146  int nchY,
147  double lowY,
148  double highY,
149  const std::string &titleX,
150  const std::string &titleY,
151  Option_t *option) {
153  MonitorElement *me = iBooker.book2D(newName(name), title, nchX, lowX, highX, nchY, lowY, highY);
154  if (me->getTH2F()->GetSumw2N() == 0)
155  me->enableSumw2();
156  if (!titleX.empty()) {
157  me->setAxisTitle(titleX);
158  }
159  if (!titleY.empty()) {
160  me->setAxisTitle(titleY, 2);
161  }
162  if (TString(option) != "") {
163  me->setOption(option);
164  }
165  if (bookStatOverflowFlag_) {
166  me->setStatOverflows(kTRUE);
167  }
168  return me;
169 }
170 
172  const std::string &name,
173  const std::string &title,
174  int nchX,
175  double lowX,
176  double highX,
177  double lowY,
178  double highY,
179  const std::string &titleX,
180  const std::string &titleY,
181  Option_t *option) {
183  MonitorElement *me = iBooker.bookProfile(newName(name), title, nchX, lowX, highX, lowY, highY, " ");
184  if (!titleX.empty()) {
185  me->getTProfile()->GetXaxis()->SetTitle(titleX.c_str());
186  }
187  if (!titleY.empty()) {
188  me->setAxisTitle(titleY, 2);
189  }
190  if (TString(option) != "") {
191  me->getTProfile()->SetOption(option);
192  }
193  if (bookStatOverflowFlag_) {
194  me->setStatOverflows(kTRUE);
195  }
196  return me;
197 }
dqm::impl::MonitorElement
Definition: MonitorElement.h:98
ElectronDqmAnalyzerBase::setBookEfficiencyFlag
void setBookEfficiencyFlag(const bool &)
Definition: ElectronDqmAnalyzerBase.cc:34
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
ElectronDqmAnalyzerBase::outputInternalPath_
std::string outputInternalPath_
Definition: ElectronDqmAnalyzerBase.h:118
ElectronDqmAnalyzerBase::bookH2withSumw2
MonitorElement * bookH2withSumw2(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="COLZ")
Definition: ElectronDqmAnalyzerBase.cc:140
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
ElectronDqmAnalyzerBase::ElectronDqmAnalyzerBase
ElectronDqmAnalyzerBase(const edm::ParameterSet &conf)
Definition: ElectronDqmAnalyzerBase.cc:18
edm::Run
Definition: Run.h:45
ElectronDqmAnalyzerBase::outputFile_
std::string outputFile_
Definition: ElectronDqmAnalyzerBase.h:116
ElectronDqmAnalyzerBase::inputFile_
std::string inputFile_
Definition: ElectronDqmAnalyzerBase.h:115
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ElectronDqmAnalyzerBase::bookH1withSumw2
MonitorElement * bookH1withSumw2(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
Definition: ElectronDqmAnalyzerBase.cc:83
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
ElectronDqmAnalyzerBase.h
fileinputsource_cfi.option
option
Definition: fileinputsource_cfi.py:94
ElectronDqmAnalyzerBase::verbosity_
int verbosity_
Definition: ElectronDqmAnalyzerBase.h:107
ElectronDqmAnalyzerBase::finalStep_
std::string finalStep_
Definition: ElectronDqmAnalyzerBase.h:114
Service.h
ElectronDqmAnalyzerBase::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: ElectronDqmAnalyzerBase.cc:53
ElectronDqmAnalyzerBase::~ElectronDqmAnalyzerBase
~ElectronDqmAnalyzerBase() override
Definition: ElectronDqmAnalyzerBase.cc:28
ElectronDqmAnalyzerBase::setBookIndex
void setBookIndex(short)
Definition: ElectronDqmAnalyzerBase.cc:32
dqm::implementation::IBooker::bookProfile
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
ElectronDqmAnalyzerBase::bookH2
MonitorElement * bookH2(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="COLZ")
Definition: ElectronDqmAnalyzerBase.cc:111
ElectronDqmAnalyzerBase::inputInternalPath_
std::string inputInternalPath_
Definition: ElectronDqmAnalyzerBase.h:117
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ElectronDqmAnalyzerBase::bookEfficiencyFlag_
bool bookEfficiencyFlag_
Definition: ElectronDqmAnalyzerBase.h:110
edm::ParameterSet
Definition: ParameterSet.h:47
ElectronDqmAnalyzerBase::bookPrefix_
std::string bookPrefix_
Definition: ElectronDqmAnalyzerBase.h:108
ElectronDqmAnalyzerBase::newName
std::string newName(const std::string &name)
Definition: ElectronDqmAnalyzerBase.cc:40
ElectronDqmAnalyzerBase::bookH1
MonitorElement * bookH1(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
Definition: ElectronDqmAnalyzerBase.cc:57
edm::EventSetup
Definition: EventSetup.h:58
ElectronDqmAnalyzerBase::setBookStatOverflowFlag
void setBookStatOverflowFlag(const bool &)
Definition: ElectronDqmAnalyzerBase.cc:36
ElectronDqmAnalyzerBase::bookP1
MonitorElement * bookP1(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="E1 P")
Definition: ElectronDqmAnalyzerBase.cc:171
ElectronDqmAnalyzerBase::bookStatOverflowFlag_
bool bookStatOverflowFlag_
Definition: ElectronDqmAnalyzerBase.h:111
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm::implementation::IBooker
Definition: DQMStore.h:43
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
ParameterSet.h
ElectronDqmAnalyzerBase::setBookPrefix
void setBookPrefix(const std::string &)
Definition: ElectronDqmAnalyzerBase.cc:30
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
ElectronDqmAnalyzerBase::bookIndex_
short bookIndex_
Definition: ElectronDqmAnalyzerBase.h:109
hcallasereventfilter2012_cfi.prefix
prefix
Definition: hcallasereventfilter2012_cfi.py:10
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98