Go to the documentation of this file.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 "DataFormats/Common/interface/WrapperHolder.h"
00016 #include "DataFormats/Common/interface/WrapperOwningHolder.h"
00017 #include "DataFormats/Provenance/interface/BranchListIndex.h"
00018 #include "DataFormats/Provenance/interface/BranchMapper.h"
00019 #include "DataFormats/Provenance/interface/EventAuxiliary.h"
00020 #include "DataFormats/Provenance/interface/EventSelectionID.h"
00021 #include "FWCore/Framework/interface/Principal.h"
00022
00023 #include "boost/scoped_ptr.hpp"
00024 #include "boost/shared_ptr.hpp"
00025
00026 #include <map>
00027 #include <memory>
00028 #include <string>
00029 #include <vector>
00030
00031 namespace edm {
00032 class BranchMapper;
00033 class DelayedReader;
00034 class EventID;
00035 class HistoryAppender;
00036 class LuminosityBlockPrincipal;
00037 class RunPrincipal;
00038 class UnscheduledHandler;
00039
00040 class EventPrincipal : public Principal {
00041 public:
00042 typedef EventAuxiliary Auxiliary;
00043 typedef Principal Base;
00044
00045 typedef Base::ConstGroupPtr ConstGroupPtr;
00046 static int const invalidBunchXing = EventAuxiliary::invalidBunchXing;
00047 static int const invalidStoreNumber = EventAuxiliary::invalidStoreNumber;
00048 EventPrincipal(
00049 boost::shared_ptr<ProductRegistry const> reg,
00050 ProcessConfiguration const& pc,
00051 HistoryAppender* historyAppender = 0);
00052 ~EventPrincipal() {}
00053
00054 void fillEventPrincipal(EventAuxiliary const& aux,
00055 boost::shared_ptr<LuminosityBlockPrincipal> lbp,
00056 boost::shared_ptr<EventSelectionIDVector> eventSelectionIDs = boost::shared_ptr<EventSelectionIDVector>(),
00057 boost::shared_ptr<BranchListIndexes> branchListIndexes = boost::shared_ptr<BranchListIndexes>(),
00058 boost::shared_ptr<BranchMapper> mapper = boost::shared_ptr<BranchMapper>(new BranchMapper),
00059 DelayedReader* reader = 0);
00060
00061 void clearEventPrincipal();
00062
00063 LuminosityBlockPrincipal const& luminosityBlockPrincipal() const {
00064 return *luminosityBlockPrincipal_;
00065 }
00066
00067 LuminosityBlockPrincipal& luminosityBlockPrincipal() {
00068 return *luminosityBlockPrincipal_;
00069 }
00070
00071 bool luminosityBlockPrincipalPtrValid() {
00072 return (luminosityBlockPrincipal_) ? true : false;
00073 }
00074
00075 void setLuminosityBlockPrincipal(boost::shared_ptr<LuminosityBlockPrincipal> const& lbp);
00076
00077 EventID const& id() const {
00078 return aux().id();
00079 }
00080
00081 Timestamp const& time() const {
00082 return aux().time();
00083 }
00084
00085 bool isReal() const {
00086 return aux().isRealData();
00087 }
00088
00089 EventAuxiliary::ExperimentType ExperimentType() const {
00090 return aux().experimentType();
00091 }
00092
00093 int bunchCrossing() const {
00094 return aux().bunchCrossing();
00095 }
00096
00097 int storeNumber() const {
00098 return aux().storeNumber();
00099 }
00100
00101 EventAuxiliary const& aux() const {
00102 return aux_;
00103 }
00104
00105 LuminosityBlockNumber_t luminosityBlock() const {
00106 return id().luminosityBlock();
00107 }
00108
00109 RunNumber_t run() const {
00110 return id().run();
00111 }
00112
00113 RunPrincipal const& runPrincipal() const;
00114
00115 RunPrincipal & runPrincipal();
00116
00117 boost::shared_ptr<BranchMapper> branchMapperPtr() const {return branchMapperPtr_;}
00118
00119 void setUnscheduledHandler(boost::shared_ptr<UnscheduledHandler> iHandler);
00120 boost::shared_ptr<UnscheduledHandler> unscheduledHandler() const;
00121
00122 EventSelectionIDVector const& eventSelectionIDs() const;
00123
00124 BranchListIndexes const& branchListIndexes() const;
00125
00126 Provenance
00127 getProvenance(ProductID const& pid) const;
00128
00129 BasicHandle
00130 getByProductID(ProductID const& oid) const;
00131
00132 void put(
00133 ConstBranchDescription const& bd,
00134 WrapperOwningHolder const& edp,
00135 ProductProvenance const& productProvenance);
00136
00137 void putOnRead(
00138 ConstBranchDescription const& bd,
00139 void const* product,
00140 ProductProvenance const& productProvenance);
00141
00142 WrapperHolder getIt(ProductID const& pid) const;
00143
00144 ProductID branchIDToProductID(BranchID const& bid) const;
00145
00146 void mergeMappers(EventPrincipal const& other) {
00147 branchMapperPtr_->mergeMappers(other.branchMapperPtr());
00148 }
00149
00150 using Base::getProvenance;
00151
00152 private:
00153
00154 BranchID pidToBid(ProductID const& pid) const;
00155
00156 virtual bool unscheduledFill(std::string const& moduleLabel) const;
00157
00158 virtual void resolveProduct_(Group const& g, bool fillOnDemand) const;
00159
00160 private:
00161
00162 EventAuxiliary aux_;
00163
00164 boost::shared_ptr<LuminosityBlockPrincipal> luminosityBlockPrincipal_;
00165
00166
00167 boost::shared_ptr<BranchMapper> branchMapperPtr_;
00168
00169
00170 boost::shared_ptr<UnscheduledHandler> unscheduledHandler_;
00171
00172 mutable std::vector<std::string> moduleLabelsRunning_;
00173
00174 boost::shared_ptr<EventSelectionIDVector> eventSelectionIDs_;
00175
00176 boost::shared_ptr<BranchListIndexes> branchListIndexes_;
00177
00178 std::map<BranchListIndex, ProcessIndex> branchListIndexToProcessIndex_;
00179
00180 };
00181
00182 inline
00183 bool
00184 isSameEvent(EventPrincipal const& a, EventPrincipal const& b) {
00185 return isSameEvent(a.aux(), b.aux());
00186 }
00187 }
00188 #endif
00189