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