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 BranchIDListHelper;
31  class ProductProvenanceRetriever;
32  class DelayedReader;
33  class EventID;
34  class HistoryAppender;
35  class LuminosityBlockPrincipal;
36  class ModuleCallingContext;
37  class StreamContext;
38  class ProcessHistoryRegistry;
39  class RunPrincipal;
40  class UnscheduledHandler;
41 
42  class EventPrincipal : public Principal {
43  public:
45  typedef Principal Base;
46 
51  std::shared_ptr<ProductRegistry const> reg,
52  std::shared_ptr<BranchIDListHelper const> branchIDListHelper,
53  ProcessConfiguration const& pc,
54  HistoryAppender* historyAppender,
55  unsigned int streamIndex = 0);
57 
59  ProcessHistoryRegistry const& processHistoryRegistry,
60  DelayedReader* reader = nullptr);
62  ProcessHistoryRegistry const& processHistoryRegistry,
65  //provRetriever is changed via a call to ProductProvenanceRetriever::deepSwap
67  ProcessHistoryRegistry const& processHistoryRegistry,
70  ProductProvenanceRetriever& provRetriever,
71  DelayedReader* reader = nullptr);
72 
73 
74  void clearEventPrincipal();
75 
78  }
79 
82  }
83 
85  return (luminosityBlockPrincipal_) ? true : false;
86  }
87 
88  void setLuminosityBlockPrincipal(std::shared_ptr<LuminosityBlockPrincipal> const& lbp);
89 
91 
92  EventID const& id() const {
93  return aux().id();
94  }
95 
96  Timestamp const& time() const {
97  return aux().time();
98  }
99 
100  bool isReal() const {
101  return aux().isRealData();
102  }
103 
105  return aux().experimentType();
106  }
107 
108  int bunchCrossing() const {
109  return aux().bunchCrossing();
110  }
111 
112  int storeNumber() const {
113  return aux().storeNumber();
114  }
115 
116  EventAuxiliary const& aux() const {
117  return aux_;
118  }
119 
120  StreamID streamID() const { return streamID_;}
121 
123  return id().luminosityBlock();
124  }
125 
126  RunNumber_t run() const {
127  return id().run();
128  }
129 
130  RunPrincipal const& runPrincipal() const;
131 
132  std::shared_ptr<ProductProvenanceRetriever> productProvenanceRetrieverPtr() const {return provRetrieverPtr_;}
133 
134  void setUnscheduledHandler(std::shared_ptr<UnscheduledHandler> iHandler);
135  std::shared_ptr<UnscheduledHandler> unscheduledHandler() const;
136 
138 
139  BranchListIndexes const& branchListIndexes() const;
140 
141  Provenance
142  getProvenance(ProductID const& pid, ModuleCallingContext const* mcc) const;
143 
145  getByProductID(ProductID const& oid) const;
146 
147  void put(
148  BranchDescription const& bd,
149  std::unique_ptr<WrapperBase> edp,
150  ProductProvenance const& productProvenance);
151 
152  void putOnRead(
153  BranchDescription const& bd,
154  std::unique_ptr<WrapperBase> edp,
155  ProductProvenance const& productProvenance);
156 
157  WrapperBase const* getIt(ProductID const& pid) const;
158 
159  ProductID branchIDToProductID(BranchID const& bid) const;
160 
162  provRetrieverPtr_->mergeProvenanceRetrievers(other.productProvenanceRetrieverPtr());
163  }
164 
165  using Base::getProvenance;
166 
169 
170 
171  private:
172 
173  BranchID pidToBid(ProductID const& pid) const;
174 
175  virtual bool unscheduledFill(std::string const& moduleLabel,
176  ModuleCallingContext const* mcc) const override;
177 
178  virtual void readFromSource_(ProductHolderBase const& phb, ModuleCallingContext const* mcc) const override;
179 
180  virtual unsigned int transitionIndex_() const override;
181 
182  private:
183 
185  public:
186  UnscheduledSentry(std::vector<std::string>* moduleLabelsRunning, std::string const& moduleLabel) :
187  moduleLabelsRunning_(moduleLabelsRunning) {
188  moduleLabelsRunning_->push_back(moduleLabel);
189  }
191  moduleLabelsRunning_->pop_back();
192  }
193  private:
194  std::vector<std::string>* moduleLabelsRunning_;
195  };
196 
198 
199  std::shared_ptr<LuminosityBlockPrincipal> luminosityBlockPrincipal_;
200 
201  // Pointer to the 'retriever' that will get provenance information from the persistent store.
202  std::shared_ptr<ProductProvenanceRetriever> provRetrieverPtr_;
203 
204  // Handler for unscheduled modules
205  std::shared_ptr<UnscheduledHandler> unscheduledHandler_;
206 
207  mutable std::vector<std::string> moduleLabelsRunning_;
208 
210 
211  std::shared_ptr<BranchIDListHelper const> branchIDListHelper_;
212 
214 
215  std::map<BranchListIndex, ProcessIndex> branchListIndexToProcessIndex_;
216 
218 
219  };
220 
221  inline
222  bool
224  return isSameEvent(a.aux(), b.aux());
225  }
226 }
227 #endif
228 
RunNumber_t run() const
Definition: EventID.h:39
int storeNumber() const
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_
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:739
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
WrapperBase const * getIt(ProductID const &pid) const
RunPrincipal const & runPrincipal() const
std::vector< EventSelectionID > EventSelectionIDVector
virtual bool unscheduledFill(std::string const &moduleLabel, ModuleCallingContext const *mcc) 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
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
unsigned int RunNumber_t
Definition: EventRange.h:32
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> preModuleDelayedGetSignal_
void setRunAndLumiNumber(RunNumber_t run, LuminosityBlockNumber_t lumi)
bool luminosityBlockPrincipalPtrValid()
EventAuxiliary const & aux() const
EventPrincipal(std::shared_ptr< ProductRegistry const > reg, std::shared_ptr< BranchIDListHelper const > branchIDListHelper, ProcessConfiguration const &pc, HistoryAppender *historyAppender, unsigned int streamIndex=0)
std::vector< std::string > moduleLabelsRunning_
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> postModuleDelayedGetSignal_