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 
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  //provRetriever is changed via a call to ProductProvenanceRetriever::deepSwap
79  ProductProvenanceRetriever const& provRetriever,
80  DelayedReader* reader = nullptr,
81  bool deepCopyRetriever = true);
82 
83  void clearEventPrincipal();
84 
86 
88 
89  bool luminosityBlockPrincipalPtrValid() const { return luminosityBlockPrincipal_ != nullptr; }
90 
91  //does not share ownership
93 
95 
96  EventID const& id() const { return aux().id(); }
97 
98  Timestamp const& time() const { return aux().time(); }
99 
100  bool isReal() const { return aux().isRealData(); }
101 
103 
104  int bunchCrossing() const { return aux().bunchCrossing(); }
105 
106  int storeNumber() const { return aux().storeNumber(); }
107 
108  EventAuxiliary const& aux() const { return aux_; }
109 
110  StreamID streamID() const { return streamID_; }
111 
113 
114  RunNumber_t run() const { return id().run(); }
115 
116  RunPrincipal const& runPrincipal() const;
117 
119 
121 
122  BranchListIndexes const& branchListIndexes() const;
123 
125 
126  Provenance const& getProvenance(ProductID const& pid) const;
127  StableProvenance const& getStableProvenance(ProductID const& pid) const;
128 
129  BasicHandle getByProductID(ProductID const& oid) const;
130 
131  void put(BranchDescription const& bd,
132  std::unique_ptr<WrapperBase> edp,
133  ProductProvenance const& productProvenance) const;
134 
135  void put(ProductResolverIndex index, std::unique_ptr<WrapperBase> edp, ParentageID productProvenance) const;
136 
137  void putOnRead(BranchDescription const& bd,
138  std::unique_ptr<WrapperBase> edp,
139  std::optional<ProductProvenance> productProvenance) const;
140 
141  WrapperBase const* getIt(ProductID const& pid) const override;
142  std::optional<std::tuple<WrapperBase const*, unsigned int>> getThinnedProduct(ProductID const& pid,
143  unsigned int key) const override;
144  void getThinnedProducts(ProductID const& pid,
145  std::vector<WrapperBase const*>& foundContainers,
146  std::vector<unsigned int>& keys) const override;
148  unsigned int key,
149  ProductID const& thinned) const override;
150 
151  ProductID branchIDToProductID(BranchID const& bid) const;
152 
154  provRetrieverPtr_->mergeProvenanceRetrievers(other.provRetrieverPtr());
155  }
156 
157  using Base::getProvenance;
159 
160  unsigned int processBlockIndex(std::string const& processName) const override;
161 
162  private:
163  BranchID pidToBid(ProductID const& pid) const;
164 
165  edm::ThinnedAssociation const* getThinnedAssociation(edm::BranchID const& branchID) const;
166 
167  unsigned int transitionIndex_() const override;
168  void changedIndexes_() final;
169 
172  }
173  std::shared_ptr<ProductProvenanceRetriever>& provRetrieverPtr() { return get_underlying_safe(provRetrieverPtr_); }
174 
180 
181  private:
183 
185 
186  // Pointer to the 'retriever' that will get provenance information from the persistent store.
188 
190 
191  std::shared_ptr<BranchIDListHelper const> branchIDListHelper_;
193  std::shared_ptr<ThinnedAssociationsHelper const> thinnedAssociationsHelper_;
194 
196 
198 
199  std::vector<ProcessIndex> branchListIndexToProcessIndex_;
200 
202  };
203 
204  inline bool isSameEvent(EventPrincipal const& a, EventPrincipal const& b) { return isSameEvent(a.aux(), b.aux()); }
205 } // namespace edm
206 #endif
edm::EventPrincipal::ExperimentType
EventAuxiliary::ExperimentType ExperimentType() const
Definition: EventPrincipal.h:102
edm::StreamID
Definition: StreamID.h:30
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
edm::EventPrincipal::branchIDListHelper_
std::shared_ptr< BranchIDListHelper const > branchIDListHelper_
Definition: EventPrincipal.h:191
edm::EventPrincipal::luminosityBlockPrincipal_
edm::propagate_const< LuminosityBlockPrincipal * > luminosityBlockPrincipal_
Definition: EventPrincipal.h:184
edm::EventPrincipal::aux
EventAuxiliary const & aux() const
Definition: EventPrincipal.h:108
edm::EventPrincipal::Auxiliary
EventAuxiliary Auxiliary
Definition: EventPrincipal.h:50
edm::ProductResolverIndex
unsigned int ProductResolverIndex
Definition: ProductResolverIndex.h:8
edm::EventPrincipal::luminosityBlockPrincipal
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
Definition: EventPrincipal.h:85
edm::EventToProcessBlockIndexes
Definition: EventToProcessBlockIndexes.h:12
edm::EventPrincipal::provRetrieverPtr
std::shared_ptr< ProductProvenanceRetriever const > provRetrieverPtr() const
Definition: EventPrincipal.h:170
edm::EventAuxiliary::invalidStoreNumber
static const int invalidStoreNumber
Definition: EventAuxiliary.h:29
edm::BasicHandle
Definition: BasicHandle.h:43
edm::EventPrincipal::aux_
EventAuxiliary aux_
Definition: EventPrincipal.h:182
edm::EventAuxiliary::storeNumber
int storeNumber() const
Definition: EventAuxiliary.h:78
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::EventPrincipal::getIt
WrapperBase const * getIt(ProductID const &pid) const override
Definition: EventPrincipal.cc:312
deep_tau::DeepTauBase::BasicDiscriminator
BasicDiscriminator
Definition: DeepTauBase.h:115
edm::EventPrincipal::mergeProvenanceRetrievers
void mergeProvenanceRetrievers(EventPrincipal &other)
Definition: EventPrincipal.h:153
edm::EventPrincipal::thinnedAssociationsHelper_
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper_
Definition: EventPrincipal.h:193
edm::Principal::ConstProductResolverPtr
ProductResolverBase const * ConstProductResolverPtr
Definition: Principal.h:62
edm::EventPrincipal::getThinnedProduct
std::optional< std::tuple< WrapperBase const *, unsigned int > > getThinnedProduct(ProductID const &pid, unsigned int key) const override
Definition: EventPrincipal.cc:314
edm::LuminosityBlockPrincipal
Definition: LuminosityBlockPrincipal.h:31
edm::BranchListIndexes
std::vector< BranchListIndex > BranchListIndexes
Definition: BranchListIndex.h:18
edm::ThinnedAssociation
Definition: ThinnedAssociation.h:15
edm::EventPrincipal::EventPrincipal
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)
Definition: EventPrincipal.cc:33
edm::Principal
Definition: Principal.h:56
edm::EventPrincipal::isReal
bool isReal() const
Definition: EventPrincipal.h:100
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
edm::get_underlying_safe
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:41
edm::EventPrincipal::provRetrieverPtr
std::shared_ptr< ProductProvenanceRetriever > & provRetrieverPtr()
Definition: EventPrincipal.h:173
edm::Principal::processHistory
ProcessHistory const & processHistory() const
Definition: Principal.h:140
edm::EventID::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
watchdog.const
const
Definition: watchdog.py:83
edm::LuminosityBlockNumber_t
unsigned int LuminosityBlockNumber_t
Definition: RunLumiEventNumber.h:13
edm::EventPrincipal::id
EventID const & id() const
Definition: EventPrincipal.h:96
edm::EventPrincipal::processBlockHelper_
ProcessBlockHelperBase const * processBlockHelper_
Definition: EventPrincipal.h:192
edm::EventAuxiliary::bunchCrossing
int bunchCrossing() const
Definition: EventAuxiliary.h:76
edm::EventPrincipal::setRunAndLumiNumber
void setRunAndLumiNumber(RunNumber_t run, LuminosityBlockNumber_t lumi)
Definition: EventPrincipal.cc:176
edm::EventPrincipal::productProvenanceRetrieverPtr
ProductProvenanceRetriever const * productProvenanceRetrieverPtr() const
Definition: EventPrincipal.h:118
edm::EventPrincipal::branchListIndexes
BranchListIndexes const & branchListIndexes() const
Definition: EventPrincipal.cc:376
edm::EventPrincipal::eventToProcessBlockIndexes_
EventToProcessBlockIndexes eventToProcessBlockIndexes_
Definition: EventPrincipal.h:197
edm::propagate_const
Definition: propagate_const.h:32
edm::EventPrincipal::time
Timestamp const & time() const
Definition: EventPrincipal.h:98
edm::EventPrincipal::provRetrieverPtr_
edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > provRetrieverPtr_
Definition: EventPrincipal.h:187
edm::EventPrincipal::changedIndexes_
void changedIndexes_() final
Definition: EventPrincipal.cc:266
edm::EventPrincipal::ConstProductResolverPtr
Base::ConstProductResolverPtr ConstProductResolverPtr
Definition: EventPrincipal.h:53
edm::EventPrincipal
Definition: EventPrincipal.h:48
edm::ProductProvenance
Definition: ProductProvenance.h:24
edm::EventPrincipal::getThinnedAssociation
edm::ThinnedAssociation const * getThinnedAssociation(edm::BranchID const &branchID) const
Definition: EventPrincipal.cc:382
edm::Principal::getProvenance
Provenance const & getProvenance(BranchID const &bid) const
Definition: Principal.cc:837
BranchListIndex.h
edm::BranchID
Definition: BranchID.h:14
edm::Principal::reader
DelayedReader * reader() const
Definition: Principal.h:187
edm::EventAuxiliary::id
EventID const & id() const
Definition: EventAuxiliary.h:63
edm::Hash< ParentageType >
trackingPlots.other
other
Definition: trackingPlots.py:1464
b
double b
Definition: hdecay.h:118
edm::EventPrincipal::put
void put(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const
Definition: EventPrincipal.cc:185
edm::EventAuxiliary::experimentType
ExperimentType experimentType() const
Definition: EventAuxiliary.h:75
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
WrapperBase.h
edm::EventAuxiliary
Definition: EventAuxiliary.h:14
edm::EventPrincipal::getThinnedKeyFrom
OptionalThinnedKey getThinnedKeyFrom(ProductID const &parent, unsigned int key, ProductID const &thinned) const override
Definition: EventPrincipal.cc:338
Principal.h
edm::ProcessBlockHelperBase
Definition: ProcessBlockHelperBase.h:18
a
double a
Definition: hdecay.h:119
edm::EventPrincipal::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventPrincipal.h:112
edm::EventPrincipal::getProvenance
Provenance const & getProvenance(ProductID const &pid) const
Definition: EventPrincipal.cc:364
edm::StableProvenance
Definition: StableProvenance.h:30
edm::EventPrincipal::branchListIndexToProcessIndex_
std::vector< ProcessIndex > branchListIndexToProcessIndex_
Definition: EventPrincipal.h:199
edm::EventPrincipal::storeNumber
int storeNumber() const
Definition: EventPrincipal.h:106
edm::EventPrincipal::invalidBunchXing
static const int invalidBunchXing
Definition: EventPrincipal.h:54
edm::EventPrincipal::setLuminosityBlockPrincipal
void setLuminosityBlockPrincipal(LuminosityBlockPrincipal *lbp)
Definition: EventPrincipal.cc:174
edm::EventPrincipal::commonFillEventPrincipal
void commonFillEventPrincipal(EventAuxiliary const &aux, ProcessHistory const *processHistory, DelayedReader *reader)
Definition: EventPrincipal.cc:123
edm::EventPrincipal::putOnRead
void putOnRead(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, std::optional< ProductProvenance > productProvenance) const
Definition: EventPrincipal.cc:216
edm::EventPrincipal::eventSelectionIDs
EventSelectionIDVector const & eventSelectionIDs() const
Definition: EventPrincipal.cc:374
edm::Principal::getStableProvenance
StableProvenance const & getStableProvenance(BranchID const &bid) const
Definition: Principal.cc:850
edm::WrapperBase
Definition: WrapperBase.h:23
Signal.h
edm::EventAuxiliary::time
Timestamp const & time() const
Definition: EventAuxiliary.h:66
edm::EventPrincipal::streamID
StreamID streamID() const
Definition: EventPrincipal.h:110
edm::HistoryAppender
Definition: HistoryAppender.h:13
edm::EventPrincipal::updateBranchListIndexes
void updateBranchListIndexes(BranchListIndexes &&)
Definition: EventPrincipal.cc:146
edm::EventPrincipal::bunchCrossing
int bunchCrossing() const
Definition: EventPrincipal.h:104
edm::EventPrincipal::Base
Principal Base
Definition: EventPrincipal.h:51
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::EventPrincipal::eventSelectionIDs_
EventSelectionIDVector eventSelectionIDs_
Definition: EventPrincipal.h:189
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
edm::EventPrincipal::getByProductID
BasicHandle getByProductID(ProductID const &oid) const
Definition: EventPrincipal.cc:278
edm::EventPrincipal::fillEventPrincipal
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistory const *processHistory, DelayedReader *reader=nullptr)
Definition: EventPrincipal.cc:110
ProductProvenanceRetriever.h
edm::OptionalThinnedKey
std::variant< unsigned int, detail::GetThinnedKeyFromExceptionFactory, std::monostate > OptionalThinnedKey
Definition: EDProductGetter.h:39
edm::EventPrincipal::getThinnedProducts
void getThinnedProducts(ProductID const &pid, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const override
Definition: EventPrincipal.cc:325
edm::ProductProvenanceRetriever
Definition: ProductProvenanceRetriever.h:37
edm::EventPrincipal::getStableProvenance
StableProvenance const & getStableProvenance(ProductID const &pid) const
Definition: EventPrincipal.cc:369
edm::EventPrincipal::run
RunNumber_t run() const
Definition: EventPrincipal.h:114
std
Definition: JetResolutionObject.h:76
edm::EventPrincipal::luminosityBlockPrincipal
LuminosityBlockPrincipal & luminosityBlockPrincipal()
Definition: EventPrincipal.h:87
edm::EventPrincipal::clearEventPrincipal
void clearEventPrincipal()
Definition: EventPrincipal.cc:61
edm::EventPrincipal::branchIDToProductID
ProductID branchIDToProductID(BranchID const &bid) const
Definition: EventPrincipal.cc:236
edm::EventAuxiliary::ExperimentType
ExperimentType
Definition: EventAuxiliary.h:18
EventAuxiliary.h
edm::EventPrincipal::processBlockIndex
unsigned int processBlockIndex(std::string const &processName) const override
Definition: EventPrincipal.cc:260
edm::isSameEvent
bool isSameEvent(EventAuxiliary const &a, EventAuxiliary const &b)
Definition: EventAuxiliary.cc:15
edm::EventPrincipal::streamID_
StreamID streamID_
Definition: EventPrincipal.h:201
edm::EventAuxiliary::invalidBunchXing
static const int invalidBunchXing
Definition: EventAuxiliary.h:28
edm::DelayedReader
Definition: DelayedReader.h:29
edm::EventPrincipal::invalidStoreNumber
static const int invalidStoreNumber
Definition: EventPrincipal.h:55
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::EventPrincipal::luminosityBlockPrincipalPtrValid
bool luminosityBlockPrincipalPtrValid() const
Definition: EventPrincipal.h:89
edm::EventPrincipal::transitionIndex_
unsigned int transitionIndex_() const override
Definition: EventPrincipal.cc:264
edm::EventPrincipal::~EventPrincipal
~EventPrincipal() override
Definition: EventPrincipal.h:64
edm::BranchDescription
Definition: BranchDescription.h:32
edm::EventPrincipal::pidToBid
BranchID pidToBid(ProductID const &pid) const
Definition: EventPrincipal.cc:229
edm::ProcessHistory
Definition: ProcessHistory.h:13
edm::EventAuxiliary::isRealData
bool isRealData() const
Definition: EventAuxiliary.h:74
edm::RunPrincipal
Definition: RunPrincipal.h:34
EventToProcessBlockIndexes.h
edm::Provenance
Definition: Provenance.h:34
edm::EventID
Definition: EventID.h:31
edm::EventSelectionIDVector
std::vector< EventSelectionID > EventSelectionIDVector
Definition: EventSelectionID.h:16
get_underlying_safe.h
crabWrapper.key
key
Definition: crabWrapper.py:19
lumi
Definition: LumiSectionData.h:20
StreamID.h
edm::EventPrincipal::runPrincipal
RunPrincipal const & runPrincipal() const
Definition: EventPrincipal.cc:183
class-composition.parent
parent
Definition: class-composition.py:98
edm::EventPrincipal::eventToProcessBlockIndexes
EventToProcessBlockIndexes const & eventToProcessBlockIndexes() const
Definition: EventPrincipal.cc:378
edm::ProductID
Definition: ProductID.h:27
edm::ProcessConfiguration
Definition: ProcessConfiguration.h:14
edm::EventPrincipal::branchListIndexes_
BranchListIndexes branchListIndexes_
Definition: EventPrincipal.h:195
edm::EventPrincipal::wasBranchListIndexesChangedFromInput
bool wasBranchListIndexesChangedFromInput(BranchListIndexes const &) const
Definition: EventPrincipal.cc:136
EventSelectionID.h
FWCoreCommonFwd.h
edm::Timestamp
Definition: Timestamp.h:30