00001 #ifndef FWCore_Framework_EventPrincipal_h
00002 #define FWCore_Framework_EventPrincipal_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "boost/shared_ptr.hpp"
00016 #include <vector>
00017
00018 #include "DataFormats/Provenance/interface/BranchMapper.h"
00019 #include "DataFormats/Provenance/interface/EventAuxiliary.h"
00020 #include "DataFormats/Provenance/interface/History.h"
00021 #include "DataFormats/Common/interface/EDProductGetter.h"
00022 #include "FWCore/Framework/interface/Principal.h"
00023
00024
00025 namespace edm {
00026 class EventID;
00027 class LuminosityBlockPrincipal;
00028 class RunPrincipal;
00029 class UnscheduledHandler;
00030
00031 class EventPrincipal : public Principal {
00032 public:
00033 typedef EventAuxiliary Auxiliary;
00034 typedef std::vector<EventEntryInfo> EntryInfoVector;
00035
00036 typedef Principal Base;
00037
00038 typedef Base::SharedConstGroupPtr SharedConstGroupPtr;
00039 static int const invalidBunchXing = EventAuxiliary::invalidBunchXing;
00040 static int const invalidStoreNumber = EventAuxiliary::invalidStoreNumber;
00041 EventPrincipal(EventAuxiliary const& aux,
00042 boost::shared_ptr<ProductRegistry const> reg,
00043 ProcessConfiguration const& pc,
00044 ProcessHistoryID const& hist = ProcessHistoryID(),
00045 boost::shared_ptr<BranchMapper> mapper = boost::shared_ptr<BranchMapper>(new BranchMapper),
00046 boost::shared_ptr<DelayedReader> rtrv = boost::shared_ptr<DelayedReader>(new NoDelayedReader));
00047 ~EventPrincipal() {}
00048
00049 LuminosityBlockPrincipal const& luminosityBlockPrincipal() const {
00050 return *luminosityBlockPrincipal_;
00051 }
00052
00053 LuminosityBlockPrincipal & luminosityBlockPrincipal() {
00054 return *luminosityBlockPrincipal_;
00055 }
00056
00057 boost::shared_ptr<LuminosityBlockPrincipal>
00058 luminosityBlockPrincipalSharedPtr() {
00059 return luminosityBlockPrincipal_;
00060 }
00061
00062 void setLuminosityBlockPrincipal(boost::shared_ptr<LuminosityBlockPrincipal> lbp) {
00063 luminosityBlockPrincipal_ = lbp;
00064 }
00065
00066 EventID const& id() const {
00067 return aux().id();
00068 }
00069
00070 Timestamp const& time() const {
00071 return aux().time();
00072 }
00073
00074 bool const isReal() const {
00075 return aux().isRealData();
00076 }
00077
00078 EventAuxiliary::ExperimentType ExperimentType() const {
00079 return aux().experimentType();
00080 }
00081
00082 int const bunchCrossing() const {
00083 return aux().bunchCrossing();
00084 }
00085
00086 int const storeNumber() const {
00087 return aux().storeNumber();
00088 }
00089
00090 EventAuxiliary const& aux() const {
00091 aux_.processHistoryID_ = processHistoryID();
00092 return aux_;
00093 }
00094
00095 LuminosityBlockNumber_t const& luminosityBlock() const {
00096 return aux().luminosityBlock();
00097 }
00098
00099 RunNumber_t run() const {
00100 return id().run();
00101 }
00102
00103 RunPrincipal const& runPrincipal() const;
00104
00105 RunPrincipal & runPrincipal();
00106
00107 void addOnDemandGroup(ConstBranchDescription const& desc);
00108
00109 void setUnscheduledHandler(boost::shared_ptr<UnscheduledHandler> iHandler);
00110
00111 EventSelectionIDVector const& eventSelectionIDs() const;
00112
00113 History const& history() const;
00114
00115 void setHistory(History const& h);
00116
00117 Provenance
00118 getProvenance(BranchID const& bid) const;
00119
00120 Provenance
00121 getProvenance(ProductID const& pid) const;
00122
00123 void
00124 getAllProvenance(std::vector<Provenance const *> & provenances) const;
00125
00126 BasicHandle
00127 getByProductID(ProductID const& oid) const;
00128
00129 void put(std::auto_ptr<EDProduct> edp, ConstBranchDescription const& bd, std::auto_ptr<EventEntryInfo> entryInfo);
00130
00131 void addGroup(ConstBranchDescription const& bd);
00132
00133 void addGroup(std::auto_ptr<EDProduct> prod, ConstBranchDescription const& bd, std::auto_ptr<EventEntryInfo> entryInfo);
00134
00135 void addGroup(ConstBranchDescription const& bd, std::auto_ptr<EventEntryInfo> entryInfo);
00136
00137 void addGroup(std::auto_ptr<EDProduct> prod, ConstBranchDescription const& bd, boost::shared_ptr<EventEntryInfo> entryInfo);
00138
00139 void addGroup(ConstBranchDescription const& bd, boost::shared_ptr<EventEntryInfo> entryInfo);
00140
00141 virtual EDProduct const* getIt(ProductID const& oid) const;
00142
00143 private:
00144
00145 virtual void addOrReplaceGroup(std::auto_ptr<Group> g);
00146
00147 virtual void resolveProvenance(Group const& g) const;
00148
00149 virtual bool unscheduledFill(std::string const& moduleLabel) const;
00150
00151 EventAuxiliary aux_;
00152 boost::shared_ptr<LuminosityBlockPrincipal> luminosityBlockPrincipal_;
00153
00154
00155 boost::shared_ptr<UnscheduledHandler> unscheduledHandler_;
00156
00157 mutable std::vector<std::string> moduleLabelsRunning_;
00158
00159 History eventHistory_;
00160
00161 };
00162
00163 inline
00164 bool
00165 isSameEvent(EventPrincipal const& a, EventPrincipal const& b) {
00166 return isSameEvent(a.aux(), b.aux());
00167 }
00168 }
00169 #endif
00170