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/scoped_ptr.hpp"
24 #include "boost/shared_ptr.hpp"
25 
26 #include <map>
27 #include <memory>
28 #include <string>
29 #include <vector>
30 
31 namespace edm {
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  ProcessConfiguration const& pc,
51  HistoryAppender* historyAppender = 0);
53 
55  boost::shared_ptr<LuminosityBlockPrincipal> lbp,
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 
116 
117  boost::shared_ptr<BranchMapper> branchMapperPtr() const {return branchMapperPtr_;}
118 
119  void setUnscheduledHandler(boost::shared_ptr<UnscheduledHandler> iHandler);
120  boost::shared_ptr<UnscheduledHandler> unscheduledHandler() const;
121 
123 
124  BranchListIndexes const& branchListIndexes() const;
125 
126  Provenance
127  getProvenance(ProductID const& pid) const;
128 
130  getByProductID(ProductID const& oid) const;
131 
132  void put(
133  ConstBranchDescription const& bd,
134  WrapperOwningHolder const& edp,
135  ProductProvenance const& productProvenance);
136 
137  void putOnRead(
138  ConstBranchDescription const& bd,
139  void const* product,
140  ProductProvenance const& productProvenance);
141 
142  WrapperHolder getIt(ProductID const& pid) const;
143 
144  ProductID branchIDToProductID(BranchID const& bid) const;
145 
146  void mergeMappers(EventPrincipal const& other) {
147  branchMapperPtr_->mergeMappers(other.branchMapperPtr());
148  }
149 
150  using Base::getProvenance;
151 
152  private:
153 
154  BranchID pidToBid(ProductID const& pid) const;
155 
156  virtual bool unscheduledFill(std::string const& moduleLabel) const;
157 
158  virtual void resolveProduct_(Group const& g, bool fillOnDemand) const;
159 
160  private:
161 
163 
164  boost::shared_ptr<LuminosityBlockPrincipal> luminosityBlockPrincipal_;
165 
166  // Pointer to the 'mapper' that will get provenance information from the persistent store.
167  boost::shared_ptr<BranchMapper> branchMapperPtr_;
168 
169  // Handler for unscheduled modules
170  boost::shared_ptr<UnscheduledHandler> unscheduledHandler_;
171 
172  mutable std::vector<std::string> moduleLabelsRunning_;
173 
174  boost::shared_ptr<EventSelectionIDVector> eventSelectionIDs_;
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
Base::ConstGroupPtr ConstGroupPtr
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
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
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
ProductID branchIDToProductID(BranchID const &bid) const
RunPrincipal const & runPrincipal() const
std::vector< EventSelectionID > EventSelectionIDVector
ExperimentType experimentType() const
Timestamp const & time() const
Group const * ConstGroupPtr
Definition: Principal.h:57
boost::shared_ptr< BranchMapper > branchMapperPtr_
std::vector< BranchListIndex > BranchListIndexes
static int const invalidBunchXing
virtual void resolveProduct_(Group const &g, bool fillOnDemand) const
int storeNumber() const
boost::shared_ptr< UnscheduledHandler > unscheduledHandler() const
boost::shared_ptr< BranchMapper > branchMapperPtr() const
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
EventAuxiliary Auxiliary
void mergeMappers(EventPrincipal const &other)
boost::shared_ptr< UnscheduledHandler > unscheduledHandler_
boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs_
EventPrincipal(boost::shared_ptr< ProductRegistry const > reg, ProcessConfiguration const &pc, HistoryAppender *historyAppender=0)
void fillEventPrincipal(EventAuxiliary const &aux, boost::shared_ptr< LuminosityBlockPrincipal > lbp, 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)
DelayedReader * reader() const
Definition: Principal.h:149
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 bool unscheduledFill(std::string const &moduleLabel) const
EventID const & id() const
static int const invalidStoreNumber
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:677
std::vector< std::string > moduleLabelsRunning_