Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74455
b: "refs/heads/CMSSW_7_1_X"
c: 7bc1ebb
h: "refs/heads/CMSSW_7_1_X"
i:
  74453: 0dfba4a
  74451: 98c89c8
  74447: 9751db5
v: v3
  • Loading branch information
Andreas Meyer committed Sep 30, 2009
1 parent 90dfafb commit 2fa1a0a
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e
"refs/heads/CMSSW_7_1_X": ac3bc05de97d55ee133e73aa82b3c064da3986e2
"refs/heads/CMSSW_7_1_X": 7bc1ebb7c6ad5fc17f4e1a19fea1e5290813c34f
51 changes: 49 additions & 2 deletions trunk/DataFormats/Histograms/interface/MEtoEDMFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

Expand Down Expand Up @@ -176,6 +176,53 @@ MEtoEDM<double>::mergeProduct(const MEtoEDM<double> &newMEtoEDM)
return true;
}

template <>
inline bool
MEtoEDM<int>::mergeProduct(const MEtoEDM<int> &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<int64_t>::mergeProduct(const MEtoEDM<int64_t> &newMEtoEDM)
Expand Down
9 changes: 6 additions & 3 deletions trunk/DataFormats/Histograms/src/classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ namespace {
MEtoEDM<TProfile> dummy6;
MEtoEDM<TProfile2D> dummy7;
MEtoEDM<double> dummy8;
MEtoEDM<int64_t> dummy9;
MEtoEDM<int> dummy9;
MEtoEDM<int64_t> dummy9a;
MEtoEDM<TString> dummy10;
MEtoEDM<TH1F>::MEtoEDMObject blah1;
MEtoEDM<TH1S>::MEtoEDMObject blah2;
Expand All @@ -70,7 +71,8 @@ namespace {
std::vector<MEtoEDM<TProfile>::MEtoEDMObject> dummy14;
std::vector<MEtoEDM<TProfile2D>::MEtoEDMObject> dummy15;
std::vector<MEtoEDM<double>::MEtoEDMObject> dummy16;
std::vector<MEtoEDM<int64_t>::MEtoEDMObject> dummy17;
std::vector<MEtoEDM<int>::MEtoEDMObject> dummy17;
std::vector<MEtoEDM<int64_t>::MEtoEDMObject> dummy17a;
std::vector<MEtoEDM<TString>::MEtoEDMObject> dummy18;
edm::Wrapper<MEtoEDM<TH1F> > theValidData1;
edm::Wrapper<MEtoEDM<TH1S> > theValidData1s;
Expand All @@ -80,7 +82,8 @@ namespace {
edm::Wrapper<MEtoEDM<TProfile> > theValidData4;
edm::Wrapper<MEtoEDM<TProfile2D> > theValidData5;
edm::Wrapper<MEtoEDM<double> > theValidData6;
edm::Wrapper<MEtoEDM<int64_t> > theValidData7;
edm::Wrapper<MEtoEDM<int> > theValidData7;
edm::Wrapper<MEtoEDM<int64_t> > theValidData7a;
edm::Wrapper<MEtoEDM<TString> > theValidData8;
};
}
4 changes: 4 additions & 0 deletions trunk/DataFormats/Histograms/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<class name="MEtoEDM<TProfile>"/>
<class name="MEtoEDM<TProfile2D>"/>
<class name="MEtoEDM<double>"/>
<class name="MEtoEDM<int>"/>
<class name="MEtoEDM<int64_t>"/>
<class name="MEtoEDM<TString>"/>
<class name="MEtoEDM<TH1F>::MEtoEDMObject"/>
Expand All @@ -60,6 +61,7 @@
<class name="MEtoEDM<TProfile>::MEtoEDMObject"/>
<class name="MEtoEDM<TProfile2D>::MEtoEDMObject"/>
<class name="MEtoEDM<double>::MEtoEDMObject"/>
<class name="MEtoEDM<int>::MEtoEDMObject"/>
<class name="MEtoEDM<int64_t>::MEtoEDMObject"/>
<class name="MEtoEDM<TString>::MEtoEDMObject"/>
<class name="std::vector<MEtoEDM<TH1F>::MEtoEDMObject>"/>
Expand All @@ -70,6 +72,7 @@
<class name="std::vector<MEtoEDM<TProfile>::MEtoEDMObject>"/>
<class name="std::vector<MEtoEDM<TProfile2D>::MEtoEDMObject>"/>
<class name="std::vector<MEtoEDM<double>::MEtoEDMObject>"/>
<class name="std::vector<MEtoEDM<int>::MEtoEDMObject>"/>
<class name="std::vector<MEtoEDM<int64_t>::MEtoEDMObject>"/>
<class name="std::vector<MEtoEDM<TString>::MEtoEDMObject>"/>
<class name="edm::Wrapper<MEtoEDM<TH1F> >"/>
Expand All @@ -80,6 +83,7 @@
<class name="edm::Wrapper<MEtoEDM<TProfile> >"/>
<class name="edm::Wrapper<MEtoEDM<TProfile2D> >"/>
<class name="edm::Wrapper<MEtoEDM<double> >"/>
<class name="edm::Wrapper<MEtoEDM<int> >"/>
<class name="edm::Wrapper<MEtoEDM<int64_t> >"/>
<class name="edm::Wrapper<MEtoEDM<TString> >"/>
</lcgdict>

0 comments on commit 2fa1a0a

Please sign in to comment.