CMS 3D CMS Logo

ScoutingAnalyzerBase.cc
Go to the documentation of this file.
6 #include <iostream>
7 #include <sstream>
8 
10  m_MEsPath = conf.getUntrackedParameter<std::string>("rootPath", "DataScouting");
11  m_modulePath = conf.getUntrackedParameter<std::string>("modulePath", "DataScouting");
12  m_verbosityLevel = conf.getUntrackedParameter<unsigned int>("verbosityLevel", 0);
13  if (!m_modulePath.empty()) {
14  m_MEsPath += "/" + m_modulePath;
15  }
16 }
17 
19 
21  // let's keep it in case we need massage
22  return name;
23 }
24 
26 
28  const std::string &name,
29  const std::string &title,
30  int nchX,
31  double lowX,
32  double highX,
33  const std::string &titleX,
34  const std::string &titleY,
35  Option_t *option) {
36  MonitorElement *me = iBooker.book1DD(newName(name), title, nchX, lowX, highX);
37  if (!titleX.empty()) {
38  me->getTH1()->GetXaxis()->SetTitle(titleX.c_str());
39  }
40  if (!titleY.empty()) {
41  me->getTH1()->GetYaxis()->SetTitle(titleY.c_str());
42  }
43  if (TString(option) != "") {
44  me->getTH1()->SetOption(option);
45  }
46  return me;
47 }
48 
50  const std::string &name,
51  const std::string &title,
52  int nchX,
53  double lowX,
54  double highX,
55  const std::string &titleX,
56  const std::string &titleY,
57  Option_t *option) {
58  std::cout << newName(name) << std::endl;
59  MonitorElement *me = iBooker.book1DD(newName(name), title, nchX, lowX, highX);
60  me->getTH1()->Sumw2();
61  if (!titleX.empty()) {
62  me->getTH1()->GetXaxis()->SetTitle(titleX.c_str());
63  }
64  if (!titleY.empty()) {
65  me->getTH1()->GetYaxis()->SetTitle(titleY.c_str());
66  }
67  if (TString(option) != "") {
68  me->getTH1()->SetOption(option);
69  }
70  return me;
71 }
72 
74  const std::string &name,
75  const std::string &title,
76  int nchX,
77  float *xbinsize,
78  const std::string &titleX,
79  const std::string &titleY,
80  Option_t *option) {
81  MonitorElement *me = iBooker.book1D(newName(name), title, nchX, xbinsize);
82  // book1DD not implemented in DQMServices/Core/src/DQMStore.cc
83  if (!titleX.empty()) {
84  me->getTH1()->GetXaxis()->SetTitle(titleX.c_str());
85  }
86  if (!titleY.empty()) {
87  me->getTH1()->GetYaxis()->SetTitle(titleY.c_str());
88  }
89  if (TString(option) != "") {
90  me->getTH1()->SetOption(option);
91  }
92  return me;
93 }
94 
96  const std::string &name,
97  const std::string &title,
98  int nchX,
99  float *xbinsize,
100  const std::string &titleX,
101  const std::string &titleY,
102  Option_t *option) {
103  std::cout << newName(name) << std::endl;
104  MonitorElement *me = iBooker.book1D(newName(name), title, nchX, xbinsize);
105  // book1DD not implemented in DQMServices/Core/src/DQMStore.cc
106  me->getTH1()->Sumw2();
107  if (!titleX.empty()) {
108  me->getTH1()->GetXaxis()->SetTitle(titleX.c_str());
109  }
110  if (!titleY.empty()) {
111  me->getTH1()->GetYaxis()->SetTitle(titleY.c_str());
112  }
113  if (TString(option) != "") {
114  me->getTH1()->SetOption(option);
115  }
116  return me;
117 }
118 
120  const std::string &name,
121  const std::string &title,
122  int nchX,
123  double lowX,
124  double highX,
125  int nchY,
126  double lowY,
127  double highY,
128  const std::string &titleX,
129  const std::string &titleY,
130  Option_t *option) {
131  MonitorElement *me = iBooker.book2DD(newName(name), title, nchX, lowX, highX, nchY, lowY, highY);
132  if (!titleX.empty()) {
133  me->getTH1()->GetXaxis()->SetTitle(titleX.c_str());
134  }
135  if (!titleY.empty()) {
136  me->getTH1()->GetYaxis()->SetTitle(titleY.c_str());
137  }
138  if (TString(option) != "") {
139  me->getTH1()->SetOption(option);
140  }
141  return me;
142 }
143 
145  const std::string &name,
146  const std::string &title,
147  int nchX,
148  double lowX,
149  double highX,
150  int nchY,
151  double lowY,
152  double highY,
153  const std::string &titleX,
154  const std::string &titleY,
155  Option_t *option) {
156  MonitorElement *me = iBooker.book2DD(newName(name), title, nchX, lowX, highX, nchY, lowY, highY);
157  me->getTH1()->Sumw2();
158  if (!titleX.empty()) {
159  me->getTH1()->GetXaxis()->SetTitle(titleX.c_str());
160  }
161  if (!titleY.empty()) {
162  me->getTH1()->GetYaxis()->SetTitle(titleY.c_str());
163  }
164  if (TString(option) != "") {
165  me->getTH1()->SetOption(option);
166  }
167  return me;
168 }
169 
171  const std::string &name,
172  const std::string &title,
173  int nchX,
174  double lowX,
175  double highX,
176  double lowY,
177  double highY,
178  const std::string &titleX,
179  const std::string &titleY,
180  Option_t *option) {
181  MonitorElement *me = iBooker.bookProfile(newName(name), title, nchX, lowX, highX, lowY, highY, " ");
182  if (!titleX.empty()) {
183  me->getTProfile()->GetXaxis()->SetTitle(titleX.c_str());
184  }
185  if (!titleY.empty()) {
186  me->getTProfile()->GetYaxis()->SetTitle(titleY.c_str());
187  }
188  if (TString(option) != "") {
189  me->getTProfile()->SetOption(option);
190  }
191  return me;
192 }
193 
195  const std::string &name,
198  const std::string &titleX,
199  const std::string &titleY,
200  const std::string &title) {
202  TH1D *h_temp = dynamic_cast<TH1D *>(num->getTH1()->Clone(name2.c_str()));
203  h_temp->Reset();
204  h_temp->Divide(num->getTH1(), denom->getTH1(), 1, 1, "b");
205  h_temp->GetXaxis()->SetTitle(titleX.c_str());
206  h_temp->GetYaxis()->SetTitle(titleY.c_str());
207  if (!title.empty()) {
208  h_temp->SetTitle(title.c_str());
209  }
210  if (m_verbosityLevel > 0) {
211  h_temp->Print();
212  }
213  MonitorElement *me = iBooker.book1DD(name2, h_temp);
214  delete h_temp;
215  return me;
216 }
217 
219  const std::string &name,
222  const std::string &titleX,
223  const std::string &titleY,
224  const std::string &title) {
226  TH2D *h_temp = dynamic_cast<TH2D *>(num->getTH1()->Clone(name2.c_str()));
227  h_temp->Reset();
228  h_temp->Divide(num->getTH1(), denom->getTH1(), 1, 1, "b");
229  h_temp->GetXaxis()->SetTitle(titleX.c_str());
230  h_temp->GetYaxis()->SetTitle(titleY.c_str());
231  if (!title.empty()) {
232  h_temp->SetTitle(title.c_str());
233  }
234  if (m_verbosityLevel > 0) {
235  h_temp->Print();
236  }
237  MonitorElement *me = iBooker.book2DD(name2, h_temp);
238  delete h_temp;
239  return me;
240 }
241 
243  MonitorElement *me2d,
244  const std::string &title,
245  const std::string &titleX,
246  const std::string &titleY,
247  Double_t minimum,
248  Double_t maximum) {
249  std::string name2 = me2d->getName() + "_pfx";
250  TProfile *p1_temp = me2d->getTH2D()->ProfileX();
251  if (!title.empty()) {
252  p1_temp->SetTitle(title.c_str());
253  }
254  if (!titleX.empty()) {
255  p1_temp->GetXaxis()->SetTitle(titleX.c_str());
256  }
257  if (!titleY.empty()) {
258  p1_temp->GetYaxis()->SetTitle(titleY.c_str());
259  }
260  if (minimum != -1111) {
261  p1_temp->SetMinimum(minimum);
262  }
263  if (maximum != -1111) {
264  p1_temp->SetMaximum(maximum);
265  }
266  MonitorElement *me = iBooker.bookProfile(name2, p1_temp);
267  delete p1_temp;
268  return me;
269 }
270 
272  MonitorElement *me2d,
273  const std::string &title,
274  const std::string &titleX,
275  const std::string &titleY,
276  Double_t minimum,
277  Double_t maximum) {
278  std::string name2 = me2d->getName() + "_pfy";
279  TProfile *p1_temp = me2d->getTH2D()->ProfileY();
280  if (!title.empty()) {
281  p1_temp->SetTitle(title.c_str());
282  }
283  if (!titleX.empty()) {
284  p1_temp->GetXaxis()->SetTitle(titleX.c_str());
285  }
286  if (!titleY.empty()) {
287  p1_temp->GetYaxis()->SetTitle(titleY.c_str());
288  }
289  if (minimum != -1111) {
290  p1_temp->SetMinimum(minimum);
291  }
292  if (maximum != -1111) {
293  p1_temp->SetMaximum(maximum);
294  }
295  MonitorElement *me = iBooker.bookProfile(name2, p1_temp);
296  delete p1_temp;
297  return me;
298 }
dqm::impl::MonitorElement
Definition: MonitorElement.h:98
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
ScoutingAnalyzerBase::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: ScoutingAnalyzerBase.cc:119
MessageLogger.h
ScoutingAnalyzerBase::m_verbosityLevel
unsigned m_verbosityLevel
Definition: ScoutingAnalyzerBase.h:143
makePileupJSON.denom
denom
Definition: makePileupJSON.py:147
ScoutingAnalyzerBase::m_MEsPath
std::string m_MEsPath
Definition: ScoutingAnalyzerBase.h:142
ScoutingAnalyzerBase::bookH2andDivide
MonitorElement * bookH2andDivide(DQMStore::IBooker &, const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
Definition: ScoutingAnalyzerBase.cc:218
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ScoutingAnalyzerBase.h
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMStore.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ScoutingAnalyzerBase::prepareBooking
void prepareBooking(DQMStore::IBooker &)
Definition: ScoutingAnalyzerBase.cc:25
fileinputsource_cfi.option
option
Definition: fileinputsource_cfi.py:87
ScoutingAnalyzerBase::bookH1withSumw2BinArray
MonitorElement * bookH1withSumw2BinArray(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, float *xbinsize, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
Definition: ScoutingAnalyzerBase.cc:95
ScoutingAnalyzerBase::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: ScoutingAnalyzerBase.cc:49
ScoutingAnalyzerBase::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: ScoutingAnalyzerBase.cc:27
Service.h
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
ScoutingAnalyzerBase::newName
std::string newName(const std::string &name)
Definition: ScoutingAnalyzerBase.cc:20
ScoutingAnalyzerBase::profileY
MonitorElement * profileY(DQMStore::IBooker &, MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
Definition: ScoutingAnalyzerBase.cc:271
ScoutingAnalyzerBase::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: ScoutingAnalyzerBase.cc:144
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
dqm::implementation::IBooker::book1DD
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:155
dqm::implementation::IBooker::book2DD
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:261
edm::ParameterSet
Definition: ParameterSet.h:47
ScoutingAnalyzerBase::bookH1BinArray
MonitorElement * bookH1BinArray(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, float *xbinsize, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
Definition: ScoutingAnalyzerBase.cc:73
ScoutingAnalyzerBase::ScoutingAnalyzerBase
ScoutingAnalyzerBase(const edm::ParameterSet &conf)
Definition: ScoutingAnalyzerBase.cc:9
dqm::impl::MonitorElement::getTH2D
virtual TH2D * getTH2D()
Definition: MonitorElement.cc:1004
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
ScoutingAnalyzerBase::bookH1andDivide
MonitorElement * bookH1andDivide(DQMStore::IBooker &, const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
Definition: ScoutingAnalyzerBase.cc:194
ScoutingAnalyzerBase::profileX
MonitorElement * profileX(DQMStore::IBooker &, MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
Definition: ScoutingAnalyzerBase.cc:242
dqm::impl::MonitorElement::getName
const std::string & getName() const
get name of ME
Definition: MonitorElement.h:250
ScoutingAnalyzerBase::~ScoutingAnalyzerBase
~ScoutingAnalyzerBase() override
Definition: ScoutingAnalyzerBase.cc:18
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqm::implementation::IBooker
Definition: DQMStore.h:43
ParameterSet.h
ScoutingAnalyzerBase::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: ScoutingAnalyzerBase.cc:170
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
hfnoseParametersInitialization_cfi.name2
name2
Definition: hfnoseParametersInitialization_cfi.py:8
ScoutingAnalyzerBase::m_modulePath
std::string m_modulePath
Definition: ScoutingAnalyzerBase.h:141
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