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 
55  std::shared_ptr<ProductRegistry const> reg,
56  std::shared_ptr<BranchIDListHelper const> branchIDListHelper,
57  std::shared_ptr<ThinnedAssociationsHelper const> thinnedAssociationsHelper,
58  ProcessConfiguration const& pc,
59  HistoryAppender* historyAppender,
60  unsigned int streamIndex = 0,
61  bool isForPrimaryProcess = true);
63 
65  ProcessHistoryRegistry const& processHistoryRegistry,
66  DelayedReader* reader = nullptr);
67  void fillEventPrincipal(EventAuxiliary const& aux,
68  ProcessHistoryRegistry const& processHistoryRegistry,
71  //provRetriever is changed via a call to ProductProvenanceRetriever::deepSwap
72  void fillEventPrincipal(EventAuxiliary const& aux,
73  ProcessHistoryRegistry const& processHistoryRegistry,
76  ProductProvenanceRetriever const& provRetriever,
77  DelayedReader* reader = nullptr,
78  bool deepCopyRetriever = true);
79 
80 
81  void clearEventPrincipal();
82 
85  }
86 
89  }
90 
92  return (luminosityBlockPrincipal_) ? true : false;
93  }
94 
95  void setLuminosityBlockPrincipal(std::shared_ptr<LuminosityBlockPrincipal> const& lbp);
96 
98 
99  EventID const& id() const {
100  return aux().id();
101  }
102 
103  Timestamp const& time() const {
104  return aux().time();
105  }
106 
107  bool isReal() const {
108  return aux().isRealData();
109  }
110 
112  return aux().experimentType();
113  }
114 
115  int bunchCrossing() const {
116  return aux().bunchCrossing();
117  }
118 
119  int storeNumber() const {
120  return aux().storeNumber();
121  }
122 
123  EventAuxiliary const& aux() const {
124  return aux_;
125  }
126 
127  StreamID streamID() const { return streamID_;}
128 
130  return id().luminosityBlock();
131  }
132 
133  RunNumber_t run() const {
134  return id().run();
135  }
136 
137  RunPrincipal const& runPrincipal() const;
138 
140 
142 
143  BranchListIndexes const& branchListIndexes() const;
144 
145  Provenance
146  getProvenance(ProductID const& pid, ModuleCallingContext const* mcc) const;
147 
149  getByProductID(ProductID const& oid) const;
150 
151  void put(
152  BranchDescription const& bd,
153  std::unique_ptr<WrapperBase> edp,
154  ProductProvenance const& productProvenance) const;
155 
156  void putOnRead(
157  BranchDescription const& bd,
158  std::unique_ptr<WrapperBase> edp,
159  ProductProvenance const* productProvenance) const;
160 
161  virtual WrapperBase const* getIt(ProductID const& pid) const override;
162  virtual WrapperBase const* getThinnedProduct(ProductID const& pid, unsigned int& key) const override;
163  virtual void getThinnedProducts(ProductID const& pid,
164  std::vector<WrapperBase const*>& foundContainers,
165  std::vector<unsigned int>& keys) const override;
166 
167  ProductID branchIDToProductID(BranchID const& bid) const;
168 
170  provRetrieverPtr_->mergeProvenanceRetrievers(other.provRetrieverPtr());
171  }
172 
173  using Base::getProvenance;
174 
175  private:
176 
177  BranchID pidToBid(ProductID const& pid) const;
178 
179  edm::ThinnedAssociation const* getThinnedAssociation(edm::BranchID const& branchID) const;
180 
181  virtual unsigned int transitionIndex_() const override;
182 
183  std::shared_ptr<ProductProvenanceRetriever const> provRetrieverPtr() const {return get_underlying_safe(provRetrieverPtr_);}
184  std::shared_ptr<ProductProvenanceRetriever>& provRetrieverPtr() {return get_underlying_safe(provRetrieverPtr_);}
185 
186  private:
187 
189 
191 
192  // Pointer to the 'retriever' that will get provenance information from the persistent store.
194 
196 
197  std::shared_ptr<BranchIDListHelper const> branchIDListHelper_;
198  std::shared_ptr<ThinnedAssociationsHelper const> thinnedAssociationsHelper_;
199 
201 
202  std::map<BranchListIndex, ProcessIndex> branchListIndexToProcessIndex_;
203 
205 
206  };
207 
208  inline
209  bool
211  return isSameEvent(a.aux(), b.aux());
212  }
213 }
214 #endif
215 
RunNumber_t run() const
Definition: EventID.h:39
int storeNumber() const
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper_
bool isRealData() const
bool isSameEvent(EventAuxiliary const &a, EventAuxiliary const &b)
void setLuminosityBlockPrincipal(std::shared_ptr< LuminosityBlockPrincipal > const &lbp)
EventSelectionIDVector const & eventSelectionIDs() const
virtual WrapperBase const * getThinnedProduct(ProductID const &pid, unsigned int &key) const override
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:727
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
virtual 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
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:184
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
edm::propagate_const< std::shared_ptr< LuminosityBlockPrincipal > > luminosityBlockPrincipal_
ProductResolverBase const * ConstProductResolverPtr
Definition: Principal.h:63
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
virtual 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
virtual WrapperBase const * getIt(ProductID const &pid) const override