13 #include "classlib/utils/StringList.h"
14 #include "classlib/utils/StringOps.h"
21 std::string MsgLoggerCat =
"MEtoEDMConverter_MEtoEDMConverter";
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";
53 sName =
fName +
"Run";
61 produces<MEtoEDM<TProfile>,
edm::InRun>(sName);
62 produces<MEtoEDM<TProfile2D>,
edm::InRun>(sName);
64 produces<MEtoEDM<long long>,
edm::InRun>(sName);
67 sName =
fName +
"Lumi";
83 assert(
sizeof(int64_t) ==
sizeof(
long long));
95 enableMultiThread_ = dbe->enableMultiThread_;
101 std::string MsgLoggerCat =
"MEtoEDMConverter_endJob";
116 unsigned nTProfile = 0;
117 unsigned nTProfile2D = 0;
118 unsigned nDouble = 0;
120 unsigned nString = 0;
125 std::vector<MonitorElement *>::iterator mmi, mme;
126 std::vector<MonitorElement *>
items(dbe->getAllContents(
""));
128 for (mmi =
items.begin (), mme =
items.end (); mmi != mme; ++mmi) {
143 std::cout <<
" scalar: " << tobj->GetName() <<
": Int64\n";
149 std::cout <<
" scalar: " << tobj->GetName() <<
": Double\n";
155 std::cout <<
" scalar: " << tobj->GetName() <<
": String\n";
161 std::cout <<
" normal: " << tobj->GetName() <<
": TH1F\n";
167 std::cout <<
" normal: " << tobj->GetName() <<
": TH1S\n";
173 std::cout <<
" normal: " << tobj->GetName() <<
": TH1D\n";
179 std::cout <<
" normal: " << tobj->GetName() <<
": TH2F\n";
185 std::cout <<
" normal: " << tobj->GetName() <<
": TH2S\n";
191 std::cout <<
" normal: " << tobj->GetName() <<
": TH2D\n";
197 std::cout <<
" normal: " << tobj->GetName() <<
": TH3F\n";
203 std::cout <<
" normal: " << tobj->GetName() <<
": TProfile\n";
209 std::cout <<
" normal: " << tobj->GetName() <<
": TProfile2D\n";
215 <<
"' is neither a ROOT object nor a recognised "
216 <<
"simple object.\n";
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
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;
247 <<
"Terminating having processed " << iCount.size() <<
" runs.";
254 std::string MsgLoggerCat =
"MEtoEDMConverter_beginRun";
259 if (enableMultiThread_)
262 int nrun = iRun.
run();
269 <<
"Processing run " << nrun <<
" (" << iCount.size() <<
" runs total)";
271 if (nrun%frequency == 0 || iCount.size() == 1) {
273 <<
"Processing run " << nrun <<
" (" << iCount.size() <<
" runs total)";
278 std::vector<MonitorElement *>::iterator mmi, mme;
279 std::vector<MonitorElement *>
items(dbe->getAllContents(
path));
281 for (mmi =
items.begin (), mme =
items.end (); mmi != mme; ++mmi) {
335 <<
"' is neither a ROOT object nor a recognised "
336 <<
"simple object.\n";
350 dbe->scaleElements();
351 putData(iRun,
false, iRun.
run(), 0);
367 std::string MsgLoggerCat =
"MEtoEDMConverter_putData";
370 edm::LogInfo (MsgLoggerCat) <<
"\nStoring MEtoEDM dataformat histograms.";
373 std::vector<MonitorElement *>::iterator mmi, mme;
374 std::vector<MonitorElement *>
items(dbe->getAllContents(
path,
375 enableMultiThread_ ? run : 0,
376 enableMultiThread_ ? lumi : 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;
391 for (mmi =
items.begin (), mme =
items.end (); mmi != mme; ++mmi) {
453 <<
"' is neither a ROOT object nor a recognised "
454 <<
"simple object.\n";
460 std::auto_ptr<MEtoEDM<double> > pOutDouble(
new MEtoEDM<double>(nDouble));
463 std::auto_ptr<MEtoEDM<TH1S> > pOut1s(
new MEtoEDM<TH1S>(n1S));
464 std::auto_ptr<MEtoEDM<TH1D> > pOut1d(
new MEtoEDM<TH1D>(n1D));
466 std::auto_ptr<MEtoEDM<TH2S> > pOut2s(
new MEtoEDM<TH2S>(n2S));
467 std::auto_ptr<MEtoEDM<TH2D> > pOut2d(
new MEtoEDM<TH2D>(n2D));
472 for (mmi =
items.begin (), mme =
items.end (); mmi != mme; ++mmi) {
535 <<
"' is neither a ROOT object nor a recognised "
536 <<
"simple object.\n";
551 sName =
fName +
"Lumi";
553 sName =
fName +
"Run";
557 iPutTo.put(pOutInt,sName);
558 iPutTo.put(pOutDouble,sName);
559 iPutTo.put(pOutString,sName);
560 iPutTo.put(pOut1,sName);
561 iPutTo.put(pOut1s,sName);
562 iPutTo.put(pOut1d,sName);
563 iPutTo.put(pOut2,sName);
564 iPutTo.put(pOut2s,sName);
565 iPutTo.put(pOut2d,sName);
566 iPutTo.put(pOut3,sName);
567 iPutTo.put(pOutProf,sName);
568 iPutTo.put(pOutProf2,sName);
LuminosityBlockID id() const
TH2S * getTH2S(void) const
TH1S * getTH1S(void) const
T getUntrackedParameter(std::string const &, T const &) 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
virtual void endRunProduce(edm::Run &, const edm::EventSetup &) override
virtual void beginJob() override
std::map< int, int > iCount
virtual void produce(edm::Event &, const edm::EventSetup &) override
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
virtual ~MEtoEDMConverter()
DQMNet::TagList getTags(void) const
double getFloatValue(void) const
virtual void endRun(edm::Run const &, const edm::EventSetup &) override
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
TObject * getRootObject(void) const
int64_t getIntValue(void) const
TH1F * getTH1F(void) const
LuminosityBlockNumber_t luminosityBlock() const
virtual void endJob() override
TProfile * getTProfile(void) const
volatile std::atomic< bool > shutdown_flag false
MEtoEDMConverter(const edm::ParameterSet &)
void putData(T &iPutTo, bool iLumiOnly, uint32_t run, uint32_t lumi)
virtual void beginRun(edm::Run const &, const edm::EventSetup &) override
TH2F * getTH2F(void) const
void Reset(void)
reset ME (ie. contents, errors, etc)
virtual void endLuminosityBlockProduce(edm::LuminosityBlock &, const edm::EventSetup &) override