CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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) {
201  std::string name2 = newName(name);
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) {
225  std::string name2 = newName(name);
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 }
MonitorElement * bookH2andDivide(DQMStore::IBooker &, const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
T getUntrackedParameter(std::string const &, T const &) const
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
void prepareBooking(DQMStore::IBooker &)
const std::string & getName() const
get name of ME
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")
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")
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")
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:155
std::string newName(const std::string &name)
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
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")
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")
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)
virtual TProfile * getTProfile()
ScoutingAnalyzerBase(const edm::ParameterSet &conf)
MonitorElement * bookH1andDivide(DQMStore::IBooker &, const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
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
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")
tuple cout
Definition: gather_cfg.py:144
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
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)
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")