CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
MEtoEDMConverter Class Reference

#include <MEtoEDMConverter.h>

Inheritance diagram for MEtoEDMConverter:
edm::one::EDProducer< edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::EndRunProducer > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector< uint32_t > TagList
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

virtual void beginJob () override
 
virtual void beginRun (edm::Run const &, const edm::EventSetup &) override
 
virtual void endJob () override
 
virtual void endLuminosityBlockProduce (edm::LuminosityBlock &, const edm::EventSetup &) override
 
virtual void endRun (edm::Run const &, const edm::EventSetup &) override
 
virtual void endRunProduce (edm::Run &, const edm::EventSetup &) override
 
 MEtoEDMConverter (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
template<class T >
void putData (T &iPutTo, bool iLumiOnly, uint32_t run, uint32_t lumi)
 
virtual ~MEtoEDMConverter ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::EndRunProducer >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

DQMStoredbe
 
bool deleteAfterCopy
 
bool enableMultiThread_
 
std::string fName
 
int frequency
 
std::map< int, int > iCount
 
std::string path
 
int verbosity
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

Author
M. Strang SUNY-Buffalo

Definition at line 56 of file MEtoEDMConverter.h.

Member Typedef Documentation

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

Definition at line 74 of file MEtoEDMConverter.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file MEtoEDMConverter.cc.

References dbe, deleteAfterCopy, enableMultiThread_, edm::EndLuminosityBlock, edm::EndRun, fName, frequency, edm::ParameterSet::getUntrackedParameter(), iCount, Utilities::operator, path, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

18  :
19  fName(""), verbosity(0), frequency(0), deleteAfterCopy(false)
20 {
21  std::string MsgLoggerCat = "MEtoEDMConverter_MEtoEDMConverter";
22 
23  // get information from parameter set
24  fName = iPSet.getUntrackedParameter<std::string>("Name","MEtoEDMConverter");
25  verbosity = iPSet.getUntrackedParameter<int>("Verbosity",0);
26  frequency = iPSet.getUntrackedParameter<int>("Frequency",50);
27  path = iPSet.getUntrackedParameter<std::string>("MEPathToSave");
28  deleteAfterCopy = iPSet.getUntrackedParameter<bool>("deleteAfterCopy",false);
29  enableMultiThread_ = false;
30  // use value of first digit to determine default output level (inclusive)
31  // 0 is none, 1 is basic, 2 is fill output, 3 is gather output
32  verbosity %= 10;
33 
34  // print out Parameter Set information being used
35  if (verbosity >= 0) {
36  edm::LogInfo(MsgLoggerCat)
37  << "\n===============================\n"
38  << "Initialized as EDProducer with parameter values:\n"
39  << " Name = " << fName << "\n"
40  << " Verbosity = " << verbosity << "\n"
41  << " Frequency = " << frequency << "\n"
42  << " Path = " << path << "\n"
43  << "===============================\n";
44  }
45 
46  // get dqm info
48 
49  std::string sName;
50 
51  // create persistent objects
52 
53  sName = fName + "Run";
54  produces<MEtoEDM<TH1F>, edm::Transition::EndRun>(sName);
55  produces<MEtoEDM<TH1S>, edm::Transition::EndRun>(sName);
56  produces<MEtoEDM<TH1D>, edm::Transition::EndRun>(sName);
57  produces<MEtoEDM<TH2F>, edm::Transition::EndRun>(sName);
58  produces<MEtoEDM<TH2S>, edm::Transition::EndRun>(sName);
59  produces<MEtoEDM<TH2D>, edm::Transition::EndRun>(sName);
60  produces<MEtoEDM<TH3F>, edm::Transition::EndRun>(sName);
61  produces<MEtoEDM<TProfile>, edm::Transition::EndRun>(sName);
62  produces<MEtoEDM<TProfile2D>, edm::Transition::EndRun>(sName);
63  produces<MEtoEDM<double>, edm::Transition::EndRun>(sName);
64  produces<MEtoEDM<long long>, edm::Transition::EndRun>(sName);
65  produces<MEtoEDM<TString>, edm::Transition::EndRun>(sName);
66 
67  sName = fName + "Lumi";
68  produces<MEtoEDM<TH1F>, edm::Transition::EndLuminosityBlock>(sName);
69  produces<MEtoEDM<TH1S>, edm::Transition::EndLuminosityBlock>(sName);
70  produces<MEtoEDM<TH1D>, edm::Transition::EndLuminosityBlock>(sName);
71  produces<MEtoEDM<TH2F>, edm::Transition::EndLuminosityBlock>(sName);
72  produces<MEtoEDM<TH2S>, edm::Transition::EndLuminosityBlock>(sName);
73  produces<MEtoEDM<TH2D>, edm::Transition::EndLuminosityBlock>(sName);
74  produces<MEtoEDM<TH3F>, edm::Transition::EndLuminosityBlock>(sName);
75  produces<MEtoEDM<TProfile>, edm::Transition::EndLuminosityBlock>(sName);
76  produces<MEtoEDM<TProfile2D>, edm::Transition::EndLuminosityBlock>(sName);
77  produces<MEtoEDM<double>, edm::Transition::EndLuminosityBlock>(sName);
78  produces<MEtoEDM<long long>, edm::Transition::EndLuminosityBlock>(sName);
79  produces<MEtoEDM<TString>, edm::Transition::EndLuminosityBlock>(sName);
80 
81  iCount.clear();
82 
83  assert(sizeof(int64_t) == sizeof(long long));
84 
85 }
T getUntrackedParameter(std::string const &, T const &) const
std::map< int, int > iCount
MEtoEDMConverter::~MEtoEDMConverter ( )
virtual

Definition at line 87 of file MEtoEDMConverter.cc.

88 {
89 }

Member Function Documentation

void MEtoEDMConverter::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 92 of file MEtoEDMConverter.cc.

References dbe, and enableMultiThread_.

93 {
94  // Determine if we are running multithreading asking to the DQMStore. Not to be moved in the ctor
95  enableMultiThread_ = dbe->enableMultiThread_;
96 }
void MEtoEDMConverter::beginRun ( edm::Run const &  iRun,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 252 of file MEtoEDMConverter.cc.

References dbe, MonitorElement::DQM_KIND_INT, MonitorElement::DQM_KIND_REAL, MonitorElement::DQM_KIND_STRING, MonitorElement::DQM_KIND_TH1D, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH1S, MonitorElement::DQM_KIND_TH2D, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TH2S, MonitorElement::DQM_KIND_TH3F, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::DQM_KIND_TPROFILE2D, enableMultiThread_, frequency, MonitorElement::getFullname(), iCount, mps_monitormerge::items, MonitorElement::kind(), path, MonitorElement::Reset(), edm::RunBase::run(), AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

253 {
254  std::string MsgLoggerCat = "MEtoEDMConverter_beginRun";
255 
256  // No need to do any reset in the MultiThread DQM, since we will
257  // index each and every MonitorElement by Run and Lumi.
258 
259  if (enableMultiThread_)
260  return;
261 
262  int nrun = iRun.run();
263 
264  // keep track of number of runs processed
265  ++iCount[nrun];
266 
267  if (verbosity > 0) { // keep track of number of runs processed
268  edm::LogInfo(MsgLoggerCat)
269  << "Processing run " << nrun << " (" << iCount.size() << " runs total)";
270  } else if (verbosity == 0) {
271  if (nrun%frequency == 0 || iCount.size() == 1) {
272  edm::LogInfo(MsgLoggerCat)
273  << "Processing run " << nrun << " (" << iCount.size() << " runs total)";
274  }
275  }
276 
277  // clear contents of monitor elements
278  std::vector<MonitorElement *>::iterator mmi, mme;
279  std::vector<MonitorElement *> items(dbe->getAllContents(path));
280 
281  for (mmi = items.begin (), mme = items.end (); mmi != mme; ++mmi) {
282 
283  MonitorElement *me = *mmi;
284 
285  switch (me->kind())
286  {
288  break;
289 
291  break;
292 
294  break;
295 
297  me->Reset();
298  break;
299 
301  me->Reset();
302  break;
303 
305  me->Reset();
306  break;
307 
309  me->Reset();
310  break;
311 
313  me->Reset();
314  break;
315 
317  me->Reset();
318  break;
319 
321  me->Reset();
322  break;
323 
325  me->Reset();
326  break;
327 
329  me->Reset();
330  break;
331 
332  default:
333  edm::LogError(MsgLoggerCat)
334  << "ERROR: The DQM object '" << me->getFullname()
335  << "' is neither a ROOT object nor a recognised "
336  << "simple object.\n";
337  continue;
338  }
339 
340  } // end loop through monitor elements
341 }
std::map< int, int > iCount
Kind kind(void) const
Get the type of the monitor element.
const std::string getFullname(void) const
get full name of ME including Pathname
void Reset(void)
reset ME (ie. contents, errors, etc)
void MEtoEDMConverter::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 99 of file MEtoEDMConverter.cc.

References gather_cfg::cout, dbe, dir, MonitorElement::DQM_KIND_INT, MonitorElement::DQM_KIND_REAL, MonitorElement::DQM_KIND_STRING, MonitorElement::DQM_KIND_TH1D, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH1S, MonitorElement::DQM_KIND_TH2D, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TH2S, MonitorElement::DQM_KIND_TH3F, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::DQM_KIND_TPROFILE2D, MonitorElement::getFullname(), MonitorElement::getRootObject(), iCount, reco::if(), mps_monitormerge::items, MonitorElement::kind(), split, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

100 {
101  std::string MsgLoggerCat = "MEtoEDMConverter_endJob";
102 
103  if (verbosity > 0) {
104 
105  // keep track just of package names
106  std::map<std::string,int> packages;
107 
108  // count various objects we have
109  unsigned nTH1F = 0;
110  unsigned nTH1S = 0;
111  unsigned nTH1D = 0;
112  unsigned nTH2F = 0;
113  unsigned nTH2S = 0;
114  unsigned nTH2D = 0;
115  unsigned nTH3F = 0;
116  unsigned nTProfile = 0;
117  unsigned nTProfile2D = 0;
118  unsigned nDouble = 0;
119  unsigned nInt64 = 0;
120  unsigned nString = 0;
121 
122  if (verbosity > 1) std::cout << std::endl << "Summary :" << std::endl;
123 
124  // get contents out of DQM
125  std::vector<MonitorElement *>::iterator mmi, mme;
126  std::vector<MonitorElement *> items(dbe->getAllContents(""));
127 
128  for (mmi = items.begin (), mme = items.end (); mmi != mme; ++mmi) {
129 
130  // keep track of leading directory (i.e. package)
131  StringList dir = StringOps::split((*mmi)->getPathname(),"/");
132  ++packages[dir[0]];
133 
134  // check type
135  if (verbosity > 1) std::cout << "MEobject:" << std::endl;
136  MonitorElement *me = *mmi;
137  TObject *tobj = me->getRootObject();
138  switch (me->kind())
139  {
141  ++nInt64;
142  if (verbosity > 1)
143  std::cout << " scalar: " << tobj->GetName() << ": Int64\n";
144  break;
145 
147  ++nDouble;
148  if (verbosity > 1)
149  std::cout << " scalar: " << tobj->GetName() << ": Double\n";
150  break;
151 
153  ++nString;
154  if (verbosity > 1)
155  std::cout << " scalar: " << tobj->GetName() << ": String\n";
156  break;
157 
159  ++nTH1F;
160  if (verbosity > 1)
161  std::cout << " normal: " << tobj->GetName() << ": TH1F\n";
162  break;
163 
165  ++nTH1S;
166  if (verbosity > 1)
167  std::cout << " normal: " << tobj->GetName() << ": TH1S\n";
168  break;
169 
171  ++nTH1D;
172  if (verbosity > 1)
173  std::cout << " normal: " << tobj->GetName() << ": TH1D\n";
174  break;
175 
177  ++nTH2F;
178  if (verbosity > 1)
179  std::cout << " normal: " << tobj->GetName() << ": TH2F\n";
180  break;
181 
183  ++nTH2S;
184  if (verbosity > 1)
185  std::cout << " normal: " << tobj->GetName() << ": TH2S\n";
186  break;
187 
189  ++nTH2D;
190  if (verbosity > 1)
191  std::cout << " normal: " << tobj->GetName() << ": TH2D\n";
192  break;
193 
195  ++nTH3F;
196  if (verbosity > 1)
197  std::cout << " normal: " << tobj->GetName() << ": TH3F\n";
198  break;
199 
201  ++nTProfile;
202  if (verbosity > 1)
203  std::cout << " normal: " << tobj->GetName() << ": TProfile\n";
204  break;
205 
207  ++nTProfile2D;
208  if (verbosity > 1)
209  std::cout << " normal: " << tobj->GetName() << ": TProfile2D\n";
210  break;
211 
212  default:
213  edm::LogError(MsgLoggerCat)
214  << "ERROR: The DQM object '" << me->getFullname()
215  << "' is neither a ROOT object nor a recognised "
216  << "simple object.\n";
217  continue;
218  }
219  } // end loop through monitor elements
220 
221  // list unique packages
222  std::cout << "Packages accessing DQM:" << std::endl;
223  std::map<std::string,int>::iterator pkgIter;
224  for (pkgIter = packages.begin(); pkgIter != packages.end(); ++pkgIter)
225  std::cout << " " << pkgIter->first << ": " << pkgIter->second
226  << std::endl;
227 
228  std::cout << "We have " << nTH1F << " TH1F objects" << std::endl;
229  std::cout << "We have " << nTH1S << " TH1S objects" << std::endl;
230  std::cout << "We have " << nTH1D << " TH1D objects" << std::endl;
231  std::cout << "We have " << nTH2F << " TH2F objects" << std::endl;
232  std::cout << "We have " << nTH2S << " TH2S objects" << std::endl;
233  std::cout << "We have " << nTH2D << " TH2D objects" << std::endl;
234  std::cout << "We have " << nTH3F << " TH3F objects" << std::endl;
235  std::cout << "We have " << nTProfile << " TProfile objects" << std::endl;
236  std::cout << "We have " << nTProfile2D << " TProfile2D objects" << std::endl;
237  std::cout << "We have " << nDouble << " Double objects" << std::endl;
238  std::cout << "We have " << nInt64 << " Int64 objects" << std::endl;
239  std::cout << "We have " << nString << " String objects" << std::endl;
240 
241  if (verbosity > 1) std::cout << std::endl;
242 
243  }
244 
245  if (verbosity >= 0)
246  edm::LogInfo(MsgLoggerCat)
247  << "Terminating having processed " << iCount.size() << " runs.";
248 
249 }
std::map< int, int > iCount
Kind kind(void) const
Get the type of the monitor element.
const std::string getFullname(void) const
get full name of ME including Pathname
TObject * getRootObject(void) const
if(dp >Float(M_PI)) dp-
dbl *** dir
Definition: mlp_gen.cc:35
double split
Definition: MVATrainer.cc:139
void MEtoEDMConverter::endLuminosityBlockProduce ( edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 355 of file MEtoEDMConverter.cc.

References edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), putData(), and edm::LuminosityBlockBase::run().

356 {
357  putData(iLumi, true, iLumi.run(), iLumi.id().luminosityBlock());
358 }
LuminosityBlockID id() const
RunNumber_t run() const
LuminosityBlockNumber_t luminosityBlock() const
void putData(T &iPutTo, bool iLumiOnly, uint32_t run, uint32_t lumi)
void MEtoEDMConverter::endRun ( edm::Run const &  iRun,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 343 of file MEtoEDMConverter.cc.

344 {
345 }
void MEtoEDMConverter::endRunProduce ( edm::Run iRun,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 348 of file MEtoEDMConverter.cc.

References dbe, putData(), and edm::RunBase::run().

349 {
350  dbe->scaleElements();
351  putData(iRun, false, iRun.run(), 0);
352 }
RunNumber_t run() const
Definition: RunBase.h:40
void putData(T &iPutTo, bool iLumiOnly, uint32_t run, uint32_t lumi)
void MEtoEDMConverter::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual
template<class T >
void MEtoEDMConverter::putData ( T iPutTo,
bool  iLumiOnly,
uint32_t  run,
uint32_t  lumi 
)

Definition at line 362 of file MEtoEDMConverter.cc.

References dbe, deleteAfterCopy, MonitorElement::DQM_KIND_INT, MonitorElement::DQM_KIND_REAL, MonitorElement::DQM_KIND_STRING, MonitorElement::DQM_KIND_TH1D, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH1S, MonitorElement::DQM_KIND_TH2D, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TH2S, MonitorElement::DQM_KIND_TH3F, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::DQM_KIND_TPROFILE2D, enableMultiThread_, fName, MonitorElement::getFloatValue(), MonitorElement::getFullname(), MonitorElement::getIntValue(), MonitorElement::getLumiFlag(), MonitorElement::getName(), MonitorElement::getPathname(), MonitorElement::getStringValue(), MonitorElement::getTags(), MonitorElement::getTH1D(), MonitorElement::getTH1F(), MonitorElement::getTH1S(), MonitorElement::getTH2D(), MonitorElement::getTH2F(), MonitorElement::getTH2S(), MonitorElement::getTH3F(), MonitorElement::getTProfile(), MonitorElement::getTProfile2D(), mps_monitormerge::items, MonitorElement::kind(), eostools::move(), path, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

Referenced by endLuminosityBlockProduce(), and endRunProduce().

366 {
367  std::string MsgLoggerCat = "MEtoEDMConverter_putData";
368 
369  if (verbosity > 0)
370  edm::LogInfo (MsgLoggerCat) << "\nStoring MEtoEDM dataformat histograms.";
371 
372  // extract ME information into vectors
373  std::vector<MonitorElement *>::iterator mmi, mme;
374  std::vector<MonitorElement *> items(dbe->getAllContents(path,
375  enableMultiThread_ ? run : 0,
376  enableMultiThread_ ? lumi : 0));
377 
378  unsigned int n1F=0;
379  unsigned int n1S=0;
380  unsigned int n1D=0;
381  unsigned int n2F=0;
382  unsigned int n2S=0;
383  unsigned int n2D=0;
384  unsigned int n3F=0;
385  unsigned int nProf=0;
386  unsigned int nProf2=0;
387  unsigned int nDouble=0;
388  unsigned int nInt64=0;
389  unsigned int nString=0;
390 
391  for (mmi = items.begin (), mme = items.end (); mmi != mme; ++mmi) {
392 
393  MonitorElement *me = *mmi;
394 
395  // store only flagged ME at endLumi transition, and Run-based
396  // histo at endRun transition
397  if (iLumiOnly && !me->getLumiFlag()) continue;
398  if (!iLumiOnly && me->getLumiFlag()) continue;
399 
400  switch (me->kind())
401  {
403  ++nInt64;
404  break;
405 
407  ++nDouble;
408  break;
409 
411  ++nString;
412  break;
413 
415  ++n1F;
416  break;
417 
419  ++n1S;
420  break;
421 
423  ++n1D;
424  break;
425 
427  ++n2F;
428  break;
429 
431  ++n2S;
432  break;
433 
435  ++n2D;
436  break;
437 
439  ++n3F;
440  break;
441 
443  ++nProf;
444  break;
445 
447  ++nProf2;
448  break;
449 
450  default:
451  edm::LogError(MsgLoggerCat)
452  << "ERROR: The DQM object '" << me->getFullname()
453  << "' is neither a ROOT object nor a recognised "
454  << "simple object.\n";
455  continue;
456  }
457  }
458 
459  std::unique_ptr<MEtoEDM<long long> > pOutInt(new MEtoEDM<long long>(nInt64));
460  std::unique_ptr<MEtoEDM<double> > pOutDouble(new MEtoEDM<double>(nDouble));
461  std::unique_ptr<MEtoEDM<TString> > pOutString(new MEtoEDM<TString>(nString));
462  std::unique_ptr<MEtoEDM<TH1F> > pOut1(new MEtoEDM<TH1F>(n1F));
463  std::unique_ptr<MEtoEDM<TH1S> > pOut1s(new MEtoEDM<TH1S>(n1S));
464  std::unique_ptr<MEtoEDM<TH1D> > pOut1d(new MEtoEDM<TH1D>(n1D));
465  std::unique_ptr<MEtoEDM<TH2F> > pOut2(new MEtoEDM<TH2F>(n2F));
466  std::unique_ptr<MEtoEDM<TH2S> > pOut2s(new MEtoEDM<TH2S>(n2S));
467  std::unique_ptr<MEtoEDM<TH2D> > pOut2d(new MEtoEDM<TH2D>(n2D));
468  std::unique_ptr<MEtoEDM<TH3F> > pOut3(new MEtoEDM<TH3F>(n3F));
469  std::unique_ptr<MEtoEDM<TProfile> > pOutProf(new MEtoEDM<TProfile>(nProf));
470  std::unique_ptr<MEtoEDM<TProfile2D> > pOutProf2(new MEtoEDM<TProfile2D>(nProf2));
471 
472  for (mmi = items.begin (), mme = items.end (); mmi != mme; ++mmi) {
473 
474  MonitorElement *me = *mmi;
475 
476  // store only flagged ME at endLumi transition, and Run-based
477  // histo at endRun transition
478  if (iLumiOnly && !me->getLumiFlag()) continue;
479  if (!iLumiOnly && me->getLumiFlag()) continue;
480 
481  // get monitor elements
482  switch (me->kind())
483  {
485  pOutInt->putMEtoEdmObject(me->getFullname(),me->getTags(),me->getIntValue());
486  break;
487 
489  pOutDouble->putMEtoEdmObject(me->getFullname(),me->getTags(),me->getFloatValue());
490  break;
491 
493  pOutString->putMEtoEdmObject(me->getFullname(),me->getTags(),me->getStringValue());
494  break;
495 
497  pOut1->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH1F());
498  break;
499 
501  pOut1s->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH1S());
502  break;
503 
505  pOut1d->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH1D());
506  break;
507 
509  pOut2->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH2F());
510  break;
511 
513  pOut2s->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH2S());
514  break;
515 
517  pOut2d->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH2D());
518  break;
519 
521  pOut3->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH3F());
522  break;
523 
525  pOutProf->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTProfile());
526  break;
527 
529  pOutProf2->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTProfile2D());
530  break;
531 
532  default:
533  edm::LogError(MsgLoggerCat)
534  << "ERROR: The DQM object '" << me->getFullname()
535  << "' is neither a ROOT object nor a recognised "
536  << "simple object.\n";
537  continue;
538  }
539 
540  if (!iLumiOnly) {
541  // remove ME after copy to EDM is done.
542  if (deleteAfterCopy)
543  dbe->removeElement(me->getPathname(),me->getName());
544  }
545 
546  } // end loop through monitor elements
547 
548  std::string sName;
549 
550  if (iLumiOnly) {
551  sName = fName + "Lumi";
552  } else {
553  sName = fName + "Run";
554  }
555 
556  // produce objects to put in events
557  iPutTo.put(std::move(pOutInt),sName);
558  iPutTo.put(std::move(pOutDouble),sName);
559  iPutTo.put(std::move(pOutString),sName);
560  iPutTo.put(std::move(pOut1),sName);
561  iPutTo.put(std::move(pOut1s),sName);
562  iPutTo.put(std::move(pOut1d),sName);
563  iPutTo.put(std::move(pOut2),sName);
564  iPutTo.put(std::move(pOut2s),sName);
565  iPutTo.put(std::move(pOut2d),sName);
566  iPutTo.put(std::move(pOut3),sName);
567  iPutTo.put(std::move(pOutProf),sName);
568  iPutTo.put(std::move(pOutProf2),sName);
569 
570 }
TH2S * getTH2S(void) const
TH1S * getTH1S(void) const
const std::string & getName(void) const
get name of ME
TProfile2D * getTProfile2D(void) const
TH3F * getTH3F(void) const
TH1D * getTH1D(void) const
TH2D * getTH2D(void) const
bool getLumiFlag(void) const
true if ME is meant to be stored for each luminosity section
const std::string & getPathname(void) const
get pathname of parent folder
DQMNet::TagList getTags(void) const
double getFloatValue(void) const
Kind kind(void) const
Get the type of the monitor element.
const std::string getFullname(void) const
get full name of ME including Pathname
const std::string & getStringValue(void) const
int64_t getIntValue(void) const
TH1F * getTH1F(void) const
TProfile * getTProfile(void) const
TH2F * getTH2F(void) const
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

DQMStore* MEtoEDMConverter::dbe
private

Definition at line 84 of file MEtoEDMConverter.h.

Referenced by beginJob(), beginRun(), endJob(), endRunProduce(), MEtoEDMConverter(), and putData().

bool MEtoEDMConverter::deleteAfterCopy
private

Definition at line 80 of file MEtoEDMConverter.h.

Referenced by MEtoEDMConverter(), and putData().

bool MEtoEDMConverter::enableMultiThread_
private

Definition at line 81 of file MEtoEDMConverter.h.

Referenced by beginJob(), beginRun(), MEtoEDMConverter(), and putData().

std::string MEtoEDMConverter::fName
private

Definition at line 77 of file MEtoEDMConverter.h.

Referenced by MEtoEDMConverter(), and putData().

int MEtoEDMConverter::frequency
private

Definition at line 79 of file MEtoEDMConverter.h.

Referenced by beginRun(), and MEtoEDMConverter().

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

Definition at line 87 of file MEtoEDMConverter.h.

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

std::string MEtoEDMConverter::path
private
int MEtoEDMConverter::verbosity
private

Definition at line 78 of file MEtoEDMConverter.h.

Referenced by beginRun(), endJob(), MEtoEDMConverter(), and putData().