Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef FWCore_Common_OutputProcessBlockHelper_h
0002 #define FWCore_Common_OutputProcessBlockHelper_h
0003 
0004 /** \class edm::OutputProcessBlockHelper
0005 
0006 \author W. David Dagenhart, created 28 December, 2020
0007 
0008 */
0009 
0010 #include "DataFormats/Provenance/interface/ProvenanceFwd.h"
0011 
0012 #include <set>
0013 #include <string>
0014 #include <vector>
0015 
0016 namespace edm {
0017 
0018   class ProcessBlockHelperBase;
0019 
0020   class OutputProcessBlockHelper {
0021   public:
0022     std::vector<std::string> const& processesWithProcessBlockProducts() const {
0023       return processesWithProcessBlockProducts_;
0024     }
0025 
0026     void updateAfterProductSelection(std::set<std::string> const& processesWithKeptProcessBlockProducts,
0027                                      ProcessBlockHelperBase const&);
0028 
0029     void fillCacheIndices(StoredProcessBlockHelper&) const;
0030 
0031     bool productsFromInputKept() const { return productsFromInputKept_; }
0032 
0033     ProcessBlockHelperBase const* processBlockHelper() const { return processBlockHelper_; }
0034 
0035   private:
0036     // The next two functions are intended to be used only for testing purposes
0037     friend class TestOneOutput;
0038     std::vector<unsigned int> const& translateFromStoredIndex() const { return translateFromStoredIndex_; }
0039     unsigned int nAddedProcesses() const { return nAddedProcesses_; }
0040 
0041     void setStoredProcessOffset(unsigned int nInputProcesses,
0042                                 std::vector<std::vector<unsigned int>> const& nEntries,
0043                                 std::vector<unsigned int>& storedProcessOffset) const;
0044 
0045     void setProcessOffset(unsigned int iFile,
0046                           unsigned int nInputProcesses,
0047                           std::vector<std::vector<unsigned int>> const& nEntries,
0048                           std::vector<unsigned int>& processOffset) const;
0049 
0050     void setStoredFileInProcessOffset(unsigned int iFile,
0051                                       unsigned int nInputProcesses,
0052                                       std::vector<std::vector<unsigned int>> const& nEntries,
0053                                       std::vector<unsigned int>& storedFileInProcessOffset) const;
0054 
0055     // Includes processes with at least one ProcessBlock branch present
0056     // in the output file
0057     std::vector<std::string> processesWithProcessBlockProducts_;
0058 
0059     // This will have the value of 0 or 1, except for the SubProcess case.
0060     // This is incremented to 1 if the current process produces new
0061     // ProcessBlock products and they are kept by the OutputModule.
0062     unsigned int nAddedProcesses_ = 0;
0063 
0064     // Translate from the vector of process names in this class to
0065     // the one in the ProcessBlockHelper
0066     std::vector<unsigned int> translateFromStoredIndex_;
0067 
0068     // Points to the main ProcessBlockHelper owned by the EventProcessor
0069     // or SubProcess
0070     ProcessBlockHelperBase const* processBlockHelper_ = nullptr;
0071 
0072     bool productsFromInputKept_ = false;
0073   };
0074 }  // namespace edm
0075 #endif