@@ -1022,21 +1022,29 @@ namespace edm {
10221022 FDEBUG (1 ) << " \t readFile\n " ;
10231023 SendSourceTerminationSignalIfException sentry (actReg_.get ());
10241024
1025+ // CDJ: THIS SHOULD NOT BE APPLIED TO THE ACTIVE INTERVALS
10251026 if (streamRunActive_ > 0 ) {
1027+ // deals with data structures that allows merged Run products to be split on Lumi boundaries then
1028+ // in later processes reintegrated.
10261029 streamRunStatus_[0 ]->runPrincipal ()->preReadFile ();
1027- streamRunStatus_[0 ]->runPrincipal ()->adjustIndexesAfterProductRegistryAddition ();
1028- }
1029-
1030- if (streamLumiActive_ > 0 ) {
1031- streamLumiStatus_[0 ]->lumiPrincipal ()->adjustIndexesAfterProductRegistryAddition ();
10321030 }
10331031
1032+ auto sizeBefore = input_->productRegistry ().size ();
10341033 fb_ = input_->readFile ();
10351034 // incase the input's registry changed
1036- const size_t size = preg_->size ();
1037- preg_->merge (input_->productRegistry (), fb_ ? fb_->fileName () : std::string ());
1038- if (size < preg_->size ()) {
1039- principalCache_.adjustIndexesAfterProductRegistryAddition ();
1035+ if (input_->productRegistry ().size () != sizeBefore) {
1036+ auto temp = std::make_shared<edm::ProductRegistry>(*preg_);
1037+ temp->merge (input_->productRegistry (), fb_ ? fb_->fileName () : std::string ());
1038+ preg_ = std::move (temp);
1039+ // This handles are presently unused Run/Lumis
1040+ principalCache_.adjustIndexesAfterProductRegistryAddition (edm::get_underlying_safe (preg_));
1041+ if (streamLumiActive_ > 0 ) {
1042+ // Can update the active ones now, even before an `end` transition is called because no OutputModule
1043+ // supports storing ProductDescriptions for Run/LuminosityBlock products which were dropped. Since only
1044+ // dropped products can change the ProductRegistry, only changes in Event can cause that.
1045+ streamRunStatus_[0 ]->runPrincipal ()->possiblyUpdateAfterAddition (edm::get_underlying_safe (preg_));
1046+ streamLumiStatus_[0 ]->lumiPrincipal ()->possiblyUpdateAfterAddition (edm::get_underlying_safe (preg_));
1047+ }
10401048 }
10411049 principalCache_.adjustEventsToNewProductRegistry (preg ());
10421050 if (preallocations_.numberOfStreams () > 1 and preallocations_.numberOfThreads () > 1 ) {
@@ -2022,6 +2030,7 @@ namespace edm {
20222030
20232031 std::shared_ptr<RunPrincipal> EventProcessor::readRun () {
20242032 auto rp = principalCache_.getAvailableRunPrincipalPtr ();
2033+ rp->possiblyUpdateAfterAddition (preg ());
20252034 assert (rp);
20262035 rp->setAux (*input_->runAuxiliary ());
20272036 {
@@ -2046,6 +2055,7 @@ namespace edm {
20462055
20472056 std::shared_ptr<LuminosityBlockPrincipal> EventProcessor::readLuminosityBlock (std::shared_ptr<RunPrincipal> rp) {
20482057 auto lbp = principalCache_.getAvailableLumiPrincipalPtr ();
2058+ lbp->possiblyUpdateAfterAddition (preg ());
20492059 assert (lbp);
20502060 lbp->setAux (*input_->luminosityBlockAuxiliary ());
20512061 {
0 commit comments