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 <map>
26 #include <memory>
27 #include <string>
28 #include <vector>
29 
30 namespace edm {
31  class BranchID;
32  class BranchIDListHelper;
33  class ProductProvenanceRetriever;
34  class DelayedReader;
35  class EventID;
36  class HistoryAppender;
37  class LuminosityBlockPrincipal;
38  class ModuleCallingContext;
39  class ProductID;
40  class StreamContext;
41  class ThinnedAssociation;
42  class ThinnedAssociationsHelper;
43  class ProcessHistoryRegistry;
44  class RunPrincipal;
45  class UnscheduledHandler;
46 
47  class EventPrincipal : public Principal {
48  public:
50  typedef Principal Base;
51 
56  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);
63 
65  ProcessHistoryRegistry const& processHistoryRegistry,
66  DelayedReader* reader = nullptr);
68  ProcessHistoryRegistry const& processHistoryRegistry,
71  //provRetriever is changed via a call to ProductProvenanceRetriever::deepSwap
73  ProcessHistoryRegistry const& processHistoryRegistry,
76  ProductProvenanceRetriever const& provRetriever,
77  DelayedReader* reader = nullptr);
78 
79 
80  void clearEventPrincipal();
81 
84  }
85 
88  }
89 
91  return (luminosityBlockPrincipal_) ? true : false;
92  }
93 
94  void setLuminosityBlockPrincipal(std::shared_ptr<LuminosityBlockPrincipal> const& lbp);
95 
97 
98  EventID const& id() const {
99  return aux().id();
100  }
101 
102  Timestamp const& time() const {
103  return aux().time();
104  }
105 
106  bool isReal() const {
107  return aux().isRealData();
108  }
109 
111  return aux().experimentType();
112  }
113 
114  int bunchCrossing() const {
115  return aux().bunchCrossing();
116  }
117 
118  int storeNumber() const {
119  return aux().storeNumber();
120  }
121 
122  EventAuxiliary const& aux() const {
123  return aux_;
124  }
125 
126  StreamID streamID() const { return streamID_;}
127 
129  return id().luminosityBlock();
130  }
131 
132  RunNumber_t run() const {
133  return id().run();
134  }
135 
136  RunPrincipal const& runPrincipal() const;
137 
139 
140  void setUnscheduledHandler(std::shared_ptr<UnscheduledHandler> iHandler);
141  std::shared_ptr<const UnscheduledHandler> unscheduledHandler() const;
142 
144 
145  BranchListIndexes const& branchListIndexes() const;
146 
147  Provenance
148  getProvenance(ProductID const& pid, ModuleCallingContext const* mcc) const;
149 
151  getByProductID(ProductID const& oid) const;
152 
153  void put(
154  BranchDescription const& bd,
155  std::unique_ptr<WrapperBase> edp,
156  ProductProvenance const& productProvenance) const;
157 
158  void putOnRead(
159  BranchDescription const& bd,
160  std::unique_ptr<WrapperBase> edp,
161  ProductProvenance const& productProvenance) const;
162 
163  virtual WrapperBase const* getIt(ProductID const& pid) const override;
164  virtual WrapperBase const* getThinnedProduct(ProductID const& pid, unsigned int& key) const override;
165  virtual void getThinnedProducts(ProductID const& pid,
166  std::vector<WrapperBase const*>& foundContainers,
167  std::vector<unsigned int>& keys) const override;
168 
169  ProductID branchIDToProductID(BranchID const& bid) const;
170 
172  provRetrieverPtr_->mergeProvenanceRetrievers(other.provRetrieverPtr());
173  }
174 
175  using Base::getProvenance;
176 
179 
180 
181  private:
182 
183  BranchID pidToBid(ProductID const& pid) const;
184 
185  edm::ThinnedAssociation const* getThinnedAssociation(edm::BranchID const& branchID) const;
186 
187  virtual bool unscheduledFill(std::string const& moduleLabel,
189  ModuleCallingContext const* mcc) const override;
190 
191  virtual void readFromSource_(ProductHolderBase const& phb, ModuleCallingContext const* mcc) const override;
192 
193  virtual unsigned int transitionIndex_() const override;
194 
195  std::shared_ptr<ProductProvenanceRetriever const> provRetrieverPtr() const {return get_underlying_safe(provRetrieverPtr_);}
196  std::shared_ptr<ProductProvenanceRetriever>& provRetrieverPtr() {return get_underlying_safe(provRetrieverPtr_);}
197 
198  private:
199 
201 
203 
204  // Pointer to the 'retriever' that will get provenance information from the persistent store.
206 
207  // Handler for unscheduled modules
208  std::shared_ptr<UnscheduledHandler const> unscheduledHandler_;
209 
211 
212  std::shared_ptr<BranchIDListHelper const> branchIDListHelper_;
213  std::shared_ptr<ThinnedAssociationsHelper const> thinnedAssociationsHelper_;
214 
216 
217  std::map<BranchListIndex, ProcessIndex> branchListIndexToProcessIndex_;
218 
220 
221  };
222 
223  inline
224  bool
226  return isSameEvent(a.aux(), b.aux());
227  }
228 }
229 #endif
230 
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
int bunchCrossing() const
RunNumber_t run() const
std::shared_ptr< ProductProvenanceRetriever > & provRetrieverPtr()
ProductHolderBase const * ConstProductHolderPtr
Definition: Principal.h:61
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:778
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_
edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > provRetrieverPtr_
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
void putOnRead(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const
RunPrincipal const & runPrincipal() const
std::vector< EventSelectionID > EventSelectionIDVector
virtual WrapperBase const * getThinnedProduct(ProductID const &pid, unsigned int &key) const override
ExperimentType experimentType() const
Timestamp const & time() const
void mergeProvenanceRetrievers(EventPrincipal &other)
void setUnscheduledHandler(std::shared_ptr< UnscheduledHandler > iHandler)
std::shared_ptr< const UnscheduledHandler > unscheduledHandler() const
std::vector< BranchListIndex > BranchListIndexes
static int const invalidBunchXing
int storeNumber() const
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
EventAuxiliary Auxiliary
StreamID streamID() const
virtual WrapperBase const * getIt(ProductID const &pid) const override
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
void put(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const
ProductProvenanceRetriever const * productProvenanceRetrieverPtr() const
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
DelayedReader * reader() const
Definition: Principal.h:185
static int const invalidStoreNumber
virtual unsigned int transitionIndex_() const override
bool isReal() const
tuple pid
Definition: sysUtil.py:22
double b
Definition: hdecay.h:120
edm::propagate_const< std::shared_ptr< LuminosityBlockPrincipal > > luminosityBlockPrincipal_
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
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 luminosityBlockPrincipalPtrValid() const
unsigned int RunNumber_t
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> preModuleDelayedGetSignal_
void setRunAndLumiNumber(RunNumber_t run, LuminosityBlockNumber_t lumi)
EventAuxiliary const & aux() const
std::shared_ptr< ProductProvenanceRetriever const > provRetrieverPtr() const
virtual void getThinnedProducts(ProductID const &pid, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const override
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> postModuleDelayedGetSignal_
std::shared_ptr< UnscheduledHandler const > unscheduledHandler_
virtual bool unscheduledFill(std::string const &moduleLabel, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const override