CMS 3D CMS Logo

EventPrincipal.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_EventPrincipal_h
2 #define FWCore_Framework_EventPrincipal_h
3 
4 /*----------------------------------------------------------------------
5 
6 EventPrincipal: This is the class responsible for management of
7 per event EDProducts. It is not seen by reconstruction code;
8 such code sees the Event class, which is a proxy for EventPrincipal.
9 
10 The major internal component of the EventPrincipal
11 is the DataBlock.
12 
13 ----------------------------------------------------------------------*/
14 
24 
25 #include <map>
26 #include <memory>
27 #include <string>
28 #include <vector>
29 
30 namespace edm {
31  class BranchID;
32  class BranchIDListHelper;
33  class ProductProvenanceRetriever;
34  class DelayedReader;
35  class EventID;
36  class HistoryAppender;
37  class LuminosityBlockPrincipal;
38  class ModuleCallingContext;
39  class ProductID;
40  class StreamContext;
41  class ThinnedAssociation;
42  class ThinnedAssociationsHelper;
43  class ProcessHistoryRegistry;
44  class RunPrincipal;
45 
46  class EventPrincipal : public Principal {
47  public:
49  typedef Principal Base;
50 
54  EventPrincipal(std::shared_ptr<ProductRegistry const> reg,
55  std::shared_ptr<BranchIDListHelper const> branchIDListHelper,
56  std::shared_ptr<ThinnedAssociationsHelper const> thinnedAssociationsHelper,
57  ProcessConfiguration const& pc,
58  HistoryAppender* historyAppender,
59  unsigned int streamIndex = 0,
60  bool isForPrimaryProcess = true);
61  ~EventPrincipal() override {}
62 
64  ProcessHistoryRegistry const& processHistoryRegistry,
65  DelayedReader* reader = nullptr);
66  void fillEventPrincipal(EventAuxiliary const& aux,
67  ProcessHistoryRegistry const& processHistoryRegistry,
70  //provRetriever is changed via a call to ProductProvenanceRetriever::deepSwap
71  void fillEventPrincipal(EventAuxiliary const& aux,
72  ProcessHistoryRegistry const& processHistoryRegistry,
75  ProductProvenanceRetriever const& provRetriever,
76  DelayedReader* reader = nullptr,
77  bool deepCopyRetriever = true);
78 
79  void clearEventPrincipal();
80 
82 
84 
85  bool luminosityBlockPrincipalPtrValid() const { return luminosityBlockPrincipal_ != nullptr; }
86 
87  //does not share ownership
89 
91 
92  EventID const& id() const { return aux().id(); }
93 
94  Timestamp const& time() const { return aux().time(); }
95 
96  bool isReal() const { return aux().isRealData(); }
97 
99 
100  int bunchCrossing() const { return aux().bunchCrossing(); }
101 
102  int storeNumber() const { return aux().storeNumber(); }
103 
104  EventAuxiliary const& aux() const { return aux_; }
105 
106  StreamID streamID() const { return streamID_; }
107 
109 
110  RunNumber_t run() const { return id().run(); }
111 
112  RunPrincipal const& runPrincipal() const;
113 
115 
117 
118  BranchListIndexes const& branchListIndexes() const;
119 
120  Provenance getProvenance(ProductID const& pid, ModuleCallingContext const* mcc) const;
121 
122  BasicHandle getByProductID(ProductID const& oid) const;
123 
124  void put(BranchDescription const& bd,
125  std::unique_ptr<WrapperBase> edp,
126  ProductProvenance const& productProvenance) const;
127 
128  void put(ProductResolverIndex index, std::unique_ptr<WrapperBase> edp, ParentageID productProvenance) const;
129 
130  void putOnRead(BranchDescription const& bd,
131  std::unique_ptr<WrapperBase> edp,
132  ProductProvenance const* productProvenance) const;
133 
134  WrapperBase const* getIt(ProductID const& pid) const override;
135  WrapperBase const* getThinnedProduct(ProductID const& pid, unsigned int& key) const override;
136  void getThinnedProducts(ProductID const& pid,
137  std::vector<WrapperBase const*>& foundContainers,
138  std::vector<unsigned int>& keys) const override;
139 
140  ProductID branchIDToProductID(BranchID const& bid) const;
141 
143  provRetrieverPtr_->mergeProvenanceRetrievers(other.provRetrieverPtr());
144  }
145 
146  using Base::getProvenance;
147 
148  private:
149  BranchID pidToBid(ProductID const& pid) const;
150 
151  edm::ThinnedAssociation const* getThinnedAssociation(edm::BranchID const& branchID) const;
152 
153  unsigned int transitionIndex_() const override;
154 
155  std::shared_ptr<ProductProvenanceRetriever const> provRetrieverPtr() const {
157  }
158  std::shared_ptr<ProductProvenanceRetriever>& provRetrieverPtr() { return get_underlying_safe(provRetrieverPtr_); }
159 
160  private:
162 
164 
165  // Pointer to the 'retriever' that will get provenance information from the persistent store.
167 
169 
170  std::shared_ptr<BranchIDListHelper const> branchIDListHelper_;
171  std::shared_ptr<ThinnedAssociationsHelper const> thinnedAssociationsHelper_;
172 
174 
175  std::map<BranchListIndex, ProcessIndex> branchListIndexToProcessIndex_;
176 
178  };
179 
180  inline bool isSameEvent(EventPrincipal const& a, EventPrincipal const& b) { return isSameEvent(a.aux(), b.aux()); }
181 } // namespace edm
182 #endif
RunNumber_t run() const
Definition: EventID.h:39
int storeNumber() const
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper_
void setLuminosityBlockPrincipal(LuminosityBlockPrincipal *lbp)
bool isRealData() const
bool isSameEvent(EventAuxiliary const &a, EventAuxiliary const &b)
EventSelectionIDVector const & eventSelectionIDs() const
WrapperBase const * getThinnedProduct(ProductID const &pid, unsigned int &key) const override
unsigned int ProductResolverIndex
int bunchCrossing() const
RunNumber_t run() const
std::shared_ptr< ProductProvenanceRetriever > & provRetrieverPtr()
EventAuxiliary::ExperimentType ExperimentType() const
BasicHandle getByProductID(ProductID const &oid) const
EventSelectionIDVector eventSelectionIDs_
BranchID pidToBid(ProductID const &pid) const
static int const invalidBunchXing
BranchListIndexes branchListIndexes_
edm::ThinnedAssociation const * getThinnedAssociation(edm::BranchID const &branchID) const
EventPrincipal(std::shared_ptr< ProductRegistry const > reg, std::shared_ptr< BranchIDListHelper const > branchIDListHelper, std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper, ProcessConfiguration const &pc, HistoryAppender *historyAppender, unsigned int streamIndex=0, bool isForPrimaryProcess=true)
EventID const & id() const
Provenance getProvenance(ProductID const &pid, ModuleCallingContext const *mcc) const
Timestamp const & time() const
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
Provenance getProvenance(BranchID const &bid, ModuleCallingContext const *mcc) const
Definition: Principal.cc:796
edm::propagate_const< LuminosityBlockPrincipal * > luminosityBlockPrincipal_
std::shared_ptr< BranchIDListHelper const > branchIDListHelper_
LuminosityBlockNumber_t luminosityBlock() const
LuminosityBlockPrincipal & luminosityBlockPrincipal()
EventAuxiliary aux_
edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > provRetrieverPtr_
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
BranchListIndexes const & branchListIndexes() const
unsigned int LuminosityBlockNumber_t
int bunchCrossing() const
ProductID branchIDToProductID(BranchID const &bid) const
RunPrincipal const & runPrincipal() const
std::vector< EventSelectionID > EventSelectionIDVector
void getThinnedProducts(ProductID const &pid, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const override
ExperimentType experimentType() const
Timestamp const & time() const
void mergeProvenanceRetrievers(EventPrincipal &other)
std::vector< BranchListIndex > BranchListIndexes
static int const invalidBunchXing
int storeNumber() const
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
Base::ConstProductResolverPtr ConstProductResolverPtr
EventAuxiliary Auxiliary
StreamID streamID() const
~EventPrincipal() override
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
void put(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const
ProductProvenanceRetriever const * productProvenanceRetrieverPtr() const
DelayedReader * reader() const
Definition: Principal.h:186
static int const invalidStoreNumber
bool isReal() const
void putOnRead(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, ProductProvenance const *productProvenance) const
double b
Definition: hdecay.h:120
ProductResolverBase const * ConstProductResolverPtr
Definition: Principal.h:64
EventID const & id() const
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
static int const invalidStoreNumber
HLT enums.
double a
Definition: hdecay.h:121
unsigned int transitionIndex_() const override
bool luminosityBlockPrincipalPtrValid() const
unsigned int RunNumber_t
void setRunAndLumiNumber(RunNumber_t run, LuminosityBlockNumber_t lumi)
EventAuxiliary const & aux() const
std::shared_ptr< ProductProvenanceRetriever const > provRetrieverPtr() const
WrapperBase const * getIt(ProductID const &pid) const override