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 
24 
25 #include "boost/shared_ptr.hpp"
26 
27 #include <map>
28 #include <memory>
29 #include <string>
30 #include <vector>
31 
32 namespace edm {
33  class BranchIDListHelper;
34  class ProductProvenanceRetriever;
35  class DelayedReader;
36  class EventID;
37  class HistoryAppender;
38  class LuminosityBlockPrincipal;
39  class ModuleCallingContext;
40  class StreamContext;
41  class ProcessHistoryRegistry;
42  class RunPrincipal;
43  class UnscheduledHandler;
44 
45  class EventPrincipal : public Principal {
46  public:
48  typedef Principal Base;
49 
54  boost::shared_ptr<ProductRegistry const> reg,
55  boost::shared_ptr<BranchIDListHelper const> branchIDListHelper,
56  ProcessConfiguration const& pc,
57  HistoryAppender* historyAppender,
58  unsigned int streamIndex = 0);
60 
62  ProcessHistoryRegistry const& processHistoryRegistry,
63  DelayedReader* reader = nullptr);
65  ProcessHistoryRegistry const& processHistoryRegistry,
68  //provRetriever is changed via a call to ProductProvenanceRetriever::deepSwap
70  ProcessHistoryRegistry const& processHistoryRegistry,
73  ProductProvenanceRetriever& provRetriever,
74  DelayedReader* reader = nullptr);
75 
76 
77  void clearEventPrincipal();
78 
81  }
82 
85  }
86 
88  return (luminosityBlockPrincipal_) ? true : false;
89  }
90 
91  void setLuminosityBlockPrincipal(boost::shared_ptr<LuminosityBlockPrincipal> const& lbp);
92 
94 
95  EventID const& id() const {
96  return aux().id();
97  }
98 
99  Timestamp const& time() const {
100  return aux().time();
101  }
102 
103  bool isReal() const {
104  return aux().isRealData();
105  }
106 
108  return aux().experimentType();
109  }
110 
111  int bunchCrossing() const {
112  return aux().bunchCrossing();
113  }
114 
115  int storeNumber() const {
116  return aux().storeNumber();
117  }
118 
119  EventAuxiliary const& aux() const {
120  return aux_;
121  }
122 
123  StreamID streamID() const { return streamID_;}
124 
126  return id().luminosityBlock();
127  }
128 
129  RunNumber_t run() const {
130  return id().run();
131  }
132 
133  RunPrincipal const& runPrincipal() const;
134 
135  boost::shared_ptr<ProductProvenanceRetriever> productProvenanceRetrieverPtr() const {return provRetrieverPtr_;}
136 
137  void setUnscheduledHandler(boost::shared_ptr<UnscheduledHandler> iHandler);
138  boost::shared_ptr<UnscheduledHandler> unscheduledHandler() const;
139 
141 
142  BranchListIndexes const& branchListIndexes() const;
143 
144  Provenance
145  getProvenance(ProductID const& pid, ModuleCallingContext const* mcc) const;
146 
148  getByProductID(ProductID const& oid) const;
149 
150  void put(
151  BranchDescription const& bd,
152  WrapperOwningHolder const& edp,
153  ProductProvenance const& productProvenance);
154 
155  void putOnRead(
156  BranchDescription const& bd,
157  void const* product,
158  ProductProvenance const& productProvenance);
159 
160  WrapperHolder getIt(ProductID const& pid) const;
161 
162  ProductID branchIDToProductID(BranchID const& bid) const;
163 
165  provRetrieverPtr_->mergeProvenanceRetrievers(other.productProvenanceRetrieverPtr());
166  }
167 
168  using Base::getProvenance;
169 
172 
173 
174  private:
175 
176  BranchID pidToBid(ProductID const& pid) const;
177 
178  virtual bool unscheduledFill(std::string const& moduleLabel,
179  ModuleCallingContext const* mcc) const override;
180 
181  virtual void readFromSource_(ProductHolderBase const& phb, ModuleCallingContext const* mcc) const override;
182 
183  virtual unsigned int transitionIndex_() const override;
184 
185  private:
186 
188  public:
189  UnscheduledSentry(std::vector<std::string>* moduleLabelsRunning, std::string const& moduleLabel) :
190  moduleLabelsRunning_(moduleLabelsRunning) {
191  moduleLabelsRunning_->push_back(moduleLabel);
192  }
194  moduleLabelsRunning_->pop_back();
195  }
196  private:
197  std::vector<std::string>* moduleLabelsRunning_;
198  };
199 
201 
202  boost::shared_ptr<LuminosityBlockPrincipal> luminosityBlockPrincipal_;
203 
204  // Pointer to the 'retriever' that will get provenance information from the persistent store.
205  boost::shared_ptr<ProductProvenanceRetriever> provRetrieverPtr_;
206 
207  // Handler for unscheduled modules
208  boost::shared_ptr<UnscheduledHandler> unscheduledHandler_;
209 
210  mutable std::vector<std::string> moduleLabelsRunning_;
211 
213 
214  boost::shared_ptr<BranchIDListHelper const> branchIDListHelper_;
215 
217 
218  std::map<BranchListIndex, ProcessIndex> branchListIndexToProcessIndex_;
219 
221 
222  };
223 
224  inline
225  bool
227  return isSameEvent(a.aux(), b.aux());
228  }
229 }
230 #endif
231 
RunNumber_t run() const
Definition: EventID.h:42
int storeNumber() const
void setLuminosityBlockPrincipal(boost::shared_ptr< LuminosityBlockPrincipal > const &lbp)
bool isRealData() const
bool isSameEvent(EventAuxiliary const &a, EventAuxiliary const &b)
EventSelectionIDVector const & eventSelectionIDs() const
boost::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
int bunchCrossing() const
RunNumber_t run() const
ProductHolderBase const * ConstProductHolderPtr
Definition: Principal.h:60
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)
LuminosityBlockNumber_t luminosityBlock() const
virtual void readFromSource_(ProductHolderBase const &phb, ModuleCallingContext const *mcc) const override
LuminosityBlockPrincipal & luminosityBlockPrincipal()
EventAuxiliary aux_
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:43
BranchListIndexes const & branchListIndexes() const
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
int bunchCrossing() const
WrapperHolder getIt(ProductID const &pid) 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
ExperimentType experimentType() const
Timestamp const & time() const
std::vector< std::string > * moduleLabelsRunning_
EventPrincipal(boost::shared_ptr< ProductRegistry const > reg, boost::shared_ptr< BranchIDListHelper const > branchIDListHelper, ProcessConfiguration const &pc, HistoryAppender *historyAppender, unsigned int streamIndex=0)
std::vector< BranchListIndex > BranchListIndexes
static int const invalidBunchXing
int storeNumber() const
boost::shared_ptr< UnscheduledHandler > unscheduledHandler() const
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
UnscheduledSentry(std::vector< std::string > *moduleLabelsRunning, std::string const &moduleLabel)
EventAuxiliary Auxiliary
StreamID streamID() const
boost::shared_ptr< UnscheduledHandler > unscheduledHandler_
DelayedReader * reader() const
Definition: Principal.h:173
static int const invalidStoreNumber
virtual unsigned int transitionIndex_() const override
boost::shared_ptr< ProductProvenanceRetriever > productProvenanceRetrieverPtr() const
bool isReal() const
tuple pid
Definition: sysUtil.py:22
double b
Definition: hdecay.h:120
boost::shared_ptr< BranchIDListHelper const > branchIDListHelper_
EventID const & id() const
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
static int const invalidStoreNumber
double a
Definition: hdecay.h:121
Base::ConstProductHolderPtr ConstProductHolderPtr
void setUnscheduledHandler(boost::shared_ptr< UnscheduledHandler > iHandler)
void putOnRead(BranchDescription const &bd, void const *product, ProductProvenance const &productProvenance)
unsigned int RunNumber_t
Definition: EventRange.h:32
boost::shared_ptr< ProductProvenanceRetriever > provRetrieverPtr_
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> preModuleDelayedGetSignal_
void setRunAndLumiNumber(RunNumber_t run, LuminosityBlockNumber_t lumi)
bool luminosityBlockPrincipalPtrValid()
EventAuxiliary const & aux() const
std::vector< std::string > moduleLabelsRunning_
void put(BranchDescription const &bd, WrapperOwningHolder const &edp, ProductProvenance const &productProvenance)
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> postModuleDelayedGetSignal_