CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
23 
24 #include <map>
25 #include <memory>
26 #include <string>
27 #include <vector>
28 
29 namespace edm {
30  class BranchID;
31  class BranchIDListHelper;
32  class ProductProvenanceRetriever;
33  class DelayedReader;
34  class EventID;
35  class HistoryAppender;
36  class LuminosityBlockPrincipal;
37  class ModuleCallingContext;
38  class ProductID;
39  class StreamContext;
40  class ThinnedAssociation;
41  class ThinnedAssociationsHelper;
42  class ProcessHistoryRegistry;
43  class RunPrincipal;
44  class UnscheduledHandler;
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);
62 
64  ProcessHistoryRegistry const& processHistoryRegistry,
65  DelayedReader* reader = nullptr);
67  ProcessHistoryRegistry const& processHistoryRegistry,
70  //provRetriever is changed via a call to ProductProvenanceRetriever::deepSwap
72  ProcessHistoryRegistry const& processHistoryRegistry,
75  ProductProvenanceRetriever& provRetriever,
76  DelayedReader* reader = nullptr);
77 
78 
79  void clearEventPrincipal();
80 
83  }
84 
87  }
88 
90  return (luminosityBlockPrincipal_) ? true : false;
91  }
92 
93  void setLuminosityBlockPrincipal(std::shared_ptr<LuminosityBlockPrincipal> const& lbp);
94 
96 
97  EventID const& id() const {
98  return aux().id();
99  }
100 
101  Timestamp const& time() const {
102  return aux().time();
103  }
104 
105  bool isReal() const {
106  return aux().isRealData();
107  }
108 
110  return aux().experimentType();
111  }
112 
113  int bunchCrossing() const {
114  return aux().bunchCrossing();
115  }
116 
117  int storeNumber() const {
118  return aux().storeNumber();
119  }
120 
121  EventAuxiliary const& aux() const {
122  return aux_;
123  }
124 
125  StreamID streamID() const { return streamID_;}
126 
128  return id().luminosityBlock();
129  }
130 
131  RunNumber_t run() const {
132  return id().run();
133  }
134 
135  RunPrincipal const& runPrincipal() const;
136 
137  std::shared_ptr<ProductProvenanceRetriever> productProvenanceRetrieverPtr() const {return provRetrieverPtr_;}
138 
139  void setUnscheduledHandler(std::shared_ptr<UnscheduledHandler> iHandler);
140  std::shared_ptr<UnscheduledHandler> unscheduledHandler() const;
141 
143 
144  BranchListIndexes const& branchListIndexes() const;
145 
146  Provenance
147  getProvenance(ProductID const& pid, ModuleCallingContext const* mcc) const;
148 
150  getByProductID(ProductID const& oid) const;
151 
152  void put(
153  BranchDescription const& bd,
154  std::unique_ptr<WrapperBase> edp,
155  ProductProvenance const& productProvenance);
156 
157  void putOnRead(
158  BranchDescription const& bd,
159  std::unique_ptr<WrapperBase> edp,
160  ProductProvenance const& productProvenance);
161 
162  virtual WrapperBase const* getIt(ProductID const& pid) const override;
163  virtual WrapperBase const* getThinnedProduct(ProductID const& pid, unsigned int& key) const override;
164  virtual void getThinnedProducts(ProductID const& pid,
165  std::vector<WrapperBase const*>& foundContainers,
166  std::vector<unsigned int>& keys) const override;
167 
168  ProductID branchIDToProductID(BranchID const& bid) const;
169 
171  provRetrieverPtr_->mergeProvenanceRetrievers(other.productProvenanceRetrieverPtr());
172  }
173 
174  using Base::getProvenance;
175 
178 
179 
180  private:
181 
182  BranchID pidToBid(ProductID const& pid) const;
183 
184  edm::ThinnedAssociation const* getThinnedAssociation(edm::BranchID const& branchID) const;
185 
186  virtual bool unscheduledFill(std::string const& moduleLabel,
187  ModuleCallingContext const* mcc) const override;
188 
189  virtual void readFromSource_(ProductHolderBase const& phb, ModuleCallingContext const* mcc) const override;
190 
191  virtual unsigned int transitionIndex_() const override;
192 
193  private:
194 
196  public:
197  UnscheduledSentry(std::vector<std::string>* moduleLabelsRunning, std::string const& moduleLabel) :
198  moduleLabelsRunning_(moduleLabelsRunning) {
199  moduleLabelsRunning_->push_back(moduleLabel);
200  }
202  moduleLabelsRunning_->pop_back();
203  }
204  private:
205  std::vector<std::string>* moduleLabelsRunning_;
206  };
207 
209 
210  std::shared_ptr<LuminosityBlockPrincipal> luminosityBlockPrincipal_;
211 
212  // Pointer to the 'retriever' that will get provenance information from the persistent store.
213  std::shared_ptr<ProductProvenanceRetriever> provRetrieverPtr_;
214 
215  // Handler for unscheduled modules
216  std::shared_ptr<UnscheduledHandler> unscheduledHandler_;
217 
218  mutable std::vector<std::string> moduleLabelsRunning_;
219 
221 
222  std::shared_ptr<BranchIDListHelper const> branchIDListHelper_;
223  std::shared_ptr<ThinnedAssociationsHelper const> thinnedAssociationsHelper_;
224 
226 
227  std::map<BranchListIndex, ProcessIndex> branchListIndexToProcessIndex_;
228 
230 
231  };
232 
233  inline
234  bool
236  return isSameEvent(a.aux(), b.aux());
237  }
238 }
239 #endif
240 
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
std::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
int bunchCrossing() const
RunNumber_t run() const
std::shared_ptr< UnscheduledHandler > unscheduledHandler_
ProductHolderBase const * ConstProductHolderPtr
Definition: Principal.h:58
EventAuxiliary::ExperimentType ExperimentType() const
BasicHandle getByProductID(ProductID const &oid) const
EventSelectionIDVector eventSelectionIDs_
BranchID pidToBid(ProductID const &pid) const
tuple lumi
Definition: fjr2json.py:35
static int const invalidBunchXing
BranchListIndexes branchListIndexes_
edm::ThinnedAssociation const * getThinnedAssociation(edm::BranchID const &branchID) const
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:759
void mergeProvenanceRetrievers(EventPrincipal const &other)
std::shared_ptr< BranchIDListHelper const > branchIDListHelper_
LuminosityBlockNumber_t luminosityBlock() const
virtual void readFromSource_(ProductHolderBase const &phb, ModuleCallingContext const *mcc) const override
LuminosityBlockPrincipal & luminosityBlockPrincipal()
EventAuxiliary aux_
void putOnRead(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance)
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 bool unscheduledFill(std::string const &moduleLabel, ModuleCallingContext const *mcc) const override
virtual WrapperBase const * getThinnedProduct(ProductID const &pid, unsigned int &key) const override
ExperimentType experimentType() const
Timestamp const & time() const
void setUnscheduledHandler(std::shared_ptr< UnscheduledHandler > iHandler)
std::vector< std::string > * moduleLabelsRunning_
std::vector< BranchListIndex > BranchListIndexes
static int const invalidBunchXing
int storeNumber() const
std::shared_ptr< ProductProvenanceRetriever > productProvenanceRetrieverPtr() const
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
UnscheduledSentry(std::vector< std::string > *moduleLabelsRunning, std::string const &moduleLabel)
EventAuxiliary Auxiliary
StreamID streamID() const
virtual WrapperBase const * getIt(ProductID const &pid) const override
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
DelayedReader * reader() const
Definition: Principal.h:171
static int const invalidStoreNumber
virtual unsigned int transitionIndex_() const override
void put(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance)
std::shared_ptr< UnscheduledHandler > unscheduledHandler() const
bool isReal() const
tuple pid
Definition: sysUtil.py:22
double b
Definition: hdecay.h:120
EventID const & id() const
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
std::shared_ptr< ProductProvenanceRetriever > provRetrieverPtr_
static int const invalidStoreNumber
double a
Definition: hdecay.h:121
Base::ConstProductHolderPtr ConstProductHolderPtr
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)
unsigned int RunNumber_t
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> preModuleDelayedGetSignal_
void setRunAndLumiNumber(RunNumber_t run, LuminosityBlockNumber_t lumi)
bool luminosityBlockPrincipalPtrValid()
EventAuxiliary const & aux() const
virtual void getThinnedProducts(ProductID const &pid, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const override
std::vector< std::string > moduleLabelsRunning_
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> postModuleDelayedGetSignal_