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