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
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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 53 of file MEtoEDMConverter.h.

Member Typedef Documentation

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

Definition at line 71 of file MEtoEDMConverter.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file MEtoEDMConverter.cc.

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

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

Definition at line 89 of file MEtoEDMConverter.cc.

90 {
91 }

Member Function Documentation

void MEtoEDMConverter::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 94 of file MEtoEDMConverter.cc.

References dbe, and enableMultiThread_.

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

Definition at line 254 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.

255 {
256  std::string MsgLoggerCat = "MEtoEDMConverter_beginRun";
257 
258  // No need to do any reset in the MultiThread DQM, since we will
259  // index each and every MonitorElement by Run and Lumi.
260 
261  if (enableMultiThread_)
262  return;
263 
264  int nrun = iRun.run();
265 
266  // keep track of number of runs processed
267  ++iCount[nrun];
268 
269  if (verbosity > 0) { // keep track of number of runs processed
270  edm::LogInfo(MsgLoggerCat)
271  << "Processing run " << nrun << " (" << iCount.size() << " runs total)";
272  } else if (verbosity == 0) {
273  if (nrun%frequency == 0 || iCount.size() == 1) {
274  edm::LogInfo(MsgLoggerCat)
275  << "Processing run " << nrun << " (" << iCount.size() << " runs total)";
276  }
277  }
278 
279  // clear contents of monitor elements
280  std::vector<MonitorElement *>::iterator mmi, mme;
281  std::vector<MonitorElement *> items(dbe->getAllContents(path));
282 
283  for (mmi = items.begin (), mme = items.end (); mmi != mme; ++mmi) {
284 
285  MonitorElement *me = *mmi;
286 
287  switch (me->kind())
288  {
290  break;
291 
293  break;
294 
296  break;
297 
299  me->Reset();
300  break;
301 
303  me->Reset();
304  break;
305 
307  me->Reset();
308  break;
309 
311  me->Reset();
312  break;
313 
315  me->Reset();
316  break;
317 
319  me->Reset();
320  break;
321 
323  me->Reset();
324  break;
325 
327  me->Reset();
328  break;
329 
331  me->Reset();
332  break;
333 
334  default:
335  edm::LogError(MsgLoggerCat)
336  << "ERROR: The DQM object '" << me->getFullname()
337  << "' is neither a ROOT object nor a recognised "
338  << "simple object.\n";
339  continue;
340  }
341 
342  } // end loop through monitor elements
343 }
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 101 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.

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

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

358 {
359  putData(iLumi, true, iLumi.run(), iLumi.id().luminosityBlock());
360 }
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 345 of file MEtoEDMConverter.cc.

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

Definition at line 350 of file MEtoEDMConverter.cc.

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

351 {
352  dbe->scaleElements();
353  putData(iRun, false, iRun.run(), 0);
354 }
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 364 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().

368 {
369  std::string MsgLoggerCat = "MEtoEDMConverter_putData";
370 
371  if (verbosity > 0)
372  edm::LogInfo (MsgLoggerCat) << "\nStoring MEtoEDM dataformat histograms.";
373 
374  // extract ME information into vectors
375  std::vector<MonitorElement *>::iterator mmi, mme;
376  std::vector<MonitorElement *> items(dbe->getAllContents(path,
377  enableMultiThread_ ? run : 0,
378  enableMultiThread_ ? lumi : 0));
379 
380  unsigned int n1F=0;
381  unsigned int n1S=0;
382  unsigned int n1D=0;
383  unsigned int n2F=0;
384  unsigned int n2S=0;
385  unsigned int n2D=0;
386  unsigned int n3F=0;
387  unsigned int nProf=0;
388  unsigned int nProf2=0;
389  unsigned int nDouble=0;
390  unsigned int nInt64=0;
391  unsigned int nString=0;
392 
393  for (mmi = items.begin (), mme = items.end (); mmi != mme; ++mmi) {
394 
395  MonitorElement *me = *mmi;
396 
397  // store only flagged ME at endLumi transition, and Run-based
398  // histo at endRun transition
399  if (iLumiOnly && !me->getLumiFlag()) continue;
400  if (!iLumiOnly && me->getLumiFlag()) continue;
401 
402  switch (me->kind())
403  {
405  ++nInt64;
406  break;
407 
409  ++nDouble;
410  break;
411 
413  ++nString;
414  break;
415 
417  ++n1F;
418  break;
419 
421  ++n1S;
422  break;
423 
425  ++n1D;
426  break;
427 
429  ++n2F;
430  break;
431 
433  ++n2S;
434  break;
435 
437  ++n2D;
438  break;
439 
441  ++n3F;
442  break;
443 
445  ++nProf;
446  break;
447 
449  ++nProf2;
450  break;
451 
452  default:
453  edm::LogError(MsgLoggerCat)
454  << "ERROR: The DQM object '" << me->getFullname()
455  << "' is neither a ROOT object nor a recognised "
456  << "simple object.\n";
457  continue;
458  }
459  }
460 
461  std::unique_ptr<MEtoEDM<long long> > pOutInt(new MEtoEDM<long long>(nInt64));
462  std::unique_ptr<MEtoEDM<double> > pOutDouble(new MEtoEDM<double>(nDouble));
463  std::unique_ptr<MEtoEDM<TString> > pOutString(new MEtoEDM<TString>(nString));
464  std::unique_ptr<MEtoEDM<TH1F> > pOut1(new MEtoEDM<TH1F>(n1F));
465  std::unique_ptr<MEtoEDM<TH1S> > pOut1s(new MEtoEDM<TH1S>(n1S));
466  std::unique_ptr<MEtoEDM<TH1D> > pOut1d(new MEtoEDM<TH1D>(n1D));
467  std::unique_ptr<MEtoEDM<TH2F> > pOut2(new MEtoEDM<TH2F>(n2F));
468  std::unique_ptr<MEtoEDM<TH2S> > pOut2s(new MEtoEDM<TH2S>(n2S));
469  std::unique_ptr<MEtoEDM<TH2D> > pOut2d(new MEtoEDM<TH2D>(n2D));
470  std::unique_ptr<MEtoEDM<TH3F> > pOut3(new MEtoEDM<TH3F>(n3F));
471  std::unique_ptr<MEtoEDM<TProfile> > pOutProf(new MEtoEDM<TProfile>(nProf));
472  std::unique_ptr<MEtoEDM<TProfile2D> > pOutProf2(new MEtoEDM<TProfile2D>(nProf2));
473 
474  for (mmi = items.begin (), mme = items.end (); mmi != mme; ++mmi) {
475 
476  MonitorElement *me = *mmi;
477 
478  // store only flagged ME at endLumi transition, and Run-based
479  // histo at endRun transition
480  if (iLumiOnly && !me->getLumiFlag()) continue;
481  if (!iLumiOnly && me->getLumiFlag()) continue;
482 
483  // get monitor elements
484  switch (me->kind())
485  {
487  pOutInt->putMEtoEdmObject(me->getFullname(),me->getTags(),me->getIntValue());
488  break;
489 
491  pOutDouble->putMEtoEdmObject(me->getFullname(),me->getTags(),me->getFloatValue());
492  break;
493 
495  pOutString->putMEtoEdmObject(me->getFullname(),me->getTags(),me->getStringValue());
496  break;
497 
499  pOut1->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH1F());
500  break;
501 
503  pOut1s->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH1S());
504  break;
505 
507  pOut1d->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH1D());
508  break;
509 
511  pOut2->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH2F());
512  break;
513 
515  pOut2s->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH2S());
516  break;
517 
519  pOut2d->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH2D());
520  break;
521 
523  pOut3->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTH3F());
524  break;
525 
527  pOutProf->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTProfile());
528  break;
529 
531  pOutProf2->putMEtoEdmObject(me->getFullname(),me->getTags(),*me->getTProfile2D());
532  break;
533 
534  default:
535  edm::LogError(MsgLoggerCat)
536  << "ERROR: The DQM object '" << me->getFullname()
537  << "' is neither a ROOT object nor a recognised "
538  << "simple object.\n";
539  continue;
540  }
541 
542  if (!iLumiOnly) {
543  // remove ME after copy to EDM is done.
544  if (deleteAfterCopy)
545  dbe->removeElement(me->getPathname(),me->getName());
546  }
547 
548  } // end loop through monitor elements
549 
550  std::string sName;
551 
552  if (iLumiOnly) {
553  sName = fName + "Lumi";
554  } else {
555  sName = fName + "Run";
556  }
557 
558  // produce objects to put in events
559  iPutTo.put(std::move(pOutInt),sName);
560  iPutTo.put(std::move(pOutDouble),sName);
561  iPutTo.put(std::move(pOutString),sName);
562  iPutTo.put(std::move(pOut1),sName);
563  iPutTo.put(std::move(pOut1s),sName);
564  iPutTo.put(std::move(pOut1d),sName);
565  iPutTo.put(std::move(pOut2),sName);
566  iPutTo.put(std::move(pOut2s),sName);
567  iPutTo.put(std::move(pOut2d),sName);
568  iPutTo.put(std::move(pOut3),sName);
569  iPutTo.put(std::move(pOutProf),sName);
570  iPutTo.put(std::move(pOutProf2),sName);
571 
572 }
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 81 of file MEtoEDMConverter.h.

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

bool MEtoEDMConverter::deleteAfterCopy
private

Definition at line 77 of file MEtoEDMConverter.h.

Referenced by MEtoEDMConverter(), and putData().

bool MEtoEDMConverter::enableMultiThread_
private

Definition at line 78 of file MEtoEDMConverter.h.

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

std::string MEtoEDMConverter::fName
private

Definition at line 74 of file MEtoEDMConverter.h.

Referenced by MEtoEDMConverter(), and putData().

int MEtoEDMConverter::frequency
private

Definition at line 76 of file MEtoEDMConverter.h.

Referenced by beginRun(), and MEtoEDMConverter().

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

Definition at line 84 of file MEtoEDMConverter.h.

Referenced by beginRun(), and endJob().

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

Definition at line 75 of file MEtoEDMConverter.h.

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