CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EDMtoMEConverter.cc
Go to the documentation of this file.
1 
8 #include <cassert>
9 
11 
12 using namespace lat;
13 
15  verbosity(0), frequency(0),
16  runInputTag_(iPSet.getParameter<edm::InputTag>("runInputTag")),
17  lumiInputTag_(iPSet.getParameter<edm::InputTag>("lumiInputTag"))
18 {
19  std::string MsgLoggerCat = "EDMtoMEConverter_EDMtoMEConverter";
20 
21  // get information from parameter set
22  name = iPSet.getUntrackedParameter<std::string>("Name");
23  verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
24  frequency = iPSet.getUntrackedParameter<int>("Frequency");
25 
26  convertOnEndLumi = iPSet.getUntrackedParameter<bool>("convertOnEndLumi",true);
27  convertOnEndRun = iPSet.getUntrackedParameter<bool>("convertOnEndRun",true);
28 
29  // use value of first digit to determine default output level (inclusive)
30  // 0 is none, 1 is basic, 2 is fill output, 3 is gather output
31  verbosity %= 10;
32 
33  // get dqm info
34  dbe = 0;
36 
37  // print out Parameter Set information being used
38  if (verbosity >= 0) {
39  edm::LogInfo(MsgLoggerCat)
40  << "\n===============================\n"
41  << "Initialized as EDAnalyzer with parameter values:\n"
42  << " Name = " << name << "\n"
43  << " Verbosity = " << verbosity << "\n"
44  << " Frequency = " << frequency << "\n"
45  << "===============================\n";
46  }
47 
48  classtypes.clear();
49  classtypes.push_back("TH1F");
50  classtypes.push_back("TH1S");
51  classtypes.push_back("TH1D");
52  classtypes.push_back("TH2F");
53  classtypes.push_back("TH2S");
54  classtypes.push_back("TH2D");
55  classtypes.push_back("TH3F");
56  classtypes.push_back("TProfile");
57  classtypes.push_back("TProfile2D");
58  classtypes.push_back("Double");
59  classtypes.push_back("Int");
60  classtypes.push_back("Int64");
61  classtypes.push_back("String");
62 
63  iCountf = 0;
64  iCount.clear();
65 
66  assert(sizeof(int64_t) == sizeof(long long));
67 
68 } // end constructor
69 
71 
73 {
74 }
75 
77 {
78  std::string MsgLoggerCat = "EDMtoMEConverter_endJob";
79  if (verbosity >= 0)
80  edm::LogInfo(MsgLoggerCat)
81  << "Terminating having processed " << iCount.size() << " runs across "
82  << iCountf << " files.";
83  return;
84 }
85 
87 {
88  ++iCountf;
89  return;
90 }
91 
92 void EDMtoMEConverter::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup)
93 {
94  std::string MsgLoggerCat = "EDMtoMEConverter_beginRun";
95 
96  int nrun = iRun.run();
97 
98  // keep track of number of unique runs processed
99  ++iCount[nrun];
100 
101  if (verbosity > 0) {
102  edm::LogInfo(MsgLoggerCat)
103  << "Processing run " << nrun << " (" << iCount.size() << " runs total)";
104  } else if (verbosity == 0) {
105  if (nrun%frequency == 0 || iCount.size() == 1) {
106  edm::LogInfo(MsgLoggerCat)
107  << "Processing run " << nrun << " (" << iCount.size() << " runs total)";
108  }
109  }
110 
111 }
112 
113 void EDMtoMEConverter::endRun(const edm::Run& iRun, const edm::EventSetup& iSetup)
114 {
115  if (convertOnEndRun) {
116  getData(iRun, true);
117  }
118 }
119 
121 {
122 }
123 
125 {
126  if (convertOnEndLumi) {
127  getData(iLumi, false);
128  }
129 }
130 
132 {
133 }
134 
135 template <class T>
136 void
137 EDMtoMEConverter::getData(T& iGetFrom, bool iEndRun)
138 {
139  edm::InputTag* inputTag = 0;
140  if (iEndRun) {
141  inputTag = &runInputTag_;
142  } else {
143  inputTag = &lumiInputTag_;
144  }
145 
146  std::string MsgLoggerCat = "EDMtoMEConverter_getData";
147 
148  if (verbosity >= 0)
149  edm::LogInfo (MsgLoggerCat) << "\nRestoring MonitorElements.";
150 
151  for (unsigned int ii = 0; ii < classtypes.size(); ++ii) {
152 
153  if (classtypes[ii] == "TH1F") {
154  edm::Handle<MEtoEDM<TH1F> > metoedm;
155  iGetFrom.getByLabel(*inputTag, metoedm);
156 
157  if (!metoedm.isValid()) {
158  //edm::LogWarning(MsgLoggerCat)
159  // << "MEtoEDM<TH1F> doesn't exist in run";
160  continue;
161  }
162 
163  std::vector<MEtoEDM<TH1F>::MEtoEDMObject> metoedmobject =
164  metoedm->getMEtoEdmObject();
165 
166  me1.resize(metoedmobject.size());
167 
168  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
169 
170  me1[i] = 0;
171 
172  // get full path of monitor element
173  std::string pathname = metoedmobject[i].name;
174  if (verbosity > 0) std::cout << pathname << std::endl;
175 
177 
178  // deconstruct path from fullpath
179  StringList fulldir = StringOps::split(pathname,"/");
180 
181  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
182  dir += fulldir[j];
183  if (j != fulldir.size() - 2) dir += "/";
184  }
185 
186  // define new monitor element
187  if (dbe) {
188  me1[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
189  if (me1[i] && me1[i]->getTH1F() && me1[i]->getTH1F()->TestBit(TH1::kCanRebin) == true) {
190  TList list;
191  list.Add(&metoedmobject[i].object);
192  if (me1[i]->getTH1F()->Merge(&list) == -1)
193  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
194  << metoedmobject[i].object.GetName() << "'" << std::endl;
195  } else {
196  dbe->setCurrentFolder(dir);
197  me1[i] = dbe->book1D(metoedmobject[i].object.GetName(),
198  &metoedmobject[i].object);
199  }
200  if (!iEndRun) me1[i]->setLumiFlag();
201  } // end define new monitor elements
202 
203  // attach taglist
204  TagList tags = metoedmobject[i].tags;
205 
206  for (unsigned int j = 0; j < tags.size(); ++j) {
207  dbe->tag(me1[i]->getFullname(),tags[j]);
208  }
209  } // end loop thorugh metoedmobject
210  } // end TH1F creation
211 
212  if (classtypes[ii] == "TH1S") {
213  edm::Handle<MEtoEDM<TH1S> > metoedm;
214  iGetFrom.getByLabel(*inputTag, metoedm);
215 
216  if (!metoedm.isValid()) {
217  //edm::LogWarning(MsgLoggerCat)
218  // << "MEtoEDM<TH1S> doesn't exist in run";
219  continue;
220  }
221 
222  std::vector<MEtoEDM<TH1S>::MEtoEDMObject> metoedmobject =
223  metoedm->getMEtoEdmObject();
224 
225  me1.resize(metoedmobject.size());
226 
227  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
228 
229  me1[i] = 0;
230 
231  // get full path of monitor element
232  std::string pathname = metoedmobject[i].name;
233  if (verbosity > 0) std::cout << pathname << std::endl;
234 
236 
237  // deconstruct path from fullpath
238  StringList fulldir = StringOps::split(pathname,"/");
239 
240  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
241  dir += fulldir[j];
242  if (j != fulldir.size() - 2) dir += "/";
243  }
244 
245  // define new monitor element
246  if (dbe) {
247  me1[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
248  if (me1[i] && me1[i]->getTH1S() && me1[i]->getTH1S()->TestBit(TH1::kCanRebin) == true) {
249  TList list;
250  list.Add(&metoedmobject[i].object);
251  if (me1[i]->getTH1S()->Merge(&list) == -1)
252  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
253  << metoedmobject[i].object.GetName() << "'" << std::endl;
254  } else {
255  dbe->setCurrentFolder(dir);
256  me1[i] = dbe->book1S(metoedmobject[i].object.GetName(),
257  &metoedmobject[i].object);
258  }
259  if (!iEndRun) me1[i]->setLumiFlag();
260  } // end define new monitor elements
261 
262  // attach taglist
263  TagList tags = metoedmobject[i].tags;
264 
265  for (unsigned int j = 0; j < tags.size(); ++j) {
266  dbe->tag(me1[i]->getFullname(),tags[j]);
267  }
268  } // end loop thorugh metoedmobject
269  } // end TH1S creation
270 
271  if (classtypes[ii] == "TH1D") {
272  edm::Handle<MEtoEDM<TH1D> > metoedm;
273  iGetFrom.getByLabel(*inputTag, metoedm);
274 
275  if (!metoedm.isValid()) {
276  //edm::LogWarning(MsgLoggerCat)
277  // << "MEtoEDM<TH1D> doesn't exist in run";
278  continue;
279  }
280 
281  std::vector<MEtoEDM<TH1D>::MEtoEDMObject> metoedmobject =
282  metoedm->getMEtoEdmObject();
283 
284  me1.resize(metoedmobject.size());
285 
286  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
287 
288  me1[i] = 0;
289 
290  // get full path of monitor element
291  std::string pathname = metoedmobject[i].name;
292  if (verbosity > 0) std::cout << pathname << std::endl;
293 
295 
296  // deconstruct path from fullpath
297  StringList fulldir = StringOps::split(pathname,"/");
298 
299  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
300  dir += fulldir[j];
301  if (j != fulldir.size() - 2) dir += "/";
302  }
303 
304  // define new monitor element
305  if (dbe) {
306  me1[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
307  if (me1[i] && me1[i]->getTH1D() && me1[i]->getTH1D()->TestBit(TH1::kCanRebin) == true) {
308  TList list;
309  list.Add(&metoedmobject[i].object);
310  if (me1[i]->getTH1D()->Merge(&list) == -1)
311  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
312  << metoedmobject[i].object.GetName() << "'" << std::endl;
313  } else {
314  dbe->setCurrentFolder(dir);
315  me1[i] = dbe->book1DD(metoedmobject[i].object.GetName(),
316  &metoedmobject[i].object);
317  }
318  if (!iEndRun) me1[i]->setLumiFlag();
319  } // end define new monitor elements
320 
321  // attach taglist
322  TagList tags = metoedmobject[i].tags;
323 
324  for (unsigned int j = 0; j < tags.size(); ++j) {
325  dbe->tag(me1[i]->getFullname(),tags[j]);
326  }
327  } // end loop thorugh metoedmobject
328  } // end TH1D creation
329 
330  if (classtypes[ii] == "TH2F") {
331  edm::Handle<MEtoEDM<TH2F> > metoedm;
332  iGetFrom.getByLabel(*inputTag, metoedm);
333 
334  if (!metoedm.isValid()) {
335  //edm::LogWarning(MsgLoggerCat)
336  // << "MEtoEDM<TH2F> doesn't exist in run";
337  continue;
338  }
339 
340  std::vector<MEtoEDM<TH2F>::MEtoEDMObject> metoedmobject =
341  metoedm->getMEtoEdmObject();
342 
343  me2.resize(metoedmobject.size());
344 
345  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
346 
347  me2[i] = 0;
348 
349  // get full path of monitor element
350  std::string pathname = metoedmobject[i].name;
351  if (verbosity > 0) std::cout << pathname << std::endl;
352 
354 
355  // deconstruct path from fullpath
356  StringList fulldir = StringOps::split(pathname,"/");
357 
358  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
359  dir += fulldir[j];
360  if (j != fulldir.size() - 2) dir += "/";
361  }
362 
363  // define new monitor element
364  if (dbe) {
365  me2[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
366  if (me2[i] && me2[i]->getTH2F() && me2[i]->getTH2F()->TestBit(TH1::kCanRebin) == true) {
367  TList list;
368  list.Add(&metoedmobject[i].object);
369  if (me2[i]->getTH2F()->Merge(&list) == -1)
370  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
371  << metoedmobject[i].object.GetName() << "'" << std::endl;
372  } else {
373  dbe->setCurrentFolder(dir);
374  me2[i] = dbe->book2D(metoedmobject[i].object.GetName(),
375  &metoedmobject[i].object);
376  }
377  if (!iEndRun) me2[i]->setLumiFlag();
378  } // end define new monitor elements
379 
380  // attach taglist
381  TagList tags = metoedmobject[i].tags;
382 
383  for (unsigned int j = 0; j < tags.size(); ++j) {
384  dbe->tag(me2[i]->getFullname(),tags[j]);
385  }
386  } // end loop thorugh metoedmobject
387  } // end TH2F creation
388 
389  if (classtypes[ii] == "TH2S") {
390  edm::Handle<MEtoEDM<TH2S> > metoedm;
391  iGetFrom.getByLabel(*inputTag, metoedm);
392 
393  if (!metoedm.isValid()) {
394  //edm::LogWarning(MsgLoggerCat)
395  // << "MEtoEDM<TH2S> doesn't exist in run";
396  continue;
397  }
398 
399  std::vector<MEtoEDM<TH2S>::MEtoEDMObject> metoedmobject =
400  metoedm->getMEtoEdmObject();
401 
402  me2.resize(metoedmobject.size());
403 
404  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
405 
406  me2[i] = 0;
407 
408  // get full path of monitor element
409  std::string pathname = metoedmobject[i].name;
410  if (verbosity > 0) std::cout << pathname << std::endl;
411 
413 
414  // deconstruct path from fullpath
415  StringList fulldir = StringOps::split(pathname,"/");
416 
417  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
418  dir += fulldir[j];
419  if (j != fulldir.size() - 2) dir += "/";
420  }
421 
422  // define new monitor element
423  if (dbe) {
424  me2[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
425  if (me2[i] && me2[i]->getTH2S() && me2[i]->getTH2S()->TestBit(TH1::kCanRebin) == true) {
426  TList list;
427  list.Add(&metoedmobject[i].object);
428  if (me2[i]->getTH2S()->Merge(&list) == -1)
429  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
430  << metoedmobject[i].object.GetName() << "'" << std::endl;
431  } else {
432  dbe->setCurrentFolder(dir);
433  me2[i] = dbe->book2S(metoedmobject[i].object.GetName(),
434  &metoedmobject[i].object);
435  }
436  if (!iEndRun) me2[i]->setLumiFlag();
437  } // end define new monitor elements
438 
439  // attach taglist
440  TagList tags = metoedmobject[i].tags;
441 
442  for (unsigned int j = 0; j < tags.size(); ++j) {
443  dbe->tag(me2[i]->getFullname(),tags[j]);
444  }
445  } // end loop thorugh metoedmobject
446  } // end TH2S creation
447 
448  if (classtypes[ii] == "TH2D") {
449  edm::Handle<MEtoEDM<TH2D> > metoedm;
450  iGetFrom.getByLabel(*inputTag, metoedm);
451 
452  if (!metoedm.isValid()) {
453  //edm::LogWarning(MsgLoggerCat)
454  // << "MEtoEDM<TH2D> doesn't exist in run";
455  continue;
456  }
457 
458  std::vector<MEtoEDM<TH2D>::MEtoEDMObject> metoedmobject =
459  metoedm->getMEtoEdmObject();
460 
461  me2.resize(metoedmobject.size());
462 
463  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
464 
465  me2[i] = 0;
466 
467  // get full path of monitor element
468  std::string pathname = metoedmobject[i].name;
469  if (verbosity > 0) std::cout << pathname << std::endl;
470 
472 
473  // deconstruct path from fullpath
474  StringList fulldir = StringOps::split(pathname,"/");
475 
476  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
477  dir += fulldir[j];
478  if (j != fulldir.size() - 2) dir += "/";
479  }
480 
481  // define new monitor element
482  if (dbe) {
483  me2[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
484  if (me2[i] && me2[i]->getTH2D() && me2[i]->getTH2D()->TestBit(TH1::kCanRebin) == true) {
485  TList list;
486  list.Add(&metoedmobject[i].object);
487  if (me2[i]->getTH2D()->Merge(&list) == -1)
488  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
489  << metoedmobject[i].object.GetName() << "'" << std::endl;
490  } else {
491  dbe->setCurrentFolder(dir);
492  me2[i] = dbe->book2DD(metoedmobject[i].object.GetName(),
493  &metoedmobject[i].object);
494  }
495  if (!iEndRun) me2[i]->setLumiFlag();
496  } // end define new monitor elements
497 
498  // attach taglist
499  TagList tags = metoedmobject[i].tags;
500 
501  for (unsigned int j = 0; j < tags.size(); ++j) {
502  dbe->tag(me2[i]->getFullname(),tags[j]);
503  }
504  } // end loop thorugh metoedmobject
505  } // end TH2D creation
506 
507  if (classtypes[ii] == "TH3F") {
508  edm::Handle<MEtoEDM<TH3F> > metoedm;
509  iGetFrom.getByLabel(*inputTag, metoedm);
510 
511  if (!metoedm.isValid()) {
512  //edm::LogWarning(MsgLoggerCat)
513  // << "MEtoEDM<TH3F> doesn't exist in run";
514  continue;
515  }
516 
517  std::vector<MEtoEDM<TH3F>::MEtoEDMObject> metoedmobject =
518  metoedm->getMEtoEdmObject();
519 
520  me3.resize(metoedmobject.size());
521 
522  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
523 
524  me3[i] = 0;
525 
526  // get full path of monitor element
527  std::string pathname = metoedmobject[i].name;
528  if (verbosity > 0) std::cout << pathname << std::endl;
529 
531 
532  // deconstruct path from fullpath
533  StringList fulldir = StringOps::split(pathname,"/");
534 
535  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
536  dir += fulldir[j];
537  if (j != fulldir.size() - 2) dir += "/";
538  }
539 
540  // define new monitor element
541  if (dbe) {
542  me3[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
543  if (me3[i] && me3[i]->getTH3F() && me3[i]->getTH3F()->TestBit(TH1::kCanRebin) == true) {
544  TList list;
545  list.Add(&metoedmobject[i].object);
546  if (me3[i]->getTH3F()->Merge(&list) == -1)
547  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
548  << metoedmobject[i].object.GetName() << "'" << std::endl;
549  } else {
550  dbe->setCurrentFolder(dir);
551  me3[i] = dbe->book3D(metoedmobject[i].object.GetName(),
552  &metoedmobject[i].object);
553  }
554  if (!iEndRun) me3[i]->setLumiFlag();
555  } // end define new monitor elements
556 
557  // attach taglist
558  TagList tags = metoedmobject[i].tags;
559 
560  for (unsigned int j = 0; j < tags.size(); ++j) {
561  dbe->tag(me3[i]->getFullname(),tags[j]);
562  }
563  } // end loop thorugh metoedmobject
564  } // end TH3F creation
565 
566  if (classtypes[ii] == "TProfile") {
568  iGetFrom.getByLabel(*inputTag, metoedm);
569 
570  if (!metoedm.isValid()) {
571  //edm::LogWarning(MsgLoggerCat)
572  // << "MEtoEDM<TProfile> doesn't exist in run";
573  continue;
574  }
575 
576  std::vector<MEtoEDM<TProfile>::MEtoEDMObject> metoedmobject =
577  metoedm->getMEtoEdmObject();
578 
579  me4.resize(metoedmobject.size());
580 
581  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
582 
583  me4[i] = 0;
584 
585  // get full path of monitor element
586  std::string pathname = metoedmobject[i].name;
587  if (verbosity > 0) std::cout << pathname << std::endl;
588 
590 
591  // deconstruct path from fullpath
592  StringList fulldir = StringOps::split(pathname,"/");
593 
594  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
595  dir += fulldir[j];
596  if (j != fulldir.size() - 2) dir += "/";
597  }
598 
599  std::string name = metoedmobject[i].object.GetName();
600  // define new monitor element
601  if (dbe) {
602  me4[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
603  if (me4[i] && me4[i]->getTProfile() && me4[i]->getTProfile()->TestBit(TH1::kCanRebin) == true) {
604  TList list;
605  list.Add(&metoedmobject[i].object);
606  if (me4[i]->getTProfile()->Merge(&list) == -1)
607  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
608  << metoedmobject[i].object.GetName() << "'" << std::endl;
609  } else {
610  dbe->setCurrentFolder(dir);
611  me4[i] = dbe->bookProfile(metoedmobject[i].object.GetName(),
612  &metoedmobject[i].object);
613  }
614  if (!iEndRun) me4[i]->setLumiFlag();
615  } // end define new monitor elements
616 
617  // attach taglist
618  TagList tags = metoedmobject[i].tags;
619 
620  for (unsigned int j = 0; j < tags.size(); ++j) {
621  dbe->tag(me4[i]->getFullname(),tags[j]);
622  }
623  } // end loop thorugh metoedmobject
624  } // end TProfile creation
625 
626  if (classtypes[ii] == "TProfile2D") {
628  iGetFrom.getByLabel(*inputTag, metoedm);
629 
630  if (!metoedm.isValid()) {
631  //edm::LogWarning(MsgLoggerCat)
632  // << "MEtoEDM<TProfile2D> doesn't exist in run";
633  continue;
634  }
635 
636  std::vector<MEtoEDM<TProfile2D>::MEtoEDMObject> metoedmobject =
637  metoedm->getMEtoEdmObject();
638 
639  me5.resize(metoedmobject.size());
640 
641  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
642 
643  me5[i] = 0;
644 
645  // get full path of monitor element
646  std::string pathname = metoedmobject[i].name;
647  if (verbosity > 0) std::cout << pathname << std::endl;
648 
650 
651  // deconstruct path from fullpath
652  StringList fulldir = StringOps::split(pathname,"/");
653 
654  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
655  dir += fulldir[j];
656  if (j != fulldir.size() - 2) dir += "/";
657  }
658 
659  // define new monitor element
660  if (dbe) {
661  me5[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
662  if (me5[i] && me5[i]->getTProfile2D() && me5[i]->getTProfile2D()->TestBit(TH1::kCanRebin) == true) {
663  TList list;
664  list.Add(&metoedmobject[i].object);
665  if (me5[i]->getTProfile2D()->Merge(&list) == -1)
666  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
667  << metoedmobject[i].object.GetName() << "'" << std::endl;
668  } else {
669  dbe->setCurrentFolder(dir);
670  me5[i] = dbe->bookProfile2D(metoedmobject[i].object.GetName(),
671  &metoedmobject[i].object);
672  }
673  if (!iEndRun) me5[i]->setLumiFlag();
674  } // end define new monitor elements
675 
676  // attach taglist
677  TagList tags = metoedmobject[i].tags;
678 
679  for (unsigned int j = 0; j < tags.size(); ++j) {
680  dbe->tag(me5[i]->getFullname(),tags[j]);
681  }
682  } // end loop thorugh metoedmobject
683  } // end TProfile2D creation
684 
685  if (classtypes[ii] == "Double") {
686  edm::Handle<MEtoEDM<double> > metoedm;
687  iGetFrom.getByLabel(*inputTag, metoedm);
688 
689  if (!metoedm.isValid()) {
690  //edm::LogWarning(MsgLoggerCat)
691  // << "MEtoEDM<double> doesn't exist in run";
692  continue;
693  }
694 
695  std::vector<MEtoEDM<double>::MEtoEDMObject> metoedmobject =
696  metoedm->getMEtoEdmObject();
697 
698  me6.resize(metoedmobject.size());
699 
700  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
701 
702  me6[i] = 0;
703 
704  // get full path of monitor element
705  std::string pathname = metoedmobject[i].name;
706  if (verbosity > 0) std::cout << pathname << std::endl;
707 
710 
711  // deconstruct path from fullpath
712 
713  StringList fulldir = StringOps::split(pathname,"/");
714  name = *(fulldir.end() - 1);
715 
716  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
717  dir += fulldir[j];
718  if (j != fulldir.size() - 2) dir += "/";
719  }
720 
721  // define new monitor element
722  if (dbe) {
723  dbe->setCurrentFolder(dir);
724  me6[i] = dbe->bookFloat(name);
725  me6[i]->Fill(metoedmobject[i].object);
726  if (!iEndRun) me6[i]->setLumiFlag();
727  } // end define new monitor elements
728 
729  // attach taglist
730  TagList tags = metoedmobject[i].tags;
731 
732  for (unsigned int j = 0; j < tags.size(); ++j) {
733  dbe->tag(me6[i]->getFullname(),tags[j]);
734  }
735  } // end loop thorugh metoedmobject
736  } // end Float creation
737 
738  if (classtypes[ii] == "Int64") {
740  iGetFrom.getByLabel(*inputTag, metoedm);
741 
742  if (!metoedm.isValid()) {
743  //edm::LogWarning(MsgLoggerCat)
744  // << "MEtoEDM<long long> doesn't exist in run";
745  continue;
746  }
747 
748  std::vector<MEtoEDM<long long>::MEtoEDMObject> metoedmobject =
749  metoedm->getMEtoEdmObject();
750 
751  me7.resize(metoedmobject.size());
752 
753  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
754 
755  me7[i] = 0;
756 
757  // get full path of monitor element
758  std::string pathname = metoedmobject[i].name;
759  if (verbosity > 0) std::cout << pathname << std::endl;
760 
763 
764  // deconstruct path from fullpath
765  StringList fulldir = StringOps::split(pathname,"/");
766  name = *(fulldir.end() - 1);
767 
768  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
769  dir += fulldir[j];
770  if (j != fulldir.size() - 2) dir += "/";
771  }
772 
773  // define new monitor element
774  if (dbe) {
775  dbe->setCurrentFolder(dir);
776  long long ival = 0;
777  if ( iEndRun ) {
778  if (name.find("processedEvents") != std::string::npos) {
779  if (MonitorElement* me = dbe->get(dir+"/"+name)) {
780  ival = me->getIntValue();
781  }
782  }
783  }
784  me7[i] = dbe->bookInt(name);
785  me7[i]->Fill(metoedmobject[i].object+ival);
786  if (!iEndRun) me7[i]->setLumiFlag();
787  } // end define new monitor elements
788 
789  // attach taglist
790  TagList tags = metoedmobject[i].tags;
791 
792  for (unsigned int j = 0; j < tags.size(); ++j) {
793  dbe->tag(me7[i]->getFullname(),tags[j]);
794  }
795  } // end loop thorugh metoedmobject
796  } // end Int creation
797 
798  if (classtypes[ii] == "Int") {
799  edm::Handle<MEtoEDM<int> > metoedm;
800  iGetFrom.getByLabel(*inputTag, metoedm);
801 
802  if (!metoedm.isValid()) {
803  //edm::LogWarning(MsgLoggerCat)
804  // << "MEtoEDM<int> doesn't exist in run";
805  continue;
806  }
807 
808  std::vector<MEtoEDM<int>::MEtoEDMObject> metoedmobject =
809  metoedm->getMEtoEdmObject();
810 
811  me7.resize(metoedmobject.size());
812 
813  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
814 
815  me7[i] = 0;
816 
817  // get full path of monitor element
818  std::string pathname = metoedmobject[i].name;
819  if (verbosity > 0) std::cout << pathname << std::endl;
820 
823 
824  // deconstruct path from fullpath
825  StringList fulldir = StringOps::split(pathname,"/");
826  name = *(fulldir.end() - 1);
827 
828  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
829  dir += fulldir[j];
830  if (j != fulldir.size() - 2) dir += "/";
831  }
832 
833  // define new monitor element
834  if (dbe) {
835  dbe->setCurrentFolder(dir);
836  int ival = 0;
837  if ( iEndRun ) {
838  if (name.find("processedEvents") != std::string::npos) {
839  if (MonitorElement* me = dbe->get(dir+"/"+name)) {
840  ival = me->getIntValue();
841  }
842  }
843  }
844  me7[i] = dbe->bookInt(name);
845  me7[i]->Fill(metoedmobject[i].object+ival);
846  if (!iEndRun) me7[i]->setLumiFlag();
847  } // end define new monitor elements
848 
849  // attach taglist
850  TagList tags = metoedmobject[i].tags;
851 
852  for (unsigned int j = 0; j < tags.size(); ++j) {
853  dbe->tag(me7[i]->getFullname(),tags[j]);
854  }
855  } // end loop thorugh metoedmobject
856  } // end Int creation
857 
858  if (classtypes[ii] == "String") {
860  iGetFrom.getByLabel(*inputTag, metoedm);
861 
862  if (!metoedm.isValid()) {
863  //edm::LogWarning(MsgLoggerCat)
864  // << "MEtoEDM<TString> doesn't exist in run";
865  continue;
866  }
867 
868  std::vector<MEtoEDM<TString>::MEtoEDMObject> metoedmobject =
869  metoedm->getMEtoEdmObject();
870 
871  me8.resize(metoedmobject.size());
872 
873  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
874 
875  me8[i] = 0;
876 
877  // get full path of monitor element
878  std::string pathname = metoedmobject[i].name;
879  if (verbosity > 0) std::cout << pathname << std::endl;
880 
883 
884  // deconstruct path from fullpath
885  StringList fulldir = StringOps::split(pathname,"/");
886  name = *(fulldir.end() - 1);
887 
888  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
889  dir += fulldir[j];
890  if (j != fulldir.size() - 2) dir += "/";
891  }
892 
893  // define new monitor element
894  if (dbe) {
895  dbe->setCurrentFolder(dir);
896  std::string scont = metoedmobject[i].object.Data();
897  me8[i] = dbe->bookString(name,scont);
898  if (!iEndRun) me8[i]->setLumiFlag();
899  } // end define new monitor elements
900 
901  // attach taglist
902  TagList tags = metoedmobject[i].tags;
903 
904  for (unsigned int j = 0; j < tags.size(); ++j) {
905  dbe->tag(me8[i]->getFullname(),tags[j]);
906  }
907  } // end loop thorugh metoedmobject
908  } // end String creation
909  }
910 
911  // verify tags stored properly
912  if (verbosity > 0) {
913  std::vector<std::string> stags;
914  dbe->getAllTags(stags);
915  for (unsigned int i = 0; i < stags.size(); ++i) {
916  std::cout << "Tags: " << stags[i] << std::endl;
917  }
918  }
919 
920 }
921 
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::vector< uint32_t > TagList
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * book2S(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2S histogram.
Definition: DQMStore.cc:1022
TProfile * getTProfile(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
RunNumber_t run() const
Definition: RunBase.h:42
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
MonitorElement * book3D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ)
Book 3D histogram.
Definition: DQMStore.cc:1134
MonitorElement * book2DD(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D double histogram.
Definition: DQMStore.cc:1044
EDMtoMEConverter(const edm::ParameterSet &)
std::vector< MonitorElement * > me6
virtual void endRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * book1DD(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
Definition: DQMStore.cc:904
int ii
Definition: cuy.py:588
std::vector< std::string > classtypes
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:809
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1509
edm::InputTag lumiInputTag_
int iEvent
Definition: GenABIO.cc:243
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
std::vector< MonitorElement * > me8
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:838
TH3F * getTH3F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
virtual void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
virtual void endJob()
std::vector< MonitorElement * > me7
virtual void beginJob()
std::vector< MonitorElement * > me1
edm::InputTag runInputTag_
std::vector< MonitorElement * > me4
std::vector< MonitorElement * > me5
int j
Definition: DBlmapReader.cc:9
TH1F * getTH1F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
TProfile2D * getTProfile2D(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1186
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1623
bool isValid() const
Definition: HandleBase.h:76
tuple tags
Definition: o2o.py:248
void getAllTags(std::vector< std::string > &into) const
Definition: DQMStore.cc:1783
virtual void respondToOpenInputFile(const edm::FileBlock &)
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
std::vector< MonitorElement * > me2
virtual ~EDMtoMEConverter()
TH2F * getTH2F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
tuple cout
Definition: gather_cfg.py:121
dbl *** dir
Definition: mlp_gen.cc:35
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:779
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
std::vector< MonitorElement * > me3
long double T
unsigned int iCountf
double split
Definition: MVATrainer.cc:139
MonitorElement * book1S(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
Definition: DQMStore.cc:888
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
Definition: Run.h:41
std::map< int, int > iCount
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 list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
void getData(T &iGetFrom, bool iEndRun)
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")
Definition: DQMStore.cc:1330