Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:45

0001 #ifndef Streamer_StreamedProducts_h
0002 #define Streamer_StreamedProducts_h
0003 
0004 /*
0005   Simple packaging of all the event data that is needed to be serialized
0006   for transfer.
0007 
0008   The "other stuff in the SendEvent still needs to be
0009   populated.
0010 
0011   The product is paired with its provenance, and the entire event
0012   is captured in the SendEvent structure.
0013  */
0014 
0015 #include <vector>
0016 #include "DataFormats/Provenance/interface/BranchDescription.h"
0017 #include "DataFormats/Provenance/interface/BranchID.h"
0018 #include "DataFormats/Provenance/interface/EventAuxiliary.h"
0019 #include "DataFormats/Provenance/interface/ParameterSetID.h"
0020 #include "DataFormats/Provenance/interface/ParameterSetBlob.h"
0021 #include "DataFormats/Provenance/interface/EventSelectionID.h"
0022 #include "DataFormats/Provenance/interface/BranchListIndex.h"
0023 #include "DataFormats/Provenance/interface/ProcessHistory.h"
0024 #include "DataFormats/Provenance/interface/BranchIDList.h"
0025 #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h"
0026 
0027 namespace edm {
0028 
0029   // ------------------------------------------
0030 
0031   class WrapperBase;
0032   class StreamedProduct {
0033   public:
0034     StreamedProduct() : prod_(nullptr), desc_(nullptr), present_(false), parents_(nullptr) {}
0035     explicit StreamedProduct(BranchDescription const& desc)
0036         : prod_(nullptr), desc_(&desc), present_(false), parents_(nullptr) {}
0037 
0038     StreamedProduct(WrapperBase const* prod,
0039                     BranchDescription const& desc,
0040                     bool present,
0041                     std::vector<BranchID> const* parents);
0042 
0043     BranchDescription const* desc() const { return desc_; }
0044     BranchID branchID() const { return desc_->branchID(); }
0045     bool present() const { return present_; }
0046     std::vector<BranchID> const* parents() const { return parents_; }
0047     WrapperBase const* prod() { return prod_; }
0048 
0049     void clear() {
0050       prod_ = nullptr;
0051       delete desc_;
0052       desc_ = nullptr;
0053       present_ = false;
0054       delete parents_;
0055       parents_ = nullptr;
0056     }
0057 
0058   private:
0059     WrapperBase const* prod_;
0060     BranchDescription const* desc_;
0061     bool present_;
0062     std::vector<BranchID> const* parents_;
0063   };
0064 
0065   // ------------------------------------------
0066 
0067   typedef std::vector<StreamedProduct> SendProds;
0068 
0069   // ------------------------------------------
0070 
0071   class SendEvent {
0072   public:
0073     SendEvent() {}
0074     SendEvent(EventAuxiliary const& aux,
0075               ProcessHistory const& processHistory,
0076               EventSelectionIDVector const& eventSelectionIDs,
0077               BranchListIndexes const& branchListIndexes)
0078         : aux_(aux),
0079           processHistory_(processHistory),
0080           eventSelectionIDs_(eventSelectionIDs),
0081           branchListIndexes_(branchListIndexes),
0082           products_() {}
0083     EventAuxiliary const& aux() const { return aux_; }
0084     SendProds const& products() const { return products_; }
0085     ProcessHistory const& processHistory() const { return processHistory_; }
0086     EventSelectionIDVector const& eventSelectionIDs() const { return eventSelectionIDs_; }
0087     BranchListIndexes const& branchListIndexes() const { return branchListIndexes_; }
0088     SendProds& products() { return products_; }
0089 
0090   private:
0091     EventAuxiliary aux_;
0092     ProcessHistory processHistory_;
0093     EventSelectionIDVector eventSelectionIDs_;
0094     BranchListIndexes branchListIndexes_;
0095     SendProds products_;
0096 
0097     // other tables necessary for provenance lookup
0098   };
0099 
0100   typedef std::vector<BranchDescription> SendDescs;
0101 
0102   class SendJobHeader {
0103   public:
0104     typedef std::map<ParameterSetID, ParameterSetBlob> ParameterSetMap;
0105     SendJobHeader() {}
0106     SendDescs const& descs() const { return descs_; }
0107     ParameterSetMap const& processParameterSet() const { return processParameterSet_; }
0108     BranchIDLists const& branchIDLists() const { return branchIDLists_; }
0109     ThinnedAssociationsHelper const& thinnedAssociationsHelper() const { return thinnedAssociationsHelper_; }
0110     void push_back(BranchDescription const& bd) { descs_.push_back(bd); }
0111     void setParameterSetMap(ParameterSetMap const& psetMap) { processParameterSet_ = psetMap; }
0112     void setBranchIDLists(BranchIDLists const& bidlists) { branchIDLists_ = bidlists; }
0113     void setThinnedAssociationsHelper(ThinnedAssociationsHelper const& v) { thinnedAssociationsHelper_ = v; }
0114     void initializeTransients();
0115 
0116   private:
0117     SendDescs descs_;
0118     ParameterSetMap processParameterSet_;
0119     BranchIDLists branchIDLists_;
0120     ThinnedAssociationsHelper thinnedAssociationsHelper_;
0121     // trigger bit descriptions will be added here and permanent
0122     //  provenance values
0123   };
0124 
0125 }  // namespace edm
0126 #endif