@@ -1037,24 +1037,14 @@ namespace edm {
10371037 streamRunStatus_[0 ]->runPrincipal ()->preReadFile ();
10381038 }
10391039
1040- auto sizeBefore = input_->productRegistry ().size ();
1040+ auto oldCacheID = input_->productRegistry ().cacheIdentifier ();
10411041 fb_ = input_->readFile ();
10421042 // incase the input's registry changed
1043- if (input_->productRegistry ().size () != sizeBefore ) {
1043+ if (input_->productRegistry ().cacheIdentifier () != oldCacheID ) {
10441044 auto temp = std::make_shared<edm::ProductRegistry>(*preg_);
10451045 temp->merge (input_->productRegistry (), fb_ ? fb_->fileName () : std::string ());
10461046 preg_ = std::move (temp);
1047- // This handles are presently unused Run/Lumis
1048- principalCache_.adjustIndexesAfterProductRegistryAddition (edm::get_underlying_safe (preg_));
1049- if (streamLumiActive_ > 0 ) {
1050- // Can update the active ones now, even before an `end` transition is called because no OutputModule
1051- // supports storing ProductDescriptions for Run/LuminosityBlock products which were dropped. Since only
1052- // dropped products can change the ProductRegistry, only changes in Event can cause that.
1053- streamRunStatus_[0 ]->runPrincipal ()->possiblyUpdateAfterAddition (edm::get_underlying_safe (preg_));
1054- streamLumiStatus_[0 ]->lumiPrincipal ()->possiblyUpdateAfterAddition (edm::get_underlying_safe (preg_));
1055- }
10561047 }
1057- principalCache_.adjustEventsToNewProductRegistry (preg ());
10581048 if (preallocations_.numberOfStreams () > 1 and preallocations_.numberOfThreads () > 1 ) {
10591049 fb_->setNotFastClonable (FileBlock::ParallelProcesses);
10601050 }
@@ -2038,6 +2028,7 @@ namespace edm {
20382028
20392029 std::shared_ptr<RunPrincipal> EventProcessor::readRun () {
20402030 auto rp = principalCache_.getAvailableRunPrincipalPtr ();
2031+ // a new file may have been opened since the last use of this Run
20412032 rp->possiblyUpdateAfterAddition (preg ());
20422033 assert (rp);
20432034 rp->setAux (*input_->runAuxiliary ());
@@ -2052,6 +2043,9 @@ namespace edm {
20522043
20532044 void EventProcessor::readAndMergeRun (RunProcessingStatus& iStatus) {
20542045 RunPrincipal& runPrincipal = *iStatus.runPrincipal ();
2046+ // If a file open happened and we are continuing the Run we may need
2047+ // to do the update
2048+ runPrincipal.possiblyUpdateAfterAddition (preg ());
20552049
20562050 runPrincipal.mergeAuxiliary (*input_->runAuxiliary ());
20572051 {
@@ -2063,6 +2057,7 @@ namespace edm {
20632057
20642058 std::shared_ptr<LuminosityBlockPrincipal> EventProcessor::readLuminosityBlock (std::shared_ptr<RunPrincipal> rp) {
20652059 auto lbp = principalCache_.getAvailableLumiPrincipalPtr ();
2060+ // A new file may have been opened since the last use of the LuminosityBlock
20662061 lbp->possiblyUpdateAfterAddition (preg ());
20672062 assert (lbp);
20682063 lbp->setAux (*input_->luminosityBlockAuxiliary ());
@@ -2081,6 +2076,9 @@ namespace edm {
20812076 input_->processHistoryRegistry ().reducedProcessHistoryID (lumiPrincipal.aux ().processHistoryID ()) ==
20822077 input_->processHistoryRegistry ().reducedProcessHistoryID (
20832078 input_->luminosityBlockAuxiliary ()->processHistoryID ()));
2079+ // If a file was opened and the LuminosityBlock is continuing
2080+ // we may need to do the update
2081+ lumiPrincipal.possiblyUpdateAfterAddition (preg ());
20842082 lumiPrincipal.mergeAuxiliary (*input_->luminosityBlockAuxiliary ());
20852083 {
20862084 SendSourceTerminationSignalIfException sentry (actReg_.get ());
@@ -2386,6 +2384,8 @@ namespace edm {
23862384 // TODO this will have to become per stream
23872385 auto & event = principalCache_.eventPrincipal (iStreamIndex);
23882386 StreamContext streamContext (event.streamID (), &processContext_);
2387+ // a new file may have been read since the last time this event was used
2388+ event.possiblyUpdateAfterAddition (preg ());
23892389
23902390 SendSourceTerminationSignalIfException sentry (actReg_.get ());
23912391 input_->readEvent (event, streamContext);
0 commit comments