Skip to content

Commit 0df77a9

Browse files
authored
Merge pull request #49299 from Dr15Jones/matrixRNTupleTemp_master
Use RNTupleTemp* modules
2 parents 2ddac7f + f5ccf71 commit 0df77a9

File tree

4 files changed

+60
-5
lines changed

4 files changed

+60
-5
lines changed

Configuration/Applications/python/ConfigBuilder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ def _datasetname_and_maxfiles(entry):
458458
secondaryFileNames= cms.untracked.vstring())
459459
filesFromOption(self)
460460
if self._options.filetype == "EDM_RNTUPLE":
461-
self.process.source=cms.Source("RNTupleSource",
461+
self.process.source=cms.Source("RNTupleTempSource",
462462
fileNames = cms.untracked.vstring())#, 2ndary not supported yet
463463
#secondaryFileNames= cms.untracked.vstring())
464464
filesFromOption(self)
@@ -733,7 +733,7 @@ def _createOutputModuleInAddOutput(self, tier, streamType, eventContent, fileNam
733733
elif not ignoreNano and "NANOAOD" in streamType:
734734
CppType='NanoAODRNTupleOutputModule' if self._options.rntuple_out else 'NanoAODOutputModule'
735735
elif self._options.rntuple_out:
736-
CppType='RNTupleOutputModule'
736+
CppType='RNTupleTempOutputModule'
737737
if 'RNTuple' in CppType:
738738
fileName = fileName.replace('.root', '.rntpl')
739739
else:
@@ -1241,7 +1241,7 @@ def addExtraStream(self, name, stream, workflow='full'):
12411241
# define output module and go from there
12421242
if self._options.rntuple_out:
12431243
extension = '.rntpl'
1244-
output = cms.OutputModule('RNTupleOutputModule')
1244+
output = cms.OutputModule('RNTupleTempOutputModule')
12451245
else:
12461246
extension = '.root'
12471247
output = cms.OutputModule("PoolOutputModule")

Configuration/Applications/test/ConfigBuilderTest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def testOutputFormatWithEventContent(self):
139139
options.datatier= "MINIAOD"
140140
options.eventcontent="MINIAOD"
141141
options.rntuple_out = True
142-
_test_addOutput(self, options, process, [OutStats('MINIAODoutput','RNTupleOutputModule','MINIAOD','output.rntpl',outputCommands_)])
142+
_test_addOutput(self, options, process, [OutStats('MINIAODoutput','RNTupleTempOutputModule','MINIAOD','output.rntpl',outputCommands_)])
143143
#MINIAOD1 [NOTE notiation not restricted to MINIAOD]
144144
#NOT SUPPORTED BY outputDefinition
145145
process = cms.Process("TEST")
@@ -234,7 +234,7 @@ def testOutputFormatWithEventContent(self):
234234
options.datatier= "NANOAOD"
235235
options.eventcontent="NANOEDMAOD"
236236
options.rntuple_out = True
237-
_test_addOutput(self, options, process, [OutStats('NANOEDMAODoutput', 'RNTupleOutputModule', 'NANOAOD', 'output.rntpl', outputCommands_)])
237+
_test_addOutput(self, options, process, [OutStats('NANOEDMAODoutput', 'RNTupleTempOutputModule', 'NANOAOD', 'output.rntpl', outputCommands_)])
238238
#ALCARECO empty
239239
process = cms.Process("TEST")
240240
options.scenario = "TEST"

DataFormats/Histograms/interface/MEtoEDMFormat.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
266316
template <>
267317
inline bool MEtoEDM<long long>::mergeProduct(const MEtoEDM<long long> &newMEtoEDM) {
268318
const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject();

DataFormats/Histograms/src/classes_def.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<class name="MEtoEDM<TProfile2D>"/>
3434
<class name="MEtoEDM<double>"/>
3535
<class name="MEtoEDM<int>"/>
36+
<class name="MEtoEDM<long>"/>
3637
<class name="MEtoEDM<long long>"/>
3738
<class name="MEtoEDM<TString>"/>
3839
<class name="MEtoEDM<TH1F>::MEtoEDMObject" rntupleStreamerMode="true"/>
@@ -49,6 +50,8 @@
4950
<class name="MEtoEDM<TProfile2D>::MEtoEDMObject" rntupleStreamerMode="true"/>
5051
<class name="MEtoEDM<double>::MEtoEDMObject" rntupleStreamerMode="true"/>
5152
<class name="MEtoEDM<int>::MEtoEDMObject" rntupleStreamerMode="true"/>
53+
<!--The following is a workaround for an RNTuple issue. Will be removed once ROOT fix exists. -->
54+
<class name="MEtoEDM<long>::MEtoEDMObject" rntupleStreamerMode="true"/>
5255
<class name="MEtoEDM<long long>::MEtoEDMObject" rntupleStreamerMode="true"/>
5356
<class name="MEtoEDM<TString>::MEtoEDMObject" rntupleStreamerMode="true"/>
5457
<class name="std::vector<MEtoEDM<TH1F>::MEtoEDMObject>"/>
@@ -81,6 +84,8 @@
8184
<class name="edm::Wrapper<MEtoEDM<TProfile2D> >"/>
8285
<class name="edm::Wrapper<MEtoEDM<double> >"/>
8386
<class name="edm::Wrapper<MEtoEDM<int> >"/>
87+
<!--The following is a workaround for an RNTuple issue. Will be removed once ROOT fix exists. -->
88+
<class name="edm::Wrapper<MEtoEDM<long> >"/>
8489
<class name="edm::Wrapper<MEtoEDM<long long> >"/>
8590
<class name="edm::Wrapper<MEtoEDM<TString> >"/>
8691

0 commit comments

Comments
 (0)