00001
00010 #include <cassert>
00011
00012 #include "DQMServices/Components/plugins/EDMtoMEConverter.h"
00013
00014 using namespace lat;
00015
00016 EDMtoMEConverter::EDMtoMEConverter(const edm::ParameterSet & iPSet) :
00017 verbosity(0), frequency(0)
00018 {
00019 std::string MsgLoggerCat = "EDMtoMEConverter_EDMtoMEConverter";
00020
00021
00022 name = iPSet.getUntrackedParameter<std::string>("Name");
00023 verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
00024 frequency = iPSet.getUntrackedParameter<int>("Frequency");
00025
00026 convertOnEndLumi = iPSet.getUntrackedParameter<bool>("convertOnEndLumi",true);
00027 convertOnEndRun = iPSet.getUntrackedParameter<bool>("convertOnEndRun",true);
00028
00029
00030
00031 verbosity %= 10;
00032
00033
00034 dbe = 0;
00035 dbe = edm::Service<DQMStore>().operator->();
00036
00037
00038 if (verbosity >= 0) {
00039 edm::LogInfo(MsgLoggerCat)
00040 << "\n===============================\n"
00041 << "Initialized as EDAnalyzer with parameter values:\n"
00042 << " Name = " << name << "\n"
00043 << " Verbosity = " << verbosity << "\n"
00044 << " Frequency = " << frequency << "\n"
00045 << "===============================\n";
00046 }
00047
00048 classtypes.clear();
00049 classtypes.push_back("TH1F");
00050 classtypes.push_back("TH1S");
00051 classtypes.push_back("TH1D");
00052 classtypes.push_back("TH2F");
00053 classtypes.push_back("TH2S");
00054 classtypes.push_back("TH2D");
00055 classtypes.push_back("TH3F");
00056 classtypes.push_back("TProfile");
00057 classtypes.push_back("TProfile2D");
00058 classtypes.push_back("Double");
00059 classtypes.push_back("Int");
00060 classtypes.push_back("Int64");
00061 classtypes.push_back("String");
00062
00063 iCountf = 0;
00064 iCount.clear();
00065
00066 assert(sizeof(int64_t) == sizeof(long long));
00067
00068 }
00069
00070 EDMtoMEConverter::~EDMtoMEConverter() {}
00071
00072 void EDMtoMEConverter::beginJob()
00073 {
00074 }
00075
00076 void EDMtoMEConverter::endJob()
00077 {
00078 std::string MsgLoggerCat = "EDMtoMEConverter_endJob";
00079 if (verbosity >= 0)
00080 edm::LogInfo(MsgLoggerCat)
00081 << "Terminating having processed " << iCount.size() << " runs across "
00082 << iCountf << " files.";
00083 return;
00084 }
00085
00086 void EDMtoMEConverter::respondToOpenInputFile(const edm::FileBlock& iFb)
00087 {
00088 ++iCountf;
00089 return;
00090 }
00091
00092 void EDMtoMEConverter::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup)
00093 {
00094 std::string MsgLoggerCat = "EDMtoMEConverter_beginRun";
00095
00096 int nrun = iRun.run();
00097
00098
00099 ++iCount[nrun];
00100
00101 if (verbosity > 0) {
00102 edm::LogInfo(MsgLoggerCat)
00103 << "Processing run " << nrun << " (" << iCount.size() << " runs total)";
00104 } else if (verbosity == 0) {
00105 if (nrun%frequency == 0 || iCount.size() == 1) {
00106 edm::LogInfo(MsgLoggerCat)
00107 << "Processing run " << nrun << " (" << iCount.size() << " runs total)";
00108 }
00109 }
00110
00111 }
00112
00113 void EDMtoMEConverter::endRun(const edm::Run& iRun, const edm::EventSetup& iSetup)
00114 {
00115 if (convertOnEndRun) {
00116 getData(iRun, true);
00117 }
00118 }
00119
00120 void EDMtoMEConverter::beginLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& iSetup)
00121 {
00122 }
00123
00124 void EDMtoMEConverter::endLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& iSetup)
00125 {
00126 if (convertOnEndLumi) {
00127 getData(iLumi, false);
00128 }
00129 }
00130
00131 void EDMtoMEConverter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00132 {
00133 }
00134
00135 template <class T>
00136 void
00137 EDMtoMEConverter::getData(T& iGetFrom, bool iEndRun)
00138 {
00139 std::string MsgLoggerCat = "EDMtoMEConverter_getData";
00140
00141 if (verbosity >= 0)
00142 edm::LogInfo (MsgLoggerCat) << "\nRestoring MonitorElements.";
00143
00144 for (unsigned int ii = 0; ii < classtypes.size(); ++ii) {
00145
00146 if (classtypes[ii] == "TH1F") {
00147 edm::Handle<MEtoEDM<TH1F> > metoedm;
00148 iGetFrom.getByType(metoedm);
00149
00150 if (!metoedm.isValid()) {
00151
00152
00153 continue;
00154 }
00155
00156 std::vector<MEtoEDM<TH1F>::MEtoEDMObject> metoedmobject =
00157 metoedm->getMEtoEdmObject();
00158
00159 me1.resize(metoedmobject.size());
00160
00161 for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
00162
00163 me1[i] = 0;
00164
00165
00166 std::string pathname = metoedmobject[i].name;
00167 if (verbosity > 0) std::cout << pathname << std::endl;
00168
00169 std::string dir;
00170
00171
00172 StringList fulldir = StringOps::split(pathname,"/");
00173
00174 for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
00175 dir += fulldir[j];
00176 if (j != fulldir.size() - 2) dir += "/";
00177 }
00178
00179
00180 if (dbe) {
00181 me1[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
00182 if (me1[i] && me1[i]->getTH1F() && me1[i]->getTH1F()->TestBit(TH1::kCanRebin) == true) {
00183 TList list;
00184 list.Add(&metoedmobject[i].object);
00185 if (me1[i]->getTH1F()->Merge(&list) == -1)
00186 std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
00187 << metoedmobject[i].object.GetName() << "'" << std::endl;
00188 } else {
00189 dbe->setCurrentFolder(dir);
00190 me1[i] = dbe->book1D(metoedmobject[i].object.GetName(),
00191 &metoedmobject[i].object);
00192 }
00193 if (!iEndRun) me1[i]->setLumiFlag();
00194 }
00195
00196
00197 TagList tags = metoedmobject[i].tags;
00198
00199 for (unsigned int j = 0; j < tags.size(); ++j) {
00200 dbe->tag(me1[i]->getFullname(),tags[j]);
00201 }
00202 }
00203 }
00204
00205 if (classtypes[ii] == "TH1S") {
00206 edm::Handle<MEtoEDM<TH1S> > metoedm;
00207 iGetFrom.getByType(metoedm);
00208
00209 if (!metoedm.isValid()) {
00210
00211
00212 continue;
00213 }
00214
00215 std::vector<MEtoEDM<TH1S>::MEtoEDMObject> metoedmobject =
00216 metoedm->getMEtoEdmObject();
00217
00218 me1.resize(metoedmobject.size());
00219
00220 for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
00221
00222 me1[i] = 0;
00223
00224
00225 std::string pathname = metoedmobject[i].name;
00226 if (verbosity > 0) std::cout << pathname << std::endl;
00227
00228 std::string dir;
00229
00230
00231 StringList fulldir = StringOps::split(pathname,"/");
00232
00233 for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
00234 dir += fulldir[j];
00235 if (j != fulldir.size() - 2) dir += "/";
00236 }
00237
00238
00239 if (dbe) {
00240 me1[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
00241 if (me1[i] && me1[i]->getTH1S() && me1[i]->getTH1S()->TestBit(TH1::kCanRebin) == true) {
00242 TList list;
00243 list.Add(&metoedmobject[i].object);
00244 if (me1[i]->getTH1S()->Merge(&list) == -1)
00245 std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
00246 << metoedmobject[i].object.GetName() << "'" << std::endl;
00247 } else {
00248 dbe->setCurrentFolder(dir);
00249 me1[i] = dbe->book1S(metoedmobject[i].object.GetName(),
00250 &metoedmobject[i].object);
00251 }
00252 if (!iEndRun) me1[i]->setLumiFlag();
00253 }
00254
00255
00256 TagList tags = metoedmobject[i].tags;
00257
00258 for (unsigned int j = 0; j < tags.size(); ++j) {
00259 dbe->tag(me1[i]->getFullname(),tags[j]);
00260 }
00261 }
00262 }
00263
00264 if (classtypes[ii] == "TH1D") {
00265 edm::Handle<MEtoEDM<TH1D> > metoedm;
00266 iGetFrom.getByType(metoedm);
00267
00268 if (!metoedm.isValid()) {
00269
00270
00271 continue;
00272 }
00273
00274 std::vector<MEtoEDM<TH1D>::MEtoEDMObject> metoedmobject =
00275 metoedm->getMEtoEdmObject();
00276
00277 me1.resize(metoedmobject.size());
00278
00279 for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
00280
00281 me1[i] = 0;
00282
00283
00284 std::string pathname = metoedmobject[i].name;
00285 if (verbosity > 0) std::cout << pathname << std::endl;
00286
00287 std::string dir;
00288
00289
00290 StringList fulldir = StringOps::split(pathname,"/");
00291
00292 for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
00293 dir += fulldir[j];
00294 if (j != fulldir.size() - 2) dir += "/";
00295 }
00296
00297
00298 if (dbe) {
00299 me1[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
00300 if (me1[i] && me1[i]->getTH1D() && me1[i]->getTH1D()->TestBit(TH1::kCanRebin) == true) {
00301 TList list;
00302 list.Add(&metoedmobject[i].object);
00303 if (me1[i]->getTH1D()->Merge(&list) == -1)
00304 std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
00305 << metoedmobject[i].object.GetName() << "'" << std::endl;
00306 } else {
00307 dbe->setCurrentFolder(dir);
00308 me1[i] = dbe->book1DD(metoedmobject[i].object.GetName(),
00309 &metoedmobject[i].object);
00310 }
00311 if (!iEndRun) me1[i]->setLumiFlag();
00312 }
00313
00314
00315 TagList tags = metoedmobject[i].tags;
00316
00317 for (unsigned int j = 0; j < tags.size(); ++j) {
00318 dbe->tag(me1[i]->getFullname(),tags[j]);
00319 }
00320 }
00321 }
00322
00323 if (classtypes[ii] == "TH2F") {
00324 edm::Handle<MEtoEDM<TH2F> > metoedm;
00325 iGetFrom.getByType(metoedm);
00326
00327 if (!metoedm.isValid()) {
00328
00329
00330 continue;
00331 }
00332
00333 std::vector<MEtoEDM<TH2F>::MEtoEDMObject> metoedmobject =
00334 metoedm->getMEtoEdmObject();
00335
00336 me2.resize(metoedmobject.size());
00337
00338 for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
00339
00340 me2[i] = 0;
00341
00342
00343 std::string pathname = metoedmobject[i].name;
00344 if (verbosity > 0) std::cout << pathname << std::endl;
00345
00346 std::string dir;
00347
00348
00349 StringList fulldir = StringOps::split(pathname,"/");
00350
00351 for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
00352 dir += fulldir[j];
00353 if (j != fulldir.size() - 2) dir += "/";
00354 }
00355
00356
00357 if (dbe) {
00358 me2[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
00359 if (me2[i] && me2[i]->getTH2F() && me2[i]->getTH2F()->TestBit(TH1::kCanRebin) == true) {
00360 TList list;
00361 list.Add(&metoedmobject[i].object);
00362 if (me2[i]->getTH2F()->Merge(&list) == -1)
00363 std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
00364 << metoedmobject[i].object.GetName() << "'" << std::endl;
00365 } else {
00366 dbe->setCurrentFolder(dir);
00367 me2[i] = dbe->book2D(metoedmobject[i].object.GetName(),
00368 &metoedmobject[i].object);
00369 }
00370 if (!iEndRun) me2[i]->setLumiFlag();
00371 }
00372
00373
00374 TagList tags = metoedmobject[i].tags;
00375
00376 for (unsigned int j = 0; j < tags.size(); ++j) {
00377 dbe->tag(me2[i]->getFullname(),tags[j]);
00378 }
00379 }
00380 }
00381
00382 if (classtypes[ii] == "TH2S") {
00383 edm::Handle<MEtoEDM<TH2S> > metoedm;
00384 iGetFrom.getByType(metoedm);
00385
00386 if (!metoedm.isValid()) {
00387
00388
00389 continue;
00390 }
00391
00392 std::vector<MEtoEDM<TH2S>::MEtoEDMObject> metoedmobject =
00393 metoedm->getMEtoEdmObject();
00394
00395 me2.resize(metoedmobject.size());
00396
00397 for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
00398
00399 me2[i] = 0;
00400
00401
00402 std::string pathname = metoedmobject[i].name;
00403 if (verbosity > 0) std::cout << pathname << std::endl;
00404
00405 std::string dir;
00406
00407
00408 StringList fulldir = StringOps::split(pathname,"/");
00409
00410 for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
00411 dir += fulldir[j];
00412 if (j != fulldir.size() - 2) dir += "/";
00413 }
00414
00415
00416 if (dbe) {
00417 me2[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
00418 if (me2[i] && me2[i]->getTH2S() && me2[i]->getTH2S()->TestBit(TH1::kCanRebin) == true) {
00419 TList list;
00420 list.Add(&metoedmobject[i].object);
00421 if (me2[i]->getTH2S()->Merge(&list) == -1)
00422 std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
00423 << metoedmobject[i].object.GetName() << "'" << std::endl;
00424 } else {
00425 dbe->setCurrentFolder(dir);
00426 me2[i] = dbe->book2S(metoedmobject[i].object.GetName(),
00427 &metoedmobject[i].object);
00428 }
00429 if (!iEndRun) me2[i]->setLumiFlag();
00430 }
00431
00432
00433 TagList tags = metoedmobject[i].tags;
00434
00435 for (unsigned int j = 0; j < tags.size(); ++j) {
00436 dbe->tag(me2[i]->getFullname(),tags[j]);
00437 }
00438 }
00439 }
00440
00441 if (classtypes[ii] == "TH2D") {
00442 edm::Handle<MEtoEDM<TH2D> > metoedm;
00443 iGetFrom.getByType(metoedm);
00444
00445 if (!metoedm.isValid()) {
00446
00447
00448 continue;
00449 }
00450
00451 std::vector<MEtoEDM<TH2D>::MEtoEDMObject> metoedmobject =
00452 metoedm->getMEtoEdmObject();
00453
00454 me2.resize(metoedmobject.size());
00455
00456 for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
00457
00458 me2[i] = 0;
00459
00460
00461 std::string pathname = metoedmobject[i].name;
00462 if (verbosity > 0) std::cout << pathname << std::endl;
00463
00464 std::string dir;
00465
00466
00467 StringList fulldir = StringOps::split(pathname,"/");
00468
00469 for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
00470 dir += fulldir[j];
00471 if (j != fulldir.size() - 2) dir += "/";
00472 }
00473
00474
00475 if (dbe) {
00476 me2[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
00477 if (me2[i] && me2[i]->getTH2D() && me2[i]->getTH2D()->TestBit(TH1::kCanRebin) == true) {
00478 TList list;
00479 list.Add(&metoedmobject[i].object);
00480 if (me2[i]->getTH2D()->Merge(&list) == -1)
00481 std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
00482 << metoedmobject[i].object.GetName() << "'" << std::endl;
00483 } else {
00484 dbe->setCurrentFolder(dir);
00485 me2[i] = dbe->book2DD(metoedmobject[i].object.GetName(),
00486 &metoedmobject[i].object);
00487 }
00488 if (!iEndRun) me2[i]->setLumiFlag();
00489 }
00490
00491
00492 TagList tags = metoedmobject[i].tags;
00493
00494 for (unsigned int j = 0; j < tags.size(); ++j) {
00495 dbe->tag(me2[i]->getFullname(),tags[j]);
00496 }
00497 }
00498 }
00499
00500 if (classtypes[ii] == "TH3F") {
00501 edm::Handle<MEtoEDM<TH3F> > metoedm;
00502 iGetFrom.getByType(metoedm);
00503
00504 if (!metoedm.isValid()) {
00505
00506
00507 continue;
00508 }
00509
00510 std::vector<MEtoEDM<TH3F>::MEtoEDMObject> metoedmobject =
00511 metoedm->getMEtoEdmObject();
00512
00513 me3.resize(metoedmobject.size());
00514
00515 for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
00516
00517 me3[i] = 0;
00518
00519
00520 std::string pathname = metoedmobject[i].name;
00521 if (verbosity > 0) std::cout << pathname << std::endl;
00522
00523 std::string dir;
00524
00525
00526 StringList fulldir = StringOps::split(pathname,"/");
00527
00528 for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
00529 dir += fulldir[j];
00530 if (j != fulldir.size() - 2) dir += "/";
00531 }
00532
00533
00534 if (dbe) {
00535 me3[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
00536 if (me3[i] && me3[i]->getTH3F() && me3[i]->getTH3F()->TestBit(TH1::kCanRebin) == true) {
00537 TList list;
00538 list.Add(&metoedmobject[i].object);
00539 if (me3[i]->getTH3F()->Merge(&list) == -1)
00540 std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
00541 << metoedmobject[i].object.GetName() << "'" << std::endl;
00542 } else {
00543 dbe->setCurrentFolder(dir);
00544 me3[i] = dbe->book3D(metoedmobject[i].object.GetName(),
00545 &metoedmobject[i].object);
00546 }
00547 if (!iEndRun) me3[i]->setLumiFlag();
00548 }
00549
00550
00551 TagList tags = metoedmobject[i].tags;
00552
00553 for (unsigned int j = 0; j < tags.size(); ++j) {
00554 dbe->tag(me3[i]->getFullname(),tags[j]);
00555 }
00556 }
00557 }
00558
00559 if (classtypes[ii] == "TProfile") {
00560 edm::Handle<MEtoEDM<TProfile> > metoedm;
00561 iGetFrom.getByType(metoedm);
00562
00563 if (!metoedm.isValid()) {
00564
00565
00566 continue;
00567 }
00568
00569 std::vector<MEtoEDM<TProfile>::MEtoEDMObject> metoedmobject =
00570 metoedm->getMEtoEdmObject();
00571
00572 me4.resize(metoedmobject.size());
00573
00574 for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
00575
00576 me4[i] = 0;
00577
00578
00579 std::string pathname = metoedmobject[i].name;
00580 if (verbosity > 0) std::cout << pathname << std::endl;
00581
00582 std::string dir;
00583
00584
00585 StringList fulldir = StringOps::split(pathname,"/");
00586
00587 for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
00588 dir += fulldir[j];
00589 if (j != fulldir.size() - 2) dir += "/";
00590 }
00591
00592 std::string name = metoedmobject[i].object.GetName();
00593
00594 if (dbe) {
00595 me4[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
00596 if (me4[i] && me4[i]->getTProfile() && me4[i]->getTProfile()->TestBit(TH1::kCanRebin) == true) {
00597 TList list;
00598 list.Add(&metoedmobject[i].object);
00599 if (me4[i]->getTProfile()->Merge(&list) == -1)
00600 std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
00601 << metoedmobject[i].object.GetName() << "'" << std::endl;
00602 } else {
00603 dbe->setCurrentFolder(dir);
00604 me4[i] = dbe->bookProfile(metoedmobject[i].object.GetName(),
00605 &metoedmobject[i].object);
00606 }
00607 if (!iEndRun) me4[i]->setLumiFlag();
00608 }
00609
00610
00611 TagList tags = metoedmobject[i].tags;
00612
00613 for (unsigned int j = 0; j < tags.size(); ++j) {
00614 dbe->tag(me4[i]->getFullname(),tags[j]);
00615 }
00616 }
00617 }
00618
00619 if (classtypes[ii] == "TProfile2D") {
00620 edm::Handle<MEtoEDM<TProfile2D> > metoedm;
00621 iGetFrom.getByType(metoedm);
00622
00623 if (!metoedm.isValid()) {
00624
00625
00626 continue;
00627 }
00628
00629 std::vector<MEtoEDM<TProfile2D>::MEtoEDMObject> metoedmobject =
00630 metoedm->getMEtoEdmObject();
00631
00632 me5.resize(metoedmobject.size());
00633
00634 for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
00635
00636 me5[i] = 0;
00637
00638
00639 std::string pathname = metoedmobject[i].name;
00640 if (verbosity > 0) std::cout << pathname << std::endl;
00641
00642 std::string dir;
00643
00644
00645 StringList fulldir = StringOps::split(pathname,"/");
00646
00647 for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
00648 dir += fulldir[j];
00649 if (j != fulldir.size() - 2) dir += "/";
00650 }
00651
00652
00653 if (dbe) {
00654 me5[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
00655 if (me5[i] && me5[i]->getTProfile2D() && me5[i]->getTProfile2D()->TestBit(TH1::kCanRebin) == true) {
00656 TList list;
00657 list.Add(&metoedmobject[i].object);
00658 if (me5[i]->getTProfile2D()->Merge(&list) == -1)
00659 std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
00660 << metoedmobject[i].object.GetName() << "'" << std::endl;
00661 } else {
00662 dbe->setCurrentFolder(dir);
00663 me5[i] = dbe->bookProfile2D(metoedmobject[i].object.GetName(),
00664 &metoedmobject[i].object);
00665 }
00666 if (!iEndRun) me5[i]->setLumiFlag();
00667 }
00668
00669
00670 TagList tags = metoedmobject[i].tags;
00671
00672 for (unsigned int j = 0; j < tags.size(); ++j) {
00673 dbe->tag(me5[i]->getFullname(),tags[j]);
00674 }
00675 }
00676 }
00677
00678 if (classtypes[ii] == "Double") {
00679 edm::Handle<MEtoEDM<double> > metoedm;
00680 iGetFrom.getByType(metoedm);
00681
00682 if (!metoedm.isValid()) {
00683
00684
00685 continue;
00686 }
00687
00688 std::vector<MEtoEDM<double>::MEtoEDMObject> metoedmobject =
00689 metoedm->getMEtoEdmObject();
00690
00691 me6.resize(metoedmobject.size());
00692
00693 for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
00694
00695 me6[i] = 0;
00696
00697
00698 std::string pathname = metoedmobject[i].name;
00699 if (verbosity > 0) std::cout << pathname << std::endl;
00700
00701 std::string dir;
00702 std::string name;
00703
00704
00705
00706 StringList fulldir = StringOps::split(pathname,"/");
00707 name = *(fulldir.end() - 1);
00708
00709 for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
00710 dir += fulldir[j];
00711 if (j != fulldir.size() - 2) dir += "/";
00712 }
00713
00714
00715 if (dbe) {
00716 dbe->setCurrentFolder(dir);
00717 me6[i] = dbe->bookFloat(name);
00718 me6[i]->Fill(metoedmobject[i].object);
00719 if (!iEndRun) me6[i]->setLumiFlag();
00720 }
00721
00722
00723 TagList tags = metoedmobject[i].tags;
00724
00725 for (unsigned int j = 0; j < tags.size(); ++j) {
00726 dbe->tag(me6[i]->getFullname(),tags[j]);
00727 }
00728 }
00729 }
00730
00731 if (classtypes[ii] == "Int64") {
00732 edm::Handle<MEtoEDM<long long> > metoedm;
00733 iGetFrom.getByType(metoedm);
00734
00735 if (!metoedm.isValid()) {
00736
00737
00738 continue;
00739 }
00740
00741 std::vector<MEtoEDM<long long>::MEtoEDMObject> metoedmobject =
00742 metoedm->getMEtoEdmObject();
00743
00744 me7.resize(metoedmobject.size());
00745
00746 for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
00747
00748 me7[i] = 0;
00749
00750
00751 std::string pathname = metoedmobject[i].name;
00752 if (verbosity > 0) std::cout << pathname << std::endl;
00753
00754 std::string dir;
00755 std::string name;
00756
00757
00758 StringList fulldir = StringOps::split(pathname,"/");
00759 name = *(fulldir.end() - 1);
00760
00761 for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
00762 dir += fulldir[j];
00763 if (j != fulldir.size() - 2) dir += "/";
00764 }
00765
00766
00767 if (dbe) {
00768 dbe->setCurrentFolder(dir);
00769 long long ival = 0;
00770 if ( iEndRun ) {
00771 if (name.find("processedEvents") != std::string::npos) {
00772 if (MonitorElement* me = dbe->get(dir+"/"+name)) {
00773 ival = me->getIntValue();
00774 }
00775 }
00776 }
00777 me7[i] = dbe->bookInt(name);
00778 me7[i]->Fill(metoedmobject[i].object+ival);
00779 if (!iEndRun) me7[i]->setLumiFlag();
00780 }
00781
00782
00783 TagList tags = metoedmobject[i].tags;
00784
00785 for (unsigned int j = 0; j < tags.size(); ++j) {
00786 dbe->tag(me7[i]->getFullname(),tags[j]);
00787 }
00788 }
00789 }
00790
00791 if (classtypes[ii] == "Int") {
00792 edm::Handle<MEtoEDM<int> > metoedm;
00793 iGetFrom.getByType(metoedm);
00794
00795 if (!metoedm.isValid()) {
00796
00797
00798 continue;
00799 }
00800
00801 std::vector<MEtoEDM<int>::MEtoEDMObject> metoedmobject =
00802 metoedm->getMEtoEdmObject();
00803
00804 me7.resize(metoedmobject.size());
00805
00806 for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
00807
00808 me7[i] = 0;
00809
00810
00811 std::string pathname = metoedmobject[i].name;
00812 if (verbosity > 0) std::cout << pathname << std::endl;
00813
00814 std::string dir;
00815 std::string name;
00816
00817
00818 StringList fulldir = StringOps::split(pathname,"/");
00819 name = *(fulldir.end() - 1);
00820
00821 for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
00822 dir += fulldir[j];
00823 if (j != fulldir.size() - 2) dir += "/";
00824 }
00825
00826
00827 if (dbe) {
00828 dbe->setCurrentFolder(dir);
00829 int ival = 0;
00830 if ( iEndRun ) {
00831 if (name.find("processedEvents") != std::string::npos) {
00832 if (MonitorElement* me = dbe->get(dir+"/"+name)) {
00833 ival = me->getIntValue();
00834 }
00835 }
00836 }
00837 me7[i] = dbe->bookInt(name);
00838 me7[i]->Fill(metoedmobject[i].object+ival);
00839 if (!iEndRun) me7[i]->setLumiFlag();
00840 }
00841
00842
00843 TagList tags = metoedmobject[i].tags;
00844
00845 for (unsigned int j = 0; j < tags.size(); ++j) {
00846 dbe->tag(me7[i]->getFullname(),tags[j]);
00847 }
00848 }
00849 }
00850
00851 if (classtypes[ii] == "String") {
00852 edm::Handle<MEtoEDM<TString> > metoedm;
00853 iGetFrom.getByType(metoedm);
00854
00855 if (!metoedm.isValid()) {
00856
00857
00858 continue;
00859 }
00860
00861 std::vector<MEtoEDM<TString>::MEtoEDMObject> metoedmobject =
00862 metoedm->getMEtoEdmObject();
00863
00864 me8.resize(metoedmobject.size());
00865
00866 for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
00867
00868 me8[i] = 0;
00869
00870
00871 std::string pathname = metoedmobject[i].name;
00872 if (verbosity > 0) std::cout << pathname << std::endl;
00873
00874 std::string dir;
00875 std::string name;
00876
00877
00878 StringList fulldir = StringOps::split(pathname,"/");
00879 name = *(fulldir.end() - 1);
00880
00881 for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
00882 dir += fulldir[j];
00883 if (j != fulldir.size() - 2) dir += "/";
00884 }
00885
00886
00887 if (dbe) {
00888 dbe->setCurrentFolder(dir);
00889 std::string scont = metoedmobject[i].object.Data();
00890 me8[i] = dbe->bookString(name,scont);
00891 if (!iEndRun) me8[i]->setLumiFlag();
00892 }
00893
00894
00895 TagList tags = metoedmobject[i].tags;
00896
00897 for (unsigned int j = 0; j < tags.size(); ++j) {
00898 dbe->tag(me8[i]->getFullname(),tags[j]);
00899 }
00900 }
00901 }
00902 }
00903
00904
00905 if (verbosity > 0) {
00906 std::vector<std::string> stags;
00907 dbe->getAllTags(stags);
00908 for (unsigned int i = 0; i < stags.size(); ++i) {
00909 std::cout << "Tags: " << stags[i] << std::endl;
00910 }
00911 }
00912
00913 }
00914