@@ -263,6 +263,56 @@ inline bool MEtoEDM<int>::mergeProduct(const MEtoEDM<int> &newMEtoEDM) {
263263 return true ;
264264}
265265
266+ /* NOTE: this is a temporary workaround for a ROOT RNTuple dictionary issue.
267+ Once ROOT has been updated with a fix this method will be removed*/
268+ template <>
269+ inline bool MEtoEDM<long >::mergeProduct(const MEtoEDM<long > &newMEtoEDM) {
270+ const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject ();
271+ const size_t nObjects = newMEtoEDMObject.size ();
272+ // NOTE: we remember the present size since we will only add content
273+ // from newMEtoEDMObject after this point
274+ const size_t nOldObjects = MEtoEdmObject.size ();
275+
276+ // if the old and new are not the same size, we want to report a problem
277+ if (nObjects != nOldObjects) {
278+ std::cout << " WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new="
279+ << nObjects << " , old=" << nOldObjects << std::endl;
280+ }
281+
282+ for (unsigned int i = 0 ; i < nObjects; ++i) {
283+ unsigned int j = 0 ;
284+ // see if the name is already in the old container up to the point where
285+ // we may have added new entries in the container
286+ const std::string &name = newMEtoEDMObject[i].name ;
287+ if (i < nOldObjects && (MEtoEdmObject[i].name == name)) {
288+ j = i;
289+ } else {
290+ j = 0 ;
291+ while (j < nOldObjects && (MEtoEdmObject[j].name != name))
292+ ++j;
293+ }
294+ if (j >= nOldObjects) {
295+ // this value is only in the new container, not the old one
296+ #if METOEDMFORMAT_DEBUG
297+ std::cout << " WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << " '" << std::endl;
298+ #endif
299+ MEtoEdmObject.push_back (newMEtoEDMObject[i]);
300+ } else {
301+ // this value is also in the new container: add the two
302+ if (MEtoEdmObject[j].name .find (" EventInfo/processedEvents" ) != std::string::npos) {
303+ MEtoEdmObject[j].object += (newMEtoEDMObject[i].object );
304+ }
305+ if (MEtoEdmObject[j].name .find (" EventInfo/iEvent" ) != std::string::npos ||
306+ MEtoEdmObject[j].name .find (" EventInfo/iLumiSection" ) != std::string::npos) {
307+ if (MEtoEdmObject[j].object < newMEtoEDMObject[i].object ) {
308+ MEtoEdmObject[j].object = (newMEtoEDMObject[i].object );
309+ }
310+ }
311+ }
312+ }
313+ return true ;
314+ }
315+
266316template <>
267317inline bool MEtoEDM<long long >::mergeProduct(const MEtoEDM<long long > &newMEtoEDM) {
268318 const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject ();
0 commit comments