Skip to content

Commit

Permalink
Merge pull request #43747 from Dr15Jones/fix_fillEventPrincipal
Browse files Browse the repository at this point in the history
Handle empty branch index lists from input
  • Loading branch information
cmsbuild authored Jan 19, 2024
2 parents 4792b80 + dd81d63 commit 9b2ab85
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 2 deletions.
4 changes: 2 additions & 2 deletions FWCore/Framework/src/EventPrincipal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace edm {
} else {
provRetrieverPtr_->mergeParentProcessRetriever(provRetriever);
}
if (wasBranchListIndexesChangedFromInput(branchListIndexes)) {
if (wasBranchListIndexesChangedFromInput(branchListIndexes) or branchListIndexes_.empty()) {
if (branchIDListHelper_->hasProducedProducts()) {
// Add index into BranchIDListRegistry for products produced this process
branchListIndexes.push_back(branchIDListHelper_->producedBranchListIndex());
Expand All @@ -99,7 +99,7 @@ namespace edm {
DelayedReader* reader) {
eventSelectionIDs_ = std::move(eventSelectionIDs);

if (wasBranchListIndexesChangedFromInput(branchListIndexes)) {
if (wasBranchListIndexesChangedFromInput(branchListIndexes) or branchListIndexes_.empty()) {
if (branchIDListHelper_->hasProducedProducts()) {
// Add index into BranchIDListRegistry for products produced this process
branchListIndexes.push_back(branchIDListHelper_->producedBranchListIndex());
Expand Down
1 change: 1 addition & 0 deletions FWCore/Integration/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<test name="CatchStdExceptiontest" command="CatchStdExceptiontest.sh"/>
<test name="CatchCmsExceptiontest" command="CatchCmsExceptiontest.sh"/>
<test name="TestIntegrationExistingDictionary" command="run_TestExistingDictionary.sh"/>
<test name="TestIntegrationEmptyRootFile" command="run_TestEmptyRootFile.sh"/>

<bin file="ProcessConfiguration_t.cpp,ProcessHistory_t.cpp" name="TestIntegrationDataFormatsProvenance">
<use name="FWCore/ParameterSet"/>
Expand Down
13 changes: 13 additions & 0 deletions FWCore/Integration/test/makeEmptyRootFile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("WRITE")

process.source = cms.Source("EmptySource")

process.maxEvents.input = 10

process.out = cms.OutputModule("PoolOutputModule",
outputCommands = cms.untracked.vstring("drop *"),
fileName = cms.untracked.string("empty.root"))

process.o = cms.EndPath(process.out)
13 changes: 13 additions & 0 deletions FWCore/Integration/test/run_TestEmptyRootFile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

function die { echo Failure $1: status $2 ; exit $2 ; }

LOCAL_TEST_DIR=${SCRAM_TEST_PATH}

echo "write empty file"
cmsRun ${LOCAL_TEST_DIR}/makeEmptyRootFile.py || die "cmsRun makeEmptyRootFile.py" $?

echo "read empty file"
cmsRun ${LOCAL_TEST_DIR}/useEmptyRootFile.py || die "cmsRun useEmptyRootFile.py" $?

exit 0
11 changes: 11 additions & 0 deletions FWCore/Integration/test/useEmptyRootFile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("READ")

process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring("file:empty.root"))

process.Thing = cms.EDProducer("ThingProducer")

process.OtherThing = cms.EDProducer("OtherThingProducer")

process.p = cms.Path(process.Thing * process.OtherThing)

0 comments on commit 9b2ab85

Please sign in to comment.