diff --git a/[refs] b/[refs] index e4c2ba9d38f3e..c6ceef7545201 100644 --- a/[refs] +++ b/[refs] @@ -1,3 +1,3 @@ --- refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e -"refs/heads/CMSSW_7_1_X": ac3bc05de97d55ee133e73aa82b3c064da3986e2 +"refs/heads/CMSSW_7_1_X": 7bc1ebb7c6ad5fc17f4e1a19fea1e5290813c34f diff --git a/trunk/DataFormats/Histograms/interface/MEtoEDMFormat.h b/trunk/DataFormats/Histograms/interface/MEtoEDMFormat.h index 2a0858bbe1ad7..cfa03dedcfded 100644 --- a/trunk/DataFormats/Histograms/interface/MEtoEDMFormat.h +++ b/trunk/DataFormats/Histograms/interface/MEtoEDMFormat.h @@ -6,8 +6,8 @@ * DataFormat class to hold the information from a ME tranformed into * ROOT objects as appropriate * - * $Date: 2009/09/28 18:28:07 $ - * $Revision: 1.17 $ + * $Date: 2009/09/29 19:49:10 $ + * $Revision: 1.18 $ * \author M. Strang SUNY-Buffalo */ @@ -176,6 +176,53 @@ MEtoEDM::mergeProduct(const MEtoEDM &newMEtoEDM) return true; } +template <> +inline bool +MEtoEDM::mergeProduct(const MEtoEDM &newMEtoEDM) +{ + const MEtoEdmObjectVector &newMEtoEDMObject = + newMEtoEDM.getMEtoEdmObject(); + const size_t nObjects = newMEtoEDMObject.size(); + // NOTE: we remember the present size since we will only add content + // from newMEtoEDMObject after this point + const size_t nOldObjects = MEtoEdmObject.size(); + + // if the old and new are not the same size, we want to report a problem + if (nObjects != nOldObjects) { + std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl; + } + + for (unsigned int i = 0; i < nObjects; ++i) { + unsigned int j = 0; + // see if the name is already in the old container up to the point where + // we may have added new entries in the container + const std::string& name =newMEtoEDMObject[i].name; + if (i < nOldObjects && (MEtoEdmObject[i].name == name)) { + j = i; + } else { + j = 0; + while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j; + } + if (j >= nOldObjects) { + // this value is only in the new container, not the old one + std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl; + MEtoEdmObject.push_back(newMEtoEDMObject[i]); + } else { + // this value is also in the new container: add the two + if ( MEtoEdmObject[i].name.find("EventInfo/processedEvents") != std::string::npos ) { + MEtoEdmObject[i].object += (newMEtoEDMObject[j].object); + } + if ( MEtoEdmObject[i].name.find("EventInfo/iEvent") != std::string::npos || + MEtoEdmObject[i].name.find("EventInfo/iLumiSection") != std::string::npos) { + if (MEtoEdmObject[i].object < newMEtoEDMObject[j].object) { + MEtoEdmObject[i].object = (newMEtoEDMObject[j].object); + } + } + } + } + return true; +} + template <> inline bool MEtoEDM::mergeProduct(const MEtoEDM &newMEtoEDM) diff --git a/trunk/DataFormats/Histograms/src/classes.h b/trunk/DataFormats/Histograms/src/classes.h index 2171f4573f61f..3b4e2085bec3d 100644 --- a/trunk/DataFormats/Histograms/src/classes.h +++ b/trunk/DataFormats/Histograms/src/classes.h @@ -51,7 +51,8 @@ namespace { MEtoEDM dummy6; MEtoEDM dummy7; MEtoEDM dummy8; - MEtoEDM dummy9; + MEtoEDM dummy9; + MEtoEDM dummy9a; MEtoEDM dummy10; MEtoEDM::MEtoEDMObject blah1; MEtoEDM::MEtoEDMObject blah2; @@ -70,7 +71,8 @@ namespace { std::vector::MEtoEDMObject> dummy14; std::vector::MEtoEDMObject> dummy15; std::vector::MEtoEDMObject> dummy16; - std::vector::MEtoEDMObject> dummy17; + std::vector::MEtoEDMObject> dummy17; + std::vector::MEtoEDMObject> dummy17a; std::vector::MEtoEDMObject> dummy18; edm::Wrapper > theValidData1; edm::Wrapper > theValidData1s; @@ -80,7 +82,8 @@ namespace { edm::Wrapper > theValidData4; edm::Wrapper > theValidData5; edm::Wrapper > theValidData6; - edm::Wrapper > theValidData7; + edm::Wrapper > theValidData7; + edm::Wrapper > theValidData7a; edm::Wrapper > theValidData8; }; } diff --git a/trunk/DataFormats/Histograms/src/classes_def.xml b/trunk/DataFormats/Histograms/src/classes_def.xml index a4f49eb28fd89..e30579327745c 100644 --- a/trunk/DataFormats/Histograms/src/classes_def.xml +++ b/trunk/DataFormats/Histograms/src/classes_def.xml @@ -50,6 +50,7 @@ + @@ -60,6 +61,7 @@ + @@ -70,6 +72,7 @@ + @@ -80,6 +83,7 @@ +