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 
22 
23 #include "boost/shared_ptr.hpp"
24 
25 #include <map>
26 #include <memory>
27 #include <string>
28 #include <vector>
29 
30 namespace edm {
31  class BranchIDListHelper;
32  class BranchMapper;
33  class DelayedReader;
34  class EventID;
35  class HistoryAppender;
36  class LuminosityBlockPrincipal;
37  class RunPrincipal;
38  class UnscheduledHandler;
39 
40  class EventPrincipal : public Principal {
41  public:
43  typedef Principal Base;
44 
49  boost::shared_ptr<ProductRegistry const> reg,
50  boost::shared_ptr<BranchIDListHelper const> branchIDListHelper,
51  ProcessConfiguration const& pc,
52  HistoryAppender* historyAppender);
54 
56  boost::shared_ptr<EventSelectionIDVector> eventSelectionIDs = boost::shared_ptr<EventSelectionIDVector>(),
57  boost::shared_ptr<BranchListIndexes> branchListIndexes = boost::shared_ptr<BranchListIndexes>(),
58  boost::shared_ptr<BranchMapper> mapper = boost::shared_ptr<BranchMapper>(new BranchMapper),
59  DelayedReader* reader = 0);
60 
61  void clearEventPrincipal();
62 
65  }
66 
69  }
70 
72  return (luminosityBlockPrincipal_) ? true : false;
73  }
74 
75  void setLuminosityBlockPrincipal(boost::shared_ptr<LuminosityBlockPrincipal> const& lbp);
76 
77  EventID const& id() const {
78  return aux().id();
79  }
80 
81  Timestamp const& time() const {
82  return aux().time();
83  }
84 
85  bool isReal() const {
86  return aux().isRealData();
87  }
88 
90  return aux().experimentType();
91  }
92 
93  int bunchCrossing() const {
94  return aux().bunchCrossing();
95  }
96 
97  int storeNumber() const {
98  return aux().storeNumber();
99  }
100 
101  EventAuxiliary const& aux() const {
102  return aux_;
103  }
104 
106  return id().luminosityBlock();
107  }
108 
109  RunNumber_t run() const {
110  return id().run();
111  }
112 
113  RunPrincipal const& runPrincipal() const;
114 
115  boost::shared_ptr<BranchMapper> branchMapperPtr() const {return branchMapperPtr_;}
116 
117  void setUnscheduledHandler(boost::shared_ptr<UnscheduledHandler> iHandler);
118  boost::shared_ptr<UnscheduledHandler> unscheduledHandler() const;
119 
121 
122  BranchListIndexes const& branchListIndexes() const;
123 
124  Provenance
125  getProvenance(ProductID const& pid) const;
126 
128  getByProductID(ProductID const& oid) const;
129 
130  void put(
131  ConstBranchDescription const& bd,
132  WrapperOwningHolder const& edp,
133  ProductProvenance const& productProvenance);
134 
135  void putOnRead(
136  ConstBranchDescription const& bd,
137  void const* product,
138  ProductProvenance const& productProvenance);
139 
140  WrapperHolder getIt(ProductID const& pid) const;
141 
142  ProductID branchIDToProductID(BranchID const& bid) const;
143 
144  void mergeMappers(EventPrincipal const& other) {
145  branchMapperPtr_->mergeMappers(other.branchMapperPtr());
146  }
147 
148  using Base::getProvenance;
149 
150  private:
151 
152  BranchID pidToBid(ProductID const& pid) const;
153 
154  virtual bool unscheduledFill(std::string const& moduleLabel) const override;
155 
156  virtual void resolveProduct_(ProductHolderBase const& phb, bool fillOnDemand) const override;
157 
158  private:
159 
161 
162  boost::shared_ptr<LuminosityBlockPrincipal> luminosityBlockPrincipal_;
163 
164  // Pointer to the 'mapper' that will get provenance information from the persistent store.
165  boost::shared_ptr<BranchMapper> branchMapperPtr_;
166 
167  // Handler for unscheduled modules
168  boost::shared_ptr<UnscheduledHandler> unscheduledHandler_;
169 
170  mutable std::vector<std::string> moduleLabelsRunning_;
171 
172  boost::shared_ptr<EventSelectionIDVector> eventSelectionIDs_;
173 
174  boost::shared_ptr<BranchIDListHelper const> branchIDListHelper_;
175 
176  boost::shared_ptr<BranchListIndexes> branchListIndexes_;
177 
178  std::map<BranchListIndex, ProcessIndex> branchListIndexToProcessIndex_;
179 
180  };
181 
182  inline
183  bool
185  return isSameEvent(a.aux(), b.aux());
186  }
187 }
188 #endif
189 
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)
void fillEventPrincipal(EventAuxiliary const &aux, boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs=boost::shared_ptr< EventSelectionIDVector >(), boost::shared_ptr< BranchListIndexes > branchListIndexes=boost::shared_ptr< BranchListIndexes >(), boost::shared_ptr< BranchMapper > mapper=boost::shared_ptr< BranchMapper >(new BranchMapper), DelayedReader *reader=0)
EventSelectionIDVector const & eventSelectionIDs() const
boost::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
int bunchCrossing() const
RunNumber_t run() const
EventAuxiliary::ExperimentType ExperimentType() const
BasicHandle getByProductID(ProductID const &oid) const
BranchID pidToBid(ProductID const &pid) const
static int const invalidBunchXing
EventID const & id() const
Timestamp const & time() const
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
LuminosityBlockNumber_t luminosityBlock() const
LuminosityBlockPrincipal & luminosityBlockPrincipal()
void put(ConstBranchDescription const &bd, WrapperOwningHolder const &edp, ProductProvenance const &productProvenance)
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
virtual bool unscheduledFill(std::string const &moduleLabel) const override
std::vector< EventSelectionID > EventSelectionIDVector
ExperimentType experimentType() const
Timestamp const & time() const
boost::shared_ptr< BranchMapper > branchMapperPtr_
std::vector< BranchListIndex > BranchListIndexes
static int const invalidBunchXing
int storeNumber() const
EventPrincipal(boost::shared_ptr< ProductRegistry const > reg, boost::shared_ptr< BranchIDListHelper const > branchIDListHelper, ProcessConfiguration const &pc, HistoryAppender *historyAppender)
boost::shared_ptr< UnscheduledHandler > unscheduledHandler() const
boost::shared_ptr< BranchMapper > branchMapperPtr() const
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
EventAuxiliary Auxiliary
Base::ConstProductPtr ConstProductPtr
void mergeMappers(EventPrincipal const &other)
boost::shared_ptr< UnscheduledHandler > unscheduledHandler_
boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs_
DelayedReader * reader() const
Definition: Principal.h:154
Provenance getProvenance(ProductID const &pid) const
static int const invalidStoreNumber
boost::shared_ptr< BranchListIndexes > branchListIndexes_
bool isReal() const
void putOnRead(ConstBranchDescription const &bd, void const *product, ProductProvenance const &productProvenance)
double b
Definition: hdecay.h:120
virtual void resolveProduct_(ProductHolderBase const &phb, bool fillOnDemand) const override
boost::shared_ptr< BranchIDListHelper const > branchIDListHelper_
EventID const & id() const
static int const invalidStoreNumber
ProductHolderBase const * ConstProductPtr
Definition: Principal.h:57
double a
Definition: hdecay.h:121
void setUnscheduledHandler(boost::shared_ptr< UnscheduledHandler > iHandler)
unsigned int RunNumber_t
Definition: EventRange.h:32
bool luminosityBlockPrincipalPtrValid()
EventAuxiliary const & aux() const
Provenance getProvenance(BranchID const &bid) const
Definition: Principal.cc:691
std::vector< std::string > moduleLabelsRunning_