CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
EDMtoMEConverter Class Reference

#include <EDMtoMEConverter.h>

Inheritance diagram for EDMtoMEConverter:
edm::EDAnalyzer edm::EDConsumerBase

Public Types

typedef std::vector< uint32_t > TagList
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
 EDMtoMEConverter (const edm::ParameterSet &)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
template<class T >
void getData (T &iGetFrom, bool iEndRun)
 
virtual void respondToOpenInputFile (const edm::FileBlock &)
 
virtual ~EDMtoMEConverter ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::vector< std::string > classtypes
 
bool convertOnEndLumi
 
bool convertOnEndRun
 
DQMStoredbe
 
int frequency
 
std::map< int, int > iCount
 
unsigned int iCountf
 
edm::InputTag lumiInputTag_
 
std::vector< MonitorElement * > me1
 
std::vector< MonitorElement * > me2
 
std::vector< MonitorElement * > me3
 
std::vector< MonitorElement * > me4
 
std::vector< MonitorElement * > me5
 
std::vector< MonitorElement * > me6
 
std::vector< MonitorElement * > me7
 
std::vector< MonitorElement * > me8
 
std::string name
 
edm::InputTag runInputTag_
 
int verbosity
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Class to take dqm monitor elements and convert into a ROOT dataformat stored in Run tree of edm file

Date:
2012/10/10 16:01:57
Revision:
1.19
Author
M. Strang SUNY-Buffalo

Definition at line 51 of file EDMtoMEConverter.h.

Member Typedef Documentation

typedef std::vector<uint32_t> EDMtoMEConverter::TagList

Definition at line 70 of file EDMtoMEConverter.h.

Constructor & Destructor Documentation

EDMtoMEConverter::EDMtoMEConverter ( const edm::ParameterSet iPSet)
explicit

Definition at line 16 of file EDMtoMEConverter.cc.

References classtypes, convertOnEndLumi, convertOnEndRun, dbe, frequency, edm::ParameterSet::getUntrackedParameter(), iCount, iCountf, name, cppFunctionSkipper::operator, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

16  :
17  verbosity(0), frequency(0),
18  runInputTag_(iPSet.getParameter<edm::InputTag>("runInputTag")),
19  lumiInputTag_(iPSet.getParameter<edm::InputTag>("lumiInputTag"))
20 {
21  std::string MsgLoggerCat = "EDMtoMEConverter_EDMtoMEConverter";
22 
23  // get information from parameter set
24  name = iPSet.getUntrackedParameter<std::string>("Name");
25  verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
26  frequency = iPSet.getUntrackedParameter<int>("Frequency");
27 
28  convertOnEndLumi = iPSet.getUntrackedParameter<bool>("convertOnEndLumi",true);
29  convertOnEndRun = iPSet.getUntrackedParameter<bool>("convertOnEndRun",true);
30 
31  // use value of first digit to determine default output level (inclusive)
32  // 0 is none, 1 is basic, 2 is fill output, 3 is gather output
33  verbosity %= 10;
34 
35  // get dqm info
36  dbe = 0;
38 
39  // print out Parameter Set information being used
40  if (verbosity >= 0) {
41  edm::LogInfo(MsgLoggerCat)
42  << "\n===============================\n"
43  << "Initialized as EDAnalyzer with parameter values:\n"
44  << " Name = " << name << "\n"
45  << " Verbosity = " << verbosity << "\n"
46  << " Frequency = " << frequency << "\n"
47  << "===============================\n";
48  }
49 
50  classtypes.clear();
51  classtypes.push_back("TH1F");
52  classtypes.push_back("TH1S");
53  classtypes.push_back("TH1D");
54  classtypes.push_back("TH2F");
55  classtypes.push_back("TH2S");
56  classtypes.push_back("TH2D");
57  classtypes.push_back("TH3F");
58  classtypes.push_back("TProfile");
59  classtypes.push_back("TProfile2D");
60  classtypes.push_back("Double");
61  classtypes.push_back("Int");
62  classtypes.push_back("Int64");
63  classtypes.push_back("String");
64 
65  iCountf = 0;
66  iCount.clear();
67 
68  assert(sizeof(int64_t) == sizeof(long long));
69 
70 } // end constructor
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > classtypes
edm::InputTag lumiInputTag_
edm::InputTag runInputTag_
unsigned int iCountf
std::map< int, int > iCount
EDMtoMEConverter::~EDMtoMEConverter ( )
virtual

Definition at line 72 of file EDMtoMEConverter.cc.

72 {}

Member Function Documentation

void EDMtoMEConverter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 133 of file EDMtoMEConverter.cc.

134 {
135 }
void EDMtoMEConverter::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 74 of file EDMtoMEConverter.cc.

75 {
76 }
void EDMtoMEConverter::beginLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 122 of file EDMtoMEConverter.cc.

123 {
124 }
void EDMtoMEConverter::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 94 of file EDMtoMEConverter.cc.

References frequency, iCount, edm::RunBase::run(), AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

95 {
96  std::string MsgLoggerCat = "EDMtoMEConverter_beginRun";
97 
98  int nrun = iRun.run();
99 
100  // keep track of number of unique runs processed
101  ++iCount[nrun];
102 
103  if (verbosity > 0) {
104  edm::LogInfo(MsgLoggerCat)
105  << "Processing run " << nrun << " (" << iCount.size() << " runs total)";
106  } else if (verbosity == 0) {
107  if (nrun%frequency == 0 || iCount.size() == 1) {
108  edm::LogInfo(MsgLoggerCat)
109  << "Processing run " << nrun << " (" << iCount.size() << " runs total)";
110  }
111  }
112 
113 }
RunNumber_t run() const
Definition: RunBase.h:42
std::map< int, int > iCount
void EDMtoMEConverter::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 78 of file EDMtoMEConverter.cc.

References iCount, iCountf, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

79 {
80  std::string MsgLoggerCat = "EDMtoMEConverter_endJob";
81  if (verbosity >= 0)
82  edm::LogInfo(MsgLoggerCat)
83  << "Terminating having processed " << iCount.size() << " runs across "
84  << iCountf << " files.";
85  return;
86 }
unsigned int iCountf
std::map< int, int > iCount
void EDMtoMEConverter::endLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 126 of file EDMtoMEConverter.cc.

References convertOnEndLumi, and getData().

127 {
128  if (convertOnEndLumi) {
129  getData(iLumi, false);
130  }
131 }
void getData(T &iGetFrom, bool iEndRun)
void EDMtoMEConverter::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 115 of file EDMtoMEConverter.cc.

References convertOnEndRun, and getData().

116 {
117  if (convertOnEndRun) {
118  getData(iRun, true);
119  }
120 }
void getData(T &iGetFrom, bool iEndRun)
template<class T >
void EDMtoMEConverter::getData ( T iGetFrom,
bool  iEndRun 
)

Definition at line 139 of file EDMtoMEConverter.cc.

References DQMStore::book1D(), DQMStore::book1DD(), DQMStore::book1S(), DQMStore::book2D(), DQMStore::book2DD(), DQMStore::book2S(), DQMStore::book3D(), DQMStore::bookFloat(), DQMStore::bookInt(), DQMStore::bookProfile(), DQMStore::bookProfile2D(), DQMStore::bookString(), classtypes, gather_cfg::cout, dbe, dir, DQMStore::get(), DQMStore::getAllTags(), getTH1F(), getTH2F(), getTH3F(), getTProfile(), getTProfile2D(), i, cuy::ii, edm::HandleBase::isValid(), j, list(), lumiInputTag_, me1, me2, me3, me4, me5, me6, me7, me8, name, timingPdfMaker::pathname, runInputTag_, DQMStore::setCurrentFolder(), split, AlCaHLTBitMon_QueryRunRegistry::string, DQMStore::tag(), o2o::tags, and verbosity.

Referenced by endLuminosityBlock(), and endRun().

140 {
141  edm::InputTag* inputTag = 0;
142  if (iEndRun) {
143  inputTag = &runInputTag_;
144  } else {
145  inputTag = &lumiInputTag_;
146  }
147 
148  std::string MsgLoggerCat = "EDMtoMEConverter_getData";
149 
150  if (verbosity >= 0)
151  edm::LogInfo (MsgLoggerCat) << "\nRestoring MonitorElements.";
152 
153  for (unsigned int ii = 0; ii < classtypes.size(); ++ii) {
154 
155  if (classtypes[ii] == "TH1F") {
156  edm::Handle<MEtoEDM<TH1F> > metoedm;
157  iGetFrom.getByLabel(*inputTag, metoedm);
158 
159  if (!metoedm.isValid()) {
160  //edm::LogWarning(MsgLoggerCat)
161  // << "MEtoEDM<TH1F> doesn't exist in run";
162  continue;
163  }
164 
165  std::vector<MEtoEDM<TH1F>::MEtoEDMObject> metoedmobject =
166  metoedm->getMEtoEdmObject();
167 
168  me1.resize(metoedmobject.size());
169 
170  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
171 
172  me1[i] = 0;
173 
174  // get full path of monitor element
175  std::string pathname = metoedmobject[i].name;
176  if (verbosity > 0) std::cout << pathname << std::endl;
177 
179 
180  // deconstruct path from fullpath
181  StringList fulldir = StringOps::split(pathname,"/");
182 
183  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
184  dir += fulldir[j];
185  if (j != fulldir.size() - 2) dir += "/";
186  }
187 
188  // define new monitor element
189  if (dbe) {
190  me1[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
191  if (me1[i] && me1[i]->getTH1F() && me1[i]->getTH1F()->TestBit(TH1::kCanRebin) == true) {
192  TList list;
193  list.Add(&metoedmobject[i].object);
194  if (me1[i]->getTH1F()->Merge(&list) == -1)
195  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
196  << metoedmobject[i].object.GetName() << "'" << std::endl;
197  } else {
198  dbe->setCurrentFolder(dir);
199  me1[i] = dbe->book1D(metoedmobject[i].object.GetName(),
200  &metoedmobject[i].object);
201  }
202  if (!iEndRun) me1[i]->setLumiFlag();
203  } // end define new monitor elements
204 
205  // attach taglist
206  TagList tags = metoedmobject[i].tags;
207 
208  for (unsigned int j = 0; j < tags.size(); ++j) {
209  dbe->tag(me1[i]->getFullname(),tags[j]);
210  }
211  } // end loop thorugh metoedmobject
212  } // end TH1F creation
213 
214  if (classtypes[ii] == "TH1S") {
215  edm::Handle<MEtoEDM<TH1S> > metoedm;
216  iGetFrom.getByLabel(*inputTag, metoedm);
217 
218  if (!metoedm.isValid()) {
219  //edm::LogWarning(MsgLoggerCat)
220  // << "MEtoEDM<TH1S> doesn't exist in run";
221  continue;
222  }
223 
224  std::vector<MEtoEDM<TH1S>::MEtoEDMObject> metoedmobject =
225  metoedm->getMEtoEdmObject();
226 
227  me1.resize(metoedmobject.size());
228 
229  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
230 
231  me1[i] = 0;
232 
233  // get full path of monitor element
234  std::string pathname = metoedmobject[i].name;
235  if (verbosity > 0) std::cout << pathname << std::endl;
236 
238 
239  // deconstruct path from fullpath
240  StringList fulldir = StringOps::split(pathname,"/");
241 
242  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
243  dir += fulldir[j];
244  if (j != fulldir.size() - 2) dir += "/";
245  }
246 
247  // define new monitor element
248  if (dbe) {
249  me1[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
250  if (me1[i] && me1[i]->getTH1S() && me1[i]->getTH1S()->TestBit(TH1::kCanRebin) == true) {
251  TList list;
252  list.Add(&metoedmobject[i].object);
253  if (me1[i]->getTH1S()->Merge(&list) == -1)
254  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
255  << metoedmobject[i].object.GetName() << "'" << std::endl;
256  } else {
257  dbe->setCurrentFolder(dir);
258  me1[i] = dbe->book1S(metoedmobject[i].object.GetName(),
259  &metoedmobject[i].object);
260  }
261  if (!iEndRun) me1[i]->setLumiFlag();
262  } // end define new monitor elements
263 
264  // attach taglist
265  TagList tags = metoedmobject[i].tags;
266 
267  for (unsigned int j = 0; j < tags.size(); ++j) {
268  dbe->tag(me1[i]->getFullname(),tags[j]);
269  }
270  } // end loop thorugh metoedmobject
271  } // end TH1S creation
272 
273  if (classtypes[ii] == "TH1D") {
274  edm::Handle<MEtoEDM<TH1D> > metoedm;
275  iGetFrom.getByLabel(*inputTag, metoedm);
276 
277  if (!metoedm.isValid()) {
278  //edm::LogWarning(MsgLoggerCat)
279  // << "MEtoEDM<TH1D> doesn't exist in run";
280  continue;
281  }
282 
283  std::vector<MEtoEDM<TH1D>::MEtoEDMObject> metoedmobject =
284  metoedm->getMEtoEdmObject();
285 
286  me1.resize(metoedmobject.size());
287 
288  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
289 
290  me1[i] = 0;
291 
292  // get full path of monitor element
293  std::string pathname = metoedmobject[i].name;
294  if (verbosity > 0) std::cout << pathname << std::endl;
295 
297 
298  // deconstruct path from fullpath
299  StringList fulldir = StringOps::split(pathname,"/");
300 
301  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
302  dir += fulldir[j];
303  if (j != fulldir.size() - 2) dir += "/";
304  }
305 
306  // define new monitor element
307  if (dbe) {
308  me1[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
309  if (me1[i] && me1[i]->getTH1D() && me1[i]->getTH1D()->TestBit(TH1::kCanRebin) == true) {
310  TList list;
311  list.Add(&metoedmobject[i].object);
312  if (me1[i]->getTH1D()->Merge(&list) == -1)
313  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
314  << metoedmobject[i].object.GetName() << "'" << std::endl;
315  } else {
316  dbe->setCurrentFolder(dir);
317  me1[i] = dbe->book1DD(metoedmobject[i].object.GetName(),
318  &metoedmobject[i].object);
319  }
320  if (!iEndRun) me1[i]->setLumiFlag();
321  } // end define new monitor elements
322 
323  // attach taglist
324  TagList tags = metoedmobject[i].tags;
325 
326  for (unsigned int j = 0; j < tags.size(); ++j) {
327  dbe->tag(me1[i]->getFullname(),tags[j]);
328  }
329  } // end loop thorugh metoedmobject
330  } // end TH1D creation
331 
332  if (classtypes[ii] == "TH2F") {
333  edm::Handle<MEtoEDM<TH2F> > metoedm;
334  iGetFrom.getByLabel(*inputTag, metoedm);
335 
336  if (!metoedm.isValid()) {
337  //edm::LogWarning(MsgLoggerCat)
338  // << "MEtoEDM<TH2F> doesn't exist in run";
339  continue;
340  }
341 
342  std::vector<MEtoEDM<TH2F>::MEtoEDMObject> metoedmobject =
343  metoedm->getMEtoEdmObject();
344 
345  me2.resize(metoedmobject.size());
346 
347  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
348 
349  me2[i] = 0;
350 
351  // get full path of monitor element
352  std::string pathname = metoedmobject[i].name;
353  if (verbosity > 0) std::cout << pathname << std::endl;
354 
356 
357  // deconstruct path from fullpath
358  StringList fulldir = StringOps::split(pathname,"/");
359 
360  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
361  dir += fulldir[j];
362  if (j != fulldir.size() - 2) dir += "/";
363  }
364 
365  // define new monitor element
366  if (dbe) {
367  me2[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
368  if (me2[i] && me2[i]->getTH2F() && me2[i]->getTH2F()->TestBit(TH1::kCanRebin) == true) {
369  TList list;
370  list.Add(&metoedmobject[i].object);
371  if (me2[i]->getTH2F()->Merge(&list) == -1)
372  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
373  << metoedmobject[i].object.GetName() << "'" << std::endl;
374  } else {
375  dbe->setCurrentFolder(dir);
376  me2[i] = dbe->book2D(metoedmobject[i].object.GetName(),
377  &metoedmobject[i].object);
378  }
379  if (!iEndRun) me2[i]->setLumiFlag();
380  } // end define new monitor elements
381 
382  // attach taglist
383  TagList tags = metoedmobject[i].tags;
384 
385  for (unsigned int j = 0; j < tags.size(); ++j) {
386  dbe->tag(me2[i]->getFullname(),tags[j]);
387  }
388  } // end loop thorugh metoedmobject
389  } // end TH2F creation
390 
391  if (classtypes[ii] == "TH2S") {
392  edm::Handle<MEtoEDM<TH2S> > metoedm;
393  iGetFrom.getByLabel(*inputTag, metoedm);
394 
395  if (!metoedm.isValid()) {
396  //edm::LogWarning(MsgLoggerCat)
397  // << "MEtoEDM<TH2S> doesn't exist in run";
398  continue;
399  }
400 
401  std::vector<MEtoEDM<TH2S>::MEtoEDMObject> metoedmobject =
402  metoedm->getMEtoEdmObject();
403 
404  me2.resize(metoedmobject.size());
405 
406  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
407 
408  me2[i] = 0;
409 
410  // get full path of monitor element
411  std::string pathname = metoedmobject[i].name;
412  if (verbosity > 0) std::cout << pathname << std::endl;
413 
415 
416  // deconstruct path from fullpath
417  StringList fulldir = StringOps::split(pathname,"/");
418 
419  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
420  dir += fulldir[j];
421  if (j != fulldir.size() - 2) dir += "/";
422  }
423 
424  // define new monitor element
425  if (dbe) {
426  me2[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
427  if (me2[i] && me2[i]->getTH2S() && me2[i]->getTH2S()->TestBit(TH1::kCanRebin) == true) {
428  TList list;
429  list.Add(&metoedmobject[i].object);
430  if (me2[i]->getTH2S()->Merge(&list) == -1)
431  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
432  << metoedmobject[i].object.GetName() << "'" << std::endl;
433  } else {
434  dbe->setCurrentFolder(dir);
435  me2[i] = dbe->book2S(metoedmobject[i].object.GetName(),
436  &metoedmobject[i].object);
437  }
438  if (!iEndRun) me2[i]->setLumiFlag();
439  } // end define new monitor elements
440 
441  // attach taglist
442  TagList tags = metoedmobject[i].tags;
443 
444  for (unsigned int j = 0; j < tags.size(); ++j) {
445  dbe->tag(me2[i]->getFullname(),tags[j]);
446  }
447  } // end loop thorugh metoedmobject
448  } // end TH2S creation
449 
450  if (classtypes[ii] == "TH2D") {
451  edm::Handle<MEtoEDM<TH2D> > metoedm;
452  iGetFrom.getByLabel(*inputTag, metoedm);
453 
454  if (!metoedm.isValid()) {
455  //edm::LogWarning(MsgLoggerCat)
456  // << "MEtoEDM<TH2D> doesn't exist in run";
457  continue;
458  }
459 
460  std::vector<MEtoEDM<TH2D>::MEtoEDMObject> metoedmobject =
461  metoedm->getMEtoEdmObject();
462 
463  me2.resize(metoedmobject.size());
464 
465  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
466 
467  me2[i] = 0;
468 
469  // get full path of monitor element
470  std::string pathname = metoedmobject[i].name;
471  if (verbosity > 0) std::cout << pathname << std::endl;
472 
474 
475  // deconstruct path from fullpath
476  StringList fulldir = StringOps::split(pathname,"/");
477 
478  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
479  dir += fulldir[j];
480  if (j != fulldir.size() - 2) dir += "/";
481  }
482 
483  // define new monitor element
484  if (dbe) {
485  me2[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
486  if (me2[i] && me2[i]->getTH2D() && me2[i]->getTH2D()->TestBit(TH1::kCanRebin) == true) {
487  TList list;
488  list.Add(&metoedmobject[i].object);
489  if (me2[i]->getTH2D()->Merge(&list) == -1)
490  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
491  << metoedmobject[i].object.GetName() << "'" << std::endl;
492  } else {
493  dbe->setCurrentFolder(dir);
494  me2[i] = dbe->book2DD(metoedmobject[i].object.GetName(),
495  &metoedmobject[i].object);
496  }
497  if (!iEndRun) me2[i]->setLumiFlag();
498  } // end define new monitor elements
499 
500  // attach taglist
501  TagList tags = metoedmobject[i].tags;
502 
503  for (unsigned int j = 0; j < tags.size(); ++j) {
504  dbe->tag(me2[i]->getFullname(),tags[j]);
505  }
506  } // end loop thorugh metoedmobject
507  } // end TH2D creation
508 
509  if (classtypes[ii] == "TH3F") {
510  edm::Handle<MEtoEDM<TH3F> > metoedm;
511  iGetFrom.getByLabel(*inputTag, metoedm);
512 
513  if (!metoedm.isValid()) {
514  //edm::LogWarning(MsgLoggerCat)
515  // << "MEtoEDM<TH3F> doesn't exist in run";
516  continue;
517  }
518 
519  std::vector<MEtoEDM<TH3F>::MEtoEDMObject> metoedmobject =
520  metoedm->getMEtoEdmObject();
521 
522  me3.resize(metoedmobject.size());
523 
524  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
525 
526  me3[i] = 0;
527 
528  // get full path of monitor element
529  std::string pathname = metoedmobject[i].name;
530  if (verbosity > 0) std::cout << pathname << std::endl;
531 
533 
534  // deconstruct path from fullpath
535  StringList fulldir = StringOps::split(pathname,"/");
536 
537  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
538  dir += fulldir[j];
539  if (j != fulldir.size() - 2) dir += "/";
540  }
541 
542  // define new monitor element
543  if (dbe) {
544  me3[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
545  if (me3[i] && me3[i]->getTH3F() && me3[i]->getTH3F()->TestBit(TH1::kCanRebin) == true) {
546  TList list;
547  list.Add(&metoedmobject[i].object);
548  if (me3[i]->getTH3F()->Merge(&list) == -1)
549  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
550  << metoedmobject[i].object.GetName() << "'" << std::endl;
551  } else {
552  dbe->setCurrentFolder(dir);
553  me3[i] = dbe->book3D(metoedmobject[i].object.GetName(),
554  &metoedmobject[i].object);
555  }
556  if (!iEndRun) me3[i]->setLumiFlag();
557  } // end define new monitor elements
558 
559  // attach taglist
560  TagList tags = metoedmobject[i].tags;
561 
562  for (unsigned int j = 0; j < tags.size(); ++j) {
563  dbe->tag(me3[i]->getFullname(),tags[j]);
564  }
565  } // end loop thorugh metoedmobject
566  } // end TH3F creation
567 
568  if (classtypes[ii] == "TProfile") {
570  iGetFrom.getByLabel(*inputTag, metoedm);
571 
572  if (!metoedm.isValid()) {
573  //edm::LogWarning(MsgLoggerCat)
574  // << "MEtoEDM<TProfile> doesn't exist in run";
575  continue;
576  }
577 
578  std::vector<MEtoEDM<TProfile>::MEtoEDMObject> metoedmobject =
579  metoedm->getMEtoEdmObject();
580 
581  me4.resize(metoedmobject.size());
582 
583  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
584 
585  me4[i] = 0;
586 
587  // get full path of monitor element
588  std::string pathname = metoedmobject[i].name;
589  if (verbosity > 0) std::cout << pathname << std::endl;
590 
592 
593  // deconstruct path from fullpath
594  StringList fulldir = StringOps::split(pathname,"/");
595 
596  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
597  dir += fulldir[j];
598  if (j != fulldir.size() - 2) dir += "/";
599  }
600 
601  std::string name = metoedmobject[i].object.GetName();
602  // define new monitor element
603  if (dbe) {
604  me4[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
605  if (me4[i] && me4[i]->getTProfile() && me4[i]->getTProfile()->TestBit(TH1::kCanRebin) == true) {
606  TList list;
607  list.Add(&metoedmobject[i].object);
608  if (me4[i]->getTProfile()->Merge(&list) == -1)
609  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
610  << metoedmobject[i].object.GetName() << "'" << std::endl;
611  } else {
612  dbe->setCurrentFolder(dir);
613  me4[i] = dbe->bookProfile(metoedmobject[i].object.GetName(),
614  &metoedmobject[i].object);
615  }
616  if (!iEndRun) me4[i]->setLumiFlag();
617  } // end define new monitor elements
618 
619  // attach taglist
620  TagList tags = metoedmobject[i].tags;
621 
622  for (unsigned int j = 0; j < tags.size(); ++j) {
623  dbe->tag(me4[i]->getFullname(),tags[j]);
624  }
625  } // end loop thorugh metoedmobject
626  } // end TProfile creation
627 
628  if (classtypes[ii] == "TProfile2D") {
630  iGetFrom.getByLabel(*inputTag, metoedm);
631 
632  if (!metoedm.isValid()) {
633  //edm::LogWarning(MsgLoggerCat)
634  // << "MEtoEDM<TProfile2D> doesn't exist in run";
635  continue;
636  }
637 
638  std::vector<MEtoEDM<TProfile2D>::MEtoEDMObject> metoedmobject =
639  metoedm->getMEtoEdmObject();
640 
641  me5.resize(metoedmobject.size());
642 
643  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
644 
645  me5[i] = 0;
646 
647  // get full path of monitor element
648  std::string pathname = metoedmobject[i].name;
649  if (verbosity > 0) std::cout << pathname << std::endl;
650 
652 
653  // deconstruct path from fullpath
654  StringList fulldir = StringOps::split(pathname,"/");
655 
656  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
657  dir += fulldir[j];
658  if (j != fulldir.size() - 2) dir += "/";
659  }
660 
661  // define new monitor element
662  if (dbe) {
663  me5[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
664  if (me5[i] && me5[i]->getTProfile2D() && me5[i]->getTProfile2D()->TestBit(TH1::kCanRebin) == true) {
665  TList list;
666  list.Add(&metoedmobject[i].object);
667  if (me5[i]->getTProfile2D()->Merge(&list) == -1)
668  std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
669  << metoedmobject[i].object.GetName() << "'" << std::endl;
670  } else {
671  dbe->setCurrentFolder(dir);
672  me5[i] = dbe->bookProfile2D(metoedmobject[i].object.GetName(),
673  &metoedmobject[i].object);
674  }
675  if (!iEndRun) me5[i]->setLumiFlag();
676  } // end define new monitor elements
677 
678  // attach taglist
679  TagList tags = metoedmobject[i].tags;
680 
681  for (unsigned int j = 0; j < tags.size(); ++j) {
682  dbe->tag(me5[i]->getFullname(),tags[j]);
683  }
684  } // end loop thorugh metoedmobject
685  } // end TProfile2D creation
686 
687  if (classtypes[ii] == "Double") {
688  edm::Handle<MEtoEDM<double> > metoedm;
689  iGetFrom.getByLabel(*inputTag, metoedm);
690 
691  if (!metoedm.isValid()) {
692  //edm::LogWarning(MsgLoggerCat)
693  // << "MEtoEDM<double> doesn't exist in run";
694  continue;
695  }
696 
697  std::vector<MEtoEDM<double>::MEtoEDMObject> metoedmobject =
698  metoedm->getMEtoEdmObject();
699 
700  me6.resize(metoedmobject.size());
701 
702  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
703 
704  me6[i] = 0;
705 
706  // get full path of monitor element
707  std::string pathname = metoedmobject[i].name;
708  if (verbosity > 0) std::cout << pathname << std::endl;
709 
712 
713  // deconstruct path from fullpath
714 
715  StringList fulldir = StringOps::split(pathname,"/");
716  name = *(fulldir.end() - 1);
717 
718  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
719  dir += fulldir[j];
720  if (j != fulldir.size() - 2) dir += "/";
721  }
722 
723  // define new monitor element
724  if (dbe) {
725  dbe->setCurrentFolder(dir);
726  me6[i] = dbe->bookFloat(name);
727  me6[i]->Fill(metoedmobject[i].object);
728  if (!iEndRun) me6[i]->setLumiFlag();
729  } // end define new monitor elements
730 
731  // attach taglist
732  TagList tags = metoedmobject[i].tags;
733 
734  for (unsigned int j = 0; j < tags.size(); ++j) {
735  dbe->tag(me6[i]->getFullname(),tags[j]);
736  }
737  } // end loop thorugh metoedmobject
738  } // end Float creation
739 
740  if (classtypes[ii] == "Int64") {
742  iGetFrom.getByLabel(*inputTag, metoedm);
743 
744  if (!metoedm.isValid()) {
745  //edm::LogWarning(MsgLoggerCat)
746  // << "MEtoEDM<long long> doesn't exist in run";
747  continue;
748  }
749 
750  std::vector<MEtoEDM<long long>::MEtoEDMObject> metoedmobject =
751  metoedm->getMEtoEdmObject();
752 
753  me7.resize(metoedmobject.size());
754 
755  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
756 
757  me7[i] = 0;
758 
759  // get full path of monitor element
760  std::string pathname = metoedmobject[i].name;
761  if (verbosity > 0) std::cout << pathname << std::endl;
762 
765 
766  // deconstruct path from fullpath
767  StringList fulldir = StringOps::split(pathname,"/");
768  name = *(fulldir.end() - 1);
769 
770  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
771  dir += fulldir[j];
772  if (j != fulldir.size() - 2) dir += "/";
773  }
774 
775  // define new monitor element
776  if (dbe) {
777  dbe->setCurrentFolder(dir);
778  long long ival = 0;
779  if ( iEndRun ) {
780  if (name.find("processedEvents") != std::string::npos) {
781  if (MonitorElement* me = dbe->get(dir+"/"+name)) {
782  ival = me->getIntValue();
783  }
784  }
785  }
786  me7[i] = dbe->bookInt(name);
787  me7[i]->Fill(metoedmobject[i].object+ival);
788  if (!iEndRun) me7[i]->setLumiFlag();
789  } // end define new monitor elements
790 
791  // attach taglist
792  TagList tags = metoedmobject[i].tags;
793 
794  for (unsigned int j = 0; j < tags.size(); ++j) {
795  dbe->tag(me7[i]->getFullname(),tags[j]);
796  }
797  } // end loop thorugh metoedmobject
798  } // end Int creation
799 
800  if (classtypes[ii] == "Int") {
801  edm::Handle<MEtoEDM<int> > metoedm;
802  iGetFrom.getByLabel(*inputTag, metoedm);
803 
804  if (!metoedm.isValid()) {
805  //edm::LogWarning(MsgLoggerCat)
806  // << "MEtoEDM<int> doesn't exist in run";
807  continue;
808  }
809 
810  std::vector<MEtoEDM<int>::MEtoEDMObject> metoedmobject =
811  metoedm->getMEtoEdmObject();
812 
813  me7.resize(metoedmobject.size());
814 
815  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
816 
817  me7[i] = 0;
818 
819  // get full path of monitor element
820  std::string pathname = metoedmobject[i].name;
821  if (verbosity > 0) std::cout << pathname << std::endl;
822 
825 
826  // deconstruct path from fullpath
827  StringList fulldir = StringOps::split(pathname,"/");
828  name = *(fulldir.end() - 1);
829 
830  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
831  dir += fulldir[j];
832  if (j != fulldir.size() - 2) dir += "/";
833  }
834 
835  // define new monitor element
836  if (dbe) {
837  dbe->setCurrentFolder(dir);
838  int ival = 0;
839  if ( iEndRun ) {
840  if (name.find("processedEvents") != std::string::npos) {
841  if (MonitorElement* me = dbe->get(dir+"/"+name)) {
842  ival = me->getIntValue();
843  }
844  }
845  }
846  me7[i] = dbe->bookInt(name);
847  me7[i]->Fill(metoedmobject[i].object+ival);
848  if (!iEndRun) me7[i]->setLumiFlag();
849  } // end define new monitor elements
850 
851  // attach taglist
852  TagList tags = metoedmobject[i].tags;
853 
854  for (unsigned int j = 0; j < tags.size(); ++j) {
855  dbe->tag(me7[i]->getFullname(),tags[j]);
856  }
857  } // end loop thorugh metoedmobject
858  } // end Int creation
859 
860  if (classtypes[ii] == "String") {
862  iGetFrom.getByLabel(*inputTag, metoedm);
863 
864  if (!metoedm.isValid()) {
865  //edm::LogWarning(MsgLoggerCat)
866  // << "MEtoEDM<TString> doesn't exist in run";
867  continue;
868  }
869 
870  std::vector<MEtoEDM<TString>::MEtoEDMObject> metoedmobject =
871  metoedm->getMEtoEdmObject();
872 
873  me8.resize(metoedmobject.size());
874 
875  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
876 
877  me8[i] = 0;
878 
879  // get full path of monitor element
880  std::string pathname = metoedmobject[i].name;
881  if (verbosity > 0) std::cout << pathname << std::endl;
882 
885 
886  // deconstruct path from fullpath
887  StringList fulldir = StringOps::split(pathname,"/");
888  name = *(fulldir.end() - 1);
889 
890  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
891  dir += fulldir[j];
892  if (j != fulldir.size() - 2) dir += "/";
893  }
894 
895  // define new monitor element
896  if (dbe) {
897  dbe->setCurrentFolder(dir);
898  std::string scont = metoedmobject[i].object.Data();
899  me8[i] = dbe->bookString(name,scont);
900  if (!iEndRun) me8[i]->setLumiFlag();
901  } // end define new monitor elements
902 
903  // attach taglist
904  TagList tags = metoedmobject[i].tags;
905 
906  for (unsigned int j = 0; j < tags.size(); ++j) {
907  dbe->tag(me8[i]->getFullname(),tags[j]);
908  }
909  } // end loop thorugh metoedmobject
910  } // end String creation
911  }
912 
913  // verify tags stored properly
914  if (verbosity > 0) {
915  std::vector<std::string> stags;
916  dbe->getAllTags(stags);
917  for (unsigned int i = 0; i < stags.size(); ++i) {
918  std::cout << "Tags: " << stags[i] << std::endl;
919  }
920  }
921 
922 }
std::vector< uint32_t > TagList
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:872
TProfile * getTProfile(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
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:984
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:894
std::vector< MonitorElement * > me6
MonitorElement * book1DD(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
Definition: DQMStore.cc:754
int ii
Definition: cuy.py:588
std::vector< std::string > classtypes
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:659
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1359
edm::InputTag lumiInputTag_
std::vector< MonitorElement * > me8
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:688
TH3F * getTH3F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
std::vector< MonitorElement * > me7
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:1036
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
bool isValid() const
Definition: HandleBase.h:76
tuple tags
Definition: o2o.py:248
void getAllTags(std::vector< std::string > &into) const
Definition: DQMStore.cc:1624
std::vector< MonitorElement * > me2
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:629
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:850
std::vector< MonitorElement * > me3
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:738
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
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
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:1180
void EDMtoMEConverter::respondToOpenInputFile ( const edm::FileBlock iFb)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 88 of file EDMtoMEConverter.cc.

References iCountf.

89 {
90  ++iCountf;
91  return;
92 }
unsigned int iCountf

Member Data Documentation

std::vector<std::string> EDMtoMEConverter::classtypes
private

Definition at line 88 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and getData().

bool EDMtoMEConverter::convertOnEndLumi
private

Definition at line 78 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and endLuminosityBlock().

bool EDMtoMEConverter::convertOnEndRun
private

Definition at line 79 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and endRun().

DQMStore* EDMtoMEConverter::dbe
private

Definition at line 81 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and getData().

int EDMtoMEConverter::frequency
private

Definition at line 76 of file EDMtoMEConverter.h.

Referenced by beginRun(), and EDMtoMEConverter().

std::map<int,int> EDMtoMEConverter::iCount
private

Definition at line 86 of file EDMtoMEConverter.h.

Referenced by beginRun(), EDMtoMEConverter(), and endJob().

unsigned int EDMtoMEConverter::iCountf
private

Definition at line 85 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), endJob(), and respondToOpenInputFile().

edm::InputTag EDMtoMEConverter::lumiInputTag_
private

Definition at line 91 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me1
private

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me2
private

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me3
private

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me4
private

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me5
private

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me6
private

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me7
private

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me8
private

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::string EDMtoMEConverter::name
private
edm::InputTag EDMtoMEConverter::runInputTag_
private

Definition at line 90 of file EDMtoMEConverter.h.

Referenced by getData().

int EDMtoMEConverter::verbosity
private

Definition at line 75 of file EDMtoMEConverter.h.

Referenced by beginRun(), EDMtoMEConverter(), endJob(), and getData().