Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-05-19 04:32:58

0001 #ifndef FWCore_Framework_BranchIDListHelper_h
0002 #define FWCore_Framework_BranchIDListHelper_h
0003 
0004 #include "DataFormats/Provenance/interface/BranchListIndex.h"
0005 #include "DataFormats/Provenance/interface/BranchIDList.h"
0006 #include "DataFormats/Provenance/interface/ProductID.h"
0007 #include "DataFormats/Provenance/interface/ProvenanceFwd.h"
0008 
0009 #include <map>
0010 #include <vector>
0011 #include <limits>
0012 
0013 namespace edm {
0014 
0015   class BranchIDListHelper {
0016   public:
0017     typedef std::pair<BranchListIndex, ProductIndex> IndexPair;
0018     typedef std::multimap<BranchID, IndexPair> BranchIDToIndexMap;
0019 
0020     BranchIDListHelper();
0021 
0022     //CMS-THREADING called when a new file is opened
0023     bool updateFromInput(BranchIDLists const& bidlists);
0024 
0025     void updateFromParent(BranchIDLists const& bidlists);
0026 
0027     ///Called by sources to convert their read indexes into the indexes used by the job
0028     bool fixBranchListIndexes(BranchListIndexes& indexes, bool assertOnFailure = true) const;
0029 
0030     void updateFromRegistry(ProductRegistry const& reg);
0031 
0032     //CMS-THREADING this is called in SubJob::beginJob
0033     BranchIDLists& mutableBranchIDLists() { return branchIDLists_; }
0034 
0035     //Used by the EventPrincipal
0036     BranchIDLists const& branchIDLists() const { return branchIDLists_; }
0037     BranchIDToIndexMap const& branchIDToIndexMap() const { return branchIDToIndexMap_; }
0038     BranchListIndex producedBranchListIndex() const { return producedBranchListIndex_; }
0039     bool hasProducedProducts() const { return producedBranchListIndex_ != std::numeric_limits<BranchListIndex>::max(); }
0040 
0041   private:
0042     BranchIDLists branchIDLists_;
0043     BranchIDToIndexMap branchIDToIndexMap_;
0044     std::vector<BranchListIndex> inputIndexToJobIndex_;
0045     BranchListIndex producedBranchListIndex_;
0046     BranchIDLists::size_type nAlreadyCopied_;
0047   };
0048 }  // namespace edm
0049 
0050 #endif