Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:55

0001 #ifndef FWCore_Common_ProcessBlockHelperBase_h
0002 #define FWCore_Common_ProcessBlockHelperBase_h
0003 
0004 /** \class edm::ProcessBlockHelperBase
0005 
0006 \author W. David Dagenhart, created 30 December, 2020
0007 
0008 */
0009 
0010 #include "DataFormats/Provenance/interface/ProvenanceFwd.h"
0011 #include "FWCore/Utilities/interface/FWCoreUtiliesFwd.h"
0012 
0013 #include <string>
0014 #include <vector>
0015 
0016 namespace edm {
0017 
0018   class ProcessBlockHelperBase {
0019   public:
0020     virtual ~ProcessBlockHelperBase();
0021 
0022     std::vector<std::string> const& processesWithProcessBlockProducts() const {
0023       return processesWithProcessBlockProducts_;
0024     }
0025     void setProcessesWithProcessBlockProducts(std::vector<std::string> const& val) {
0026       processesWithProcessBlockProducts_ = val;
0027     }
0028     void emplaceBackProcessName(std::string const& processName) {
0029       processesWithProcessBlockProducts_.emplace_back(processName);
0030     }
0031 
0032     std::vector<std::string> const& addedProcesses() const { return addedProcesses_; }
0033     void setAddedProcesses(std::vector<std::string> const& val) { addedProcesses_ = val; }
0034     void emplaceBackAddedProcessName(std::string const& processName) { addedProcesses_.emplace_back(processName); }
0035 
0036     void updateForNewProcess(ProductRegistry const&, std::string const& processName);
0037 
0038     // In the function names below, top implies associated the helper associated
0039     // with the EventProcessor, not a helper associated with a SubProcess.
0040 
0041     virtual ProcessBlockHelperBase const* topProcessBlockHelper() const = 0;
0042     virtual std::vector<std::string> const& topProcessesWithProcessBlockProducts() const = 0;
0043     virtual unsigned int nProcessesInFirstFile() const = 0;
0044     virtual std::vector<std::vector<unsigned int>> const& processBlockCacheIndices() const = 0;
0045     virtual std::vector<std::vector<unsigned int>> const& nEntries() const = 0;
0046     virtual std::vector<unsigned int> const& cacheIndexVectorsPerFile() const = 0;
0047     virtual std::vector<unsigned int> const& cacheEntriesPerFile() const = 0;
0048     virtual unsigned int processBlockIndex(std::string const& processName, EventToProcessBlockIndexes const&) const = 0;
0049     virtual unsigned int outerOffset() const = 0;
0050 
0051     std::string selectProcess(ProductRegistry const&, ProductLabels const&, TypeID const&) const;
0052 
0053     static constexpr unsigned int invalidCacheIndex() { return 0xffffffff; }
0054     static constexpr unsigned int invalidProcessIndex() { return 0xffffffff; }
0055 
0056   private:
0057     // Includes processes with ProcessBlock branches present
0058     // in the first input file and not dropped on input. At
0059     // each processing step the new process will be added at
0060     // the end if there are non-transient ProcessBlock products
0061     // being produced. Output modules will write a copy of this
0062     // to persistent storage after removing any process without
0063     // at least one kept ProcessBlock branch.
0064     std::vector<std::string> processesWithProcessBlockProducts_;
0065 
0066     // This will have 0 or 1 element depending whether there are any
0067     // non-transient ProcessBlock products produced in the current
0068     // process (except for SubProcesses where this might have more
0069     // than 1 element)
0070     std::vector<std::string> addedProcesses_;
0071   };
0072 }  // namespace edm
0073 #endif