Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-19 01:43:34

0001 #include "FWCore/Common/interface/SubProcessBlockHelper.h"
0002 
0003 #include "DataFormats/Provenance/interface/BranchDescription.h"
0004 #include "DataFormats/Provenance/interface/ProductRegistry.h"
0005 #include "FWCore/Utilities/interface/BranchType.h"
0006 
0007 #include <cassert>
0008 #include <string>
0009 
0010 namespace edm {
0011 
0012   ProcessBlockHelperBase const* SubProcessBlockHelper::topProcessBlockHelper() const { return topProcessBlockHelper_; }
0013 
0014   std::vector<std::string> const& SubProcessBlockHelper::topProcessesWithProcessBlockProducts() const {
0015     return topProcessBlockHelper_->processesWithProcessBlockProducts();
0016   }
0017 
0018   unsigned int SubProcessBlockHelper::nProcessesInFirstFile() const {
0019     return topProcessBlockHelper_->nProcessesInFirstFile();
0020   }
0021 
0022   std::vector<std::vector<unsigned int>> const& SubProcessBlockHelper::processBlockCacheIndices() const {
0023     return topProcessBlockHelper_->processBlockCacheIndices();
0024   }
0025 
0026   std::vector<std::vector<unsigned int>> const& SubProcessBlockHelper::nEntries() const {
0027     return topProcessBlockHelper_->nEntries();
0028   }
0029 
0030   std::vector<unsigned int> const& SubProcessBlockHelper::cacheIndexVectorsPerFile() const {
0031     return topProcessBlockHelper_->cacheIndexVectorsPerFile();
0032   }
0033 
0034   std::vector<unsigned int> const& SubProcessBlockHelper::cacheEntriesPerFile() const {
0035     return topProcessBlockHelper_->cacheEntriesPerFile();
0036   }
0037 
0038   unsigned int SubProcessBlockHelper::processBlockIndex(
0039       std::string const& processName, EventToProcessBlockIndexes const& eventToProcessBlockIndexes) const {
0040     return topProcessBlockHelper_->processBlockIndex(processName, eventToProcessBlockIndexes);
0041   }
0042 
0043   unsigned int SubProcessBlockHelper::outerOffset() const { return topProcessBlockHelper_->outerOffset(); }
0044 
0045   void SubProcessBlockHelper::updateFromParentProcess(ProcessBlockHelperBase const& parentProcessBlockHelper,
0046                                                       ProductRegistry const& productRegistry) {
0047     topProcessBlockHelper_ = parentProcessBlockHelper.topProcessBlockHelper();
0048 
0049     // If a SubProcess keeps any ProcessBlock products from its parent process, then insert their
0050     // process names.
0051     assert(processesWithProcessBlockProducts().empty());
0052     for (auto const& processName : parentProcessBlockHelper.processesWithProcessBlockProducts()) {
0053       for (auto const& item : productRegistry.productList()) {
0054         BranchDescription const& desc = item.second;
0055         if (desc.branchType() == InProcess && desc.present() && desc.processName() == processName) {
0056           emplaceBackProcessName(processName);
0057           break;
0058         }
0059       }
0060     }
0061 
0062     // Repeat for addedProcesses
0063     assert(addedProcesses().empty());
0064     for (auto const& processName : parentProcessBlockHelper.addedProcesses()) {
0065       for (auto const& item : productRegistry.productList()) {
0066         BranchDescription const& desc = item.second;
0067         if (desc.branchType() == InProcess && desc.present() && desc.processName() == processName) {
0068           emplaceBackAddedProcessName(processName);
0069           break;
0070         }
0071       }
0072     }
0073   }
0074 
0075 }  // namespace edm