CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
26 
27 #include <map>
28 #include <memory>
29 #include <string>
30 #include <vector>
31 #include <optional>
32 
33 namespace edm {
34  class BranchID;
35  class BranchIDListHelper;
36  class ProductProvenanceRetriever;
37  class DelayedReader;
38  class EventID;
39  class HistoryAppender;
40  class LuminosityBlockPrincipal;
41  class ModuleCallingContext;
42  class ProductID;
43  class StreamContext;
44  class ThinnedAssociation;
45  class ThinnedAssociationsHelper;
46  class RunPrincipal;
47 
48  class EventPrincipal : public Principal {
49  public:
51  typedef Principal Base;
52 
56  EventPrincipal(std::shared_ptr<ProductRegistry const> reg,
57  std::shared_ptr<BranchIDListHelper const> branchIDListHelper,
58  std::shared_ptr<ThinnedAssociationsHelper const> thinnedAssociationsHelper,
59  ProcessConfiguration const& pc,
60  HistoryAppender* historyAppender,
61  unsigned int streamIndex = 0,
62  bool isForPrimaryProcess = true,
63  ProcessBlockHelperBase const* processBlockHelper = nullptr);
64  ~EventPrincipal() override {}
65 
68  DelayedReader* reader = nullptr);
73  DelayedReader* reader = nullptr);
74  //provRetriever is changed via a call to ProductProvenanceRetriever::deepSwap
80  ProductProvenanceRetriever const& provRetriever,
81  DelayedReader* reader = nullptr,
82  bool deepCopyRetriever = true);
83 
84  void clearEventPrincipal();
85 
87 
89 
90  bool luminosityBlockPrincipalPtrValid() const { return luminosityBlockPrincipal_ != nullptr; }
91 
92  //does not share ownership
94 
96 
97  EventID const& id() const { return aux().id(); }
98 
99  Timestamp const& time() const { return aux().time(); }
100 
101  bool isReal() const { return aux().isRealData(); }
102 
104 
105  int bunchCrossing() const { return aux().bunchCrossing(); }
106 
107  int storeNumber() const { return aux().storeNumber(); }
108 
109  EventAuxiliary const& aux() const { return aux_; }
110 
111  StreamID streamID() const { return streamID_; }
112 
114 
115  RunNumber_t run() const { return id().run(); }
116 
117  RunPrincipal const& runPrincipal() const;
118 
120 
122 
123  BranchListIndexes const& branchListIndexes() const;
124 
126 
127  Provenance const& getProvenance(ProductID const& pid) const;
128  StableProvenance const& getStableProvenance(ProductID const& pid) const;
129 
130  BasicHandle getByProductID(ProductID const& oid) const;
131 
132  void put(BranchDescription const& bd,
133  std::unique_ptr<WrapperBase> edp,
134  ProductProvenance const& productProvenance) const;
135 
136  void put(ProductResolverIndex index, std::unique_ptr<WrapperBase> edp, ParentageID productProvenance) const;
137 
138  void putOnRead(BranchDescription const& bd,
139  std::unique_ptr<WrapperBase> edp,
140  std::optional<ProductProvenance> productProvenance) const;
141 
142  WrapperBase const* getIt(ProductID const& pid) const override;
143  std::optional<std::tuple<WrapperBase const*, unsigned int>> getThinnedProduct(ProductID const& pid,
144  unsigned int key) const override;
145  void getThinnedProducts(ProductID const& pid,
146  std::vector<WrapperBase const*>& foundContainers,
147  std::vector<unsigned int>& keys) const override;
149  unsigned int key,
150  ProductID const& thinned) const override;
151 
152  ProductID branchIDToProductID(BranchID const& bid) const;
153 
155  provRetrieverPtr_->mergeProvenanceRetrievers(other.provRetrieverPtr());
156  }
157 
158  using Base::getProvenance;
160 
161  unsigned int processBlockIndex(std::string const& processName) const override;
162 
163  private:
164  BranchID pidToBid(ProductID const& pid) const;
165 
166  edm::ThinnedAssociation const* getThinnedAssociation(edm::BranchID const& branchID) const;
167 
168  unsigned int transitionIndex_() const override;
169  void changedIndexes_() final;
170 
173  }
174  std::shared_ptr<ProductProvenanceRetriever>& provRetrieverPtr() { return get_underlying_safe(provRetrieverPtr_); }
175 
181 
182  private:
184 
186 
187  // Pointer to the 'retriever' that will get provenance information from the persistent store.
189 
191 
192  std::shared_ptr<BranchIDListHelper const> branchIDListHelper_;
194  std::shared_ptr<ThinnedAssociationsHelper const> thinnedAssociationsHelper_;
195 
197 
199 
200  std::vector<ProcessIndex> branchListIndexToProcessIndex_;
201 
203  };
204 
205  inline bool isSameEvent(EventPrincipal const& a, EventPrincipal const& b) { return isSameEvent(a.aux(), b.aux()); }
206 } // namespace edm
207 #endif
RunNumber_t run() const
Definition: EventID.h:38
int storeNumber() const
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper_
void setLuminosityBlockPrincipal(LuminosityBlockPrincipal *lbp)
void commonFillEventPrincipal(EventAuxiliary const &aux, ProcessHistory const *processHistory, DelayedReader *reader)
bool isRealData() const
bool isSameEvent(EventAuxiliary const &a, EventAuxiliary const &b)
EventToProcessBlockIndexes const & eventToProcessBlockIndexes() const
EventSelectionIDVector const & eventSelectionIDs() const
unsigned int ProductResolverIndex
int bunchCrossing() const
std::variant< unsigned int, detail::GetThinnedKeyFromExceptionFactory, std::monostate > OptionalThinnedKey
RunNumber_t run() const
std::shared_ptr< ProductProvenanceRetriever > & provRetrieverPtr()
EventToProcessBlockIndexes eventToProcessBlockIndexes_
EventAuxiliary::ExperimentType ExperimentType() const
BasicHandle getByProductID(ProductID const &oid) const
EventSelectionIDVector eventSelectionIDs_
unsigned int processBlockIndex(std::string const &processName) const override
BranchID pidToBid(ProductID const &pid) const
static int const invalidBunchXing
BranchListIndexes branchListIndexes_
edm::ThinnedAssociation const * getThinnedAssociation(edm::BranchID const &branchID) const
EventID const & id() const
Timestamp const & time() const
StableProvenance const & getStableProvenance(ProductID const &pid) const
StableProvenance const & getStableProvenance(BranchID const &bid) const
Definition: Principal.cc:850
edm::propagate_const< LuminosityBlockPrincipal * > luminosityBlockPrincipal_
void changedIndexes_() final
std::shared_ptr< BranchIDListHelper const > branchIDListHelper_
LuminosityBlockNumber_t luminosityBlock() const
LuminosityBlockPrincipal & luminosityBlockPrincipal()
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
EventAuxiliary aux_
edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > provRetrieverPtr_
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
OptionalThinnedKey getThinnedKeyFrom(ProductID const &parent, unsigned int key, ProductID const &thinned) const override
BranchListIndexes const & branchListIndexes() const
unsigned int LuminosityBlockNumber_t
int bunchCrossing() const
ProcessHistory const & processHistory() const
Definition: Principal.h:140
ProductID branchIDToProductID(BranchID const &bid) const
Provenance const & getProvenance(ProductID const &pid) const
RunPrincipal const & runPrincipal() const
std::vector< EventSelectionID > EventSelectionIDVector
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
tuple key
prepare the HTCondor submission files and eventually submit them
WrapperBase const * getIt(ProductID const &pid) const override
void updateBranchListIndexes(BranchListIndexes &&)
~EventPrincipal() override
void put(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const
list lumi
Definition: dqmdumpme.py:53
ProductProvenanceRetriever const * productProvenanceRetrieverPtr() 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, ProcessBlockHelperBase const *processBlockHelper=nullptr)
std::vector< ProcessIndex > branchListIndexToProcessIndex_
DelayedReader * reader() const
Definition: Principal.h:187
static int const invalidStoreNumber
unsigned int transitionIndex_() const override
bool isReal() const
double b
Definition: hdecay.h:118
void putOnRead(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, std::optional< ProductProvenance > productProvenance) const
ProductResolverBase const * ConstProductResolverPtr
Definition: Principal.h:62
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistory const *processHistory, DelayedReader *reader=nullptr)
ProcessBlockHelperBase const * processBlockHelper_
EventID const & id() const
static int const invalidStoreNumber
double a
Definition: hdecay.h:119
bool wasBranchListIndexesChangedFromInput(BranchListIndexes const &) const
Provenance const & getProvenance(BranchID const &bid) const
Definition: Principal.cc:837
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
void getThinnedProducts(ProductID const &pid, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const override
std::optional< std::tuple< WrapperBase const *, unsigned int > > getThinnedProduct(ProductID const &pid, unsigned int key) const override