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
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 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)
 
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
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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_, fName, frequency, edm::ParameterSet::getUntrackedParameter(), iCount, edm::InLumi, edm::InRun, cppFunctionSkipper::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_ = iPSet.getUntrackedParameter<bool>("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
47  dbe = 0;
49 
50  std::string sName;
51 
52  // create persistent objects
53 
54  sName = fName + "Run";
55  produces<MEtoEDM<TH1F>, edm::InRun>(sName);
56  produces<MEtoEDM<TH1S>, edm::InRun>(sName);
57  produces<MEtoEDM<TH1D>, edm::InRun>(sName);
58  produces<MEtoEDM<TH2F>, edm::InRun>(sName);
59  produces<MEtoEDM<TH2S>, edm::InRun>(sName);
60  produces<MEtoEDM<TH2D>, edm::InRun>(sName);
61  produces<MEtoEDM<TH3F>, edm::InRun>(sName);
62  produces<MEtoEDM<TProfile>, edm::InRun>(sName);
63  produces<MEtoEDM<TProfile2D>, edm::InRun>(sName);
64  produces<MEtoEDM<double>, edm::InRun>(sName);
65  produces<MEtoEDM<long long>, edm::InRun>(sName);
66  produces<MEtoEDM<TString>, edm::InRun>(sName);
67 
68  sName = fName + "Lumi";
69  produces<MEtoEDM<TH1F>, edm::InLumi>(sName);
70  produces<MEtoEDM<TH1S>, edm::InLumi>(sName);
71  produces<MEtoEDM<TH1D>, edm::InLumi>(sName);
72  produces<MEtoEDM<TH2F>, edm::InLumi>(sName);
73  produces<MEtoEDM<TH2S>, edm::InLumi>(sName);
74  produces<MEtoEDM<TH2D>, edm::InLumi>(sName);
75  produces<MEtoEDM<TH3F>, edm::InLumi>(sName);
76  produces<MEtoEDM<TProfile>, edm::InLumi>(sName);
77  produces<MEtoEDM<TProfile2D>, edm::InLumi>(sName);
78  produces<MEtoEDM<double>, edm::InLumi>(sName);
79  produces<MEtoEDM<long long>, edm::InLumi>(sName);
80  produces<MEtoEDM<TString>, edm::InLumi>(sName);
81 
82  iCount.clear();
83 
84  assert(sizeof(int64_t) == sizeof(long long));
85 
86 }
T getUntrackedParameter(std::string const &, T const &) const
std::map< int, int > iCount
MEtoEDMConverter::~MEtoEDMConverter ( )
virtual

Definition at line 88 of file MEtoEDMConverter.cc.

89 {
90 }

Member Function Documentation

void MEtoEDMConverter::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 93 of file MEtoEDMConverter.cc.

94 {
95 }
void MEtoEDMConverter::beginRun ( edm::Run const &  iRun,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 251 of file MEtoEDMConverter.cc.

References 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::kind(), getHLTPrescaleColumns::path, MonitorElement::Reset(), edm::RunBase::run(), AlCaHLTBitMon_QueryRunRegistry::string, and PFRecoTauDiscriminationAgainstMuon2_cfi::verbosity.

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

References gather_cfg::cout, 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(), reco::if(), MonitorElement::kind(), split, AlCaHLTBitMon_QueryRunRegistry::string, and PFRecoTauDiscriminationAgainstMuon2_cfi::verbosity.

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

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

355 {
356  putData(iLumi, true, iLumi.run(), iLumi.id().luminosityBlock());
357 }
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 342 of file MEtoEDMConverter.cc.

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

Definition at line 347 of file MEtoEDMConverter.cc.

References edm::RunBase::run().

348 {
349  dbe->scaleElements();
350  putData(iRun, false, iRun.run(), 0);
351 }
RunNumber_t run() const
Definition: RunBase.h:42
void scaleElements(void)
Definition: DQMStore.cc:2999
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 
)
template<class T >
void MEtoEDMConverter::putData ( T iPutTo,
bool  iLumiOnly,
uint32_t  run,
uint32_t  lumi 
)

Definition at line 361 of file MEtoEDMConverter.cc.

References 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::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(), MonitorElement::kind(), getHLTPrescaleColumns::path, AlCaHLTBitMon_QueryRunRegistry::string, and PFRecoTauDiscriminationAgainstMuon2_cfi::verbosity.

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

Member Data Documentation

DQMStore* MEtoEDMConverter::dbe
private

Definition at line 84 of file MEtoEDMConverter.h.

Referenced by MEtoEDMConverter().

bool MEtoEDMConverter::deleteAfterCopy
private

Definition at line 80 of file MEtoEDMConverter.h.

Referenced by MEtoEDMConverter().

bool MEtoEDMConverter::enableMultiThread_
private

Definition at line 81 of file MEtoEDMConverter.h.

Referenced by MEtoEDMConverter().

std::string MEtoEDMConverter::fName
private

Definition at line 77 of file MEtoEDMConverter.h.

Referenced by MEtoEDMConverter().

int MEtoEDMConverter::frequency
private

Definition at line 79 of file MEtoEDMConverter.h.

Referenced by MEtoEDMConverter().

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

Definition at line 87 of file MEtoEDMConverter.h.

Referenced by MEtoEDMConverter().

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

Definition at line 78 of file MEtoEDMConverter.h.

Referenced by MEtoEDMConverter().