Go to the documentation of this file.00001 #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h"
00002
00003 #include "DataFormats/Provenance/interface/ProductRegistry.h"
00004 #include "FWCore/Framework/interface/DelayedReader.h"
00005 #include "FWCore/Framework/interface/Group.h"
00006 #include "FWCore/Framework/interface/RunPrincipal.h"
00007 #include "FWCore/Utilities/interface/EDMException.h"
00008
00009 namespace edm {
00010
00011 LuminosityBlockPrincipal::LuminosityBlockPrincipal(
00012 boost::shared_ptr<LuminosityBlockAuxiliary> aux,
00013 boost::shared_ptr<ProductRegistry const> reg,
00014 ProcessConfiguration const& pc,
00015 boost::shared_ptr<RunPrincipal> rp) :
00016 Base(reg, pc, InLumi),
00017 runPrincipal_(rp),
00018 aux_(aux) {
00019 }
00020
00021 void
00022 LuminosityBlockPrincipal::fillLuminosityBlockPrincipal(
00023 boost::shared_ptr<BranchMapper> mapper,
00024 DelayedReader* reader) {
00025
00026 fillPrincipal(aux_->processHistoryID(), mapper, reader);
00027 if(runPrincipal_) {
00028 setProcessHistory(*runPrincipal_);
00029 }
00030 branchMapperPtr()->processHistoryID() = processHistoryID();
00031 for(const_iterator i = this->begin(), iEnd = this->end(); i != iEnd; ++i) {
00032 (*i)->setProvenance(branchMapperPtr());
00033 }
00034 }
00035
00036 void
00037 LuminosityBlockPrincipal::put(
00038 ConstBranchDescription const& bd,
00039 WrapperOwningHolder const& edp,
00040 ProductProvenance& productProvenance) {
00041
00042 assert(bd.produced());
00043 if(!edp.isValid()) {
00044 throw edm::Exception(edm::errors::InsertFailure,"Null Pointer")
00045 << "put: Cannot put because auto_ptr to product is null."
00046 << "\n";
00047 }
00048 branchMapperPtr()->insert(productProvenance);
00049 Group *g = getExistingGroup(bd.branchID());
00050 assert(g);
00051
00052 putOrMerge(edp, productProvenance, g);
00053 }
00054
00055 void
00056 LuminosityBlockPrincipal::readImmediate() const {
00057 for(Principal::const_iterator i = begin(), iEnd = end(); i != iEnd; ++i) {
00058 Group const& g = **i;
00059 if(!g.branchDescription().produced()) {
00060 if(!g.productUnavailable()) {
00061 resolveProductImmediate(g);
00062 }
00063 }
00064 }
00065 branchMapperPtr()->setDelayedRead(false);
00066 }
00067
00068 void
00069 LuminosityBlockPrincipal::resolveProductImmediate(Group const& g) const {
00070 if(g.branchDescription().produced()) return;
00071 if(!reader()) return;
00072
00073
00074 BranchKey const bk = BranchKey(g.branchDescription());
00075 WrapperOwningHolder edp(reader()->getProduct(bk, g.productData().getInterface(), this));
00076
00077
00078 if(edp.isValid()) {
00079 putOrMerge(edp, &g);
00080 }
00081 }
00082 }