00001 #include "FWCore/Framework/interface/LuminosityBlock.h"
00002 #include "DataFormats/Provenance/interface/BranchType.h"
00003 #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h"
00004 #include "FWCore/Framework/interface/Run.h"
00005
00006 namespace edm {
00007
00008 namespace {
00009 Run *
00010 newRun(LuminosityBlockPrincipal& lbp, ModuleDescription const& md) {
00011 return (lbp.runPrincipalSharedPtr() ? new Run(lbp.runPrincipal(), md) : 0);
00012 }
00013 }
00014
00015 LuminosityBlock::LuminosityBlock(LuminosityBlockPrincipal& lbp, ModuleDescription const& md) :
00016 DataViewImpl(lbp, md, InLumi),
00017 aux_(lbp.aux()),
00018 run_(newRun(lbp, md)) {
00019 }
00020
00021 LuminosityBlockPrincipal &
00022 LuminosityBlock::luminosityBlockPrincipal() {
00023 return dynamic_cast<LuminosityBlockPrincipal &>(principal());
00024 }
00025
00026 LuminosityBlockPrincipal const &
00027 LuminosityBlock::luminosityBlockPrincipal() const {
00028 return dynamic_cast<LuminosityBlockPrincipal const&>(principal());
00029 }
00030
00031 Provenance
00032 LuminosityBlock::getProvenance(BranchID const& bid) const
00033 {
00034 return luminosityBlockPrincipal().getProvenance(bid);
00035 }
00036
00037 void
00038 LuminosityBlock::getAllProvenance(std::vector<Provenance const*> & provenances) const
00039 {
00040 luminosityBlockPrincipal().getAllProvenance(provenances);
00041 }
00042
00043
00044 void
00045 LuminosityBlock::commit_() {
00046
00047 LuminosityBlockPrincipal & lbp = luminosityBlockPrincipal();
00048 ProductPtrVec::iterator pit(putProducts().begin());
00049 ProductPtrVec::iterator pie(putProducts().end());
00050
00051 while(pit!=pie) {
00052 std::auto_ptr<EDProduct> pr(pit->first);
00053
00054 pit->first = 0;
00055
00056
00057 std::auto_ptr<EventEntryInfo> lumiEntryInfoPtr(
00058 new EventEntryInfo(pit->second->branchID(),
00059 productstatus::present(),
00060 pit->second->moduleDescriptionID()));
00061 lbp.put(pr, *pit->second, lumiEntryInfoPtr);
00062 ++pit;
00063 }
00064
00065
00066 putProducts().clear();
00067 }
00068
00069 }