Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New framework ids #17

Merged
merged 9 commits into from
Jul 6, 2013
8 changes: 8 additions & 0 deletions FWCore/Framework/interface/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ For its usage, see "FWCore/Framework/interface/PrincipalGetAdapter.h"
#include "FWCore/Utilities/interface/TypeID.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Utilities/interface/ProductKindOfType.h"
#include "FWCore/Utilities/interface/StreamID.h"

#include "boost/shared_ptr.hpp"

Expand Down Expand Up @@ -63,6 +64,11 @@ namespace edm {

// AUX functions are defined in EventBase
EventAuxiliary const& eventAuxiliary() const {return aux_;}

///\return The id for the particular Stream processing the Event
StreamID streamID() const {
return streamID_;
}

LuminosityBlock const&
getLuminosityBlock() const {
Expand Down Expand Up @@ -246,6 +252,8 @@ namespace edm {

// We own the retrieved Views, and have to destroy them.
mutable std::vector<boost::shared_ptr<ViewBase> > gotViews_;

StreamID streamID_;

static const std::string emptyString_;
};
Expand Down
11 changes: 10 additions & 1 deletion FWCore/Framework/interface/EventPrincipal.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ is the DataBlock.
#include "DataFormats/Provenance/interface/BranchMapper.h"
#include "DataFormats/Provenance/interface/EventAuxiliary.h"
#include "DataFormats/Provenance/interface/EventSelectionID.h"
#include "FWCore/Utilities/interface/StreamID.h"
#include "FWCore/Framework/interface/Principal.h"

#include "boost/shared_ptr.hpp"
Expand Down Expand Up @@ -49,7 +50,8 @@ namespace edm {
boost::shared_ptr<ProductRegistry const> reg,
boost::shared_ptr<BranchIDListHelper const> branchIDListHelper,
ProcessConfiguration const& pc,
HistoryAppender* historyAppender);
HistoryAppender* historyAppender,
StreamID const& streamID = StreamID::invalidStreamID());
~EventPrincipal() {}

void fillEventPrincipal(EventAuxiliary const& aux,
Expand Down Expand Up @@ -102,6 +104,11 @@ namespace edm {
return aux_;
}

StreamID streamID() const { return streamID_;}
void setStreamID(StreamID const& iID) {
streamID_ = iID;
}

LuminosityBlockNumber_t luminosityBlock() const {
return id().luminosityBlock();
}
Expand Down Expand Up @@ -176,6 +183,8 @@ namespace edm {
boost::shared_ptr<BranchListIndexes> branchListIndexes_;

std::map<BranchListIndex, ProcessIndex> branchListIndexToProcessIndex_;

StreamID streamID_;

};

Expand Down
5 changes: 5 additions & 0 deletions FWCore/Framework/interface/LuminosityBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ For its usage, see "FWCore/Framework/interface/PrincipalGetAdapter.h"
#include "FWCore/Framework/interface/PrincipalGetAdapter.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Utilities/interface/ProductKindOfType.h"
#include "FWCore/Utilities/interface/LuminosityBlockIndex.h"


#include "boost/shared_ptr.hpp"
Expand All @@ -46,6 +47,10 @@ namespace edm {
// AUX functions are defined in LuminosityBlockBase
LuminosityBlockAuxiliary const& luminosityBlockAuxiliary() const {return aux_;}

/**\return Reusable index which can be used to separate data for different simultaneous LuminosityBlocks.
*/
LuminosityBlockIndex index() const;

//Used in conjunction with EDGetToken
void setConsumer(EDConsumerBase const* iConsumer);
template <typename PROD>
Expand Down
10 changes: 9 additions & 1 deletion FWCore/Framework/interface/LuminosityBlockPrincipal.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ is the DataBlock.

#include "DataFormats/Provenance/interface/LuminosityBlockAuxiliary.h"
#include "DataFormats/Provenance/interface/RunID.h"
#include "FWCore/Utilities/interface/LuminosityBlockIndex.h"
#include "FWCore/Framework/interface/Principal.h"

#include "boost/shared_ptr.hpp"
Expand All @@ -35,7 +36,8 @@ namespace edm {
boost::shared_ptr<LuminosityBlockAuxiliary> aux,
boost::shared_ptr<ProductRegistry const> reg,
ProcessConfiguration const& pc,
HistoryAppender* historyAppender);
HistoryAppender* historyAppender,
unsigned int index);

~LuminosityBlockPrincipal() {}

Expand All @@ -53,6 +55,10 @@ namespace edm {
runPrincipal_ = rp;
}

LuminosityBlockIndex index() const {
return index_;
}

LuminosityBlockID id() const {
return aux().id();
}
Expand Down Expand Up @@ -109,6 +115,8 @@ namespace edm {

boost::shared_ptr<LuminosityBlockAuxiliary> aux_;

LuminosityBlockIndex index_;

bool complete_;
};
}
Expand Down
5 changes: 5 additions & 0 deletions FWCore/Framework/interface/Run.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ For its usage, see "FWCore/Framework/interface/PrincipalGetAdapter.h"
#include "FWCore/Common/interface/RunBase.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Utilities/interface/ProductKindOfType.h"
#include "FWCore/Utilities/interface/RunIndex.h"

#include <memory>
#include <set>
Expand Down Expand Up @@ -53,6 +54,10 @@ namespace edm {
// Timestamp const& beginTime() const {return aux_.beginTime();}
// Timestamp const& endTime() const {return aux_.endTime();}

/**\return Reusable index which can be used to separate data for different simultaneous Runs.
*/
RunIndex index() const;

template <typename PROD>
bool
getByLabel(std::string const& label, Handle<PROD>& result) const;
Expand Down
16 changes: 15 additions & 1 deletion FWCore/Framework/interface/RunPrincipal.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ is the DataBlock.
#include "boost/shared_ptr.hpp"

#include "DataFormats/Provenance/interface/RunAuxiliary.h"
#include "FWCore/Utilities/interface/RunIndex.h"
#include "FWCore/Framework/interface/Principal.h"

namespace edm {
Expand All @@ -34,11 +35,23 @@ namespace edm {
boost::shared_ptr<RunAuxiliary> aux,
boost::shared_ptr<ProductRegistry const> reg,
ProcessConfiguration const& pc,
HistoryAppender* historyAppender);
HistoryAppender* historyAppender,
unsigned int iRunIndex);
~RunPrincipal() {}

void fillRunPrincipal(DelayedReader* reader = 0);

/** Multiple Runs may be processed simultaneously. The
return value can be used to identify a particular Run.
The value will range from 0 to one less than
the maximum number of allowed simultaneous Runs. A particular
value will be reused once the processing of the previous Run
using that index has been completed.
*/
RunIndex index() const {
return index_;
}

RunAuxiliary const& aux() const {
return *aux_;
}
Expand Down Expand Up @@ -89,6 +102,7 @@ namespace edm {

// A vector of product holders.
boost::shared_ptr<RunAuxiliary> aux_;
RunIndex index_;

bool complete_;
};
Expand Down
4 changes: 3 additions & 1 deletion FWCore/Framework/src/Event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ namespace edm {
aux_(ep.aux()),
luminosityBlock_(ep.luminosityBlockPrincipalPtrValid() ? new LuminosityBlock(ep.luminosityBlockPrincipal(), md) : 0),
gotBranchIDs_(),
gotViews_() {
gotViews_(),
streamID_(ep.streamID())
{
}

Event::~Event() {
Expand Down
6 changes: 4 additions & 2 deletions FWCore/Framework/src/EventPrincipal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ namespace edm {
boost::shared_ptr<ProductRegistry const> reg,
boost::shared_ptr<BranchIDListHelper const> branchIDListHelper,
ProcessConfiguration const& pc,
HistoryAppender* historyAppender) :
HistoryAppender* historyAppender,
StreamID const& streamID) :
Base(reg, reg->productLookup(InEvent), pc, InEvent, historyAppender),
aux_(),
luminosityBlockPrincipal_(),
Expand All @@ -32,7 +33,8 @@ namespace edm {
eventSelectionIDs_(new EventSelectionIDVector),
branchIDListHelper_(branchIDListHelper),
branchListIndexes_(new BranchListIndexes),
branchListIndexToProcessIndex_() {}
branchListIndexToProcessIndex_(),
streamID_(streamID){}

void
EventPrincipal::clearEventPrincipal() {
Expand Down
7 changes: 6 additions & 1 deletion FWCore/Framework/src/EventProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "FWCore/Utilities/interface/RandomNumberGenerator.h"
#include "FWCore/Utilities/interface/UnixSignalHandlers.h"
#include "FWCore/Utilities/interface/ExceptionCollector.h"
#include "FWCore/Utilities/interface/StreamID.h"

#include "MessageForSource.h"
#include "MessageForParent.h"
Expand Down Expand Up @@ -658,7 +659,11 @@ namespace edm {
connectSigs(this);

// Reusable event principal
boost::shared_ptr<EventPrincipal> ep(new EventPrincipal(preg_, branchIDListHelper_, *processConfiguration_, historyAppender_.get()));
boost::shared_ptr<EventPrincipal> ep(new EventPrincipal(preg_,
branchIDListHelper_,
*processConfiguration_,
historyAppender_.get(),
StreamID{0}));
principalCache_.insert(ep);

// initialize the subprocess, if there is one
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/src/InputSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ namespace edm {
boost::shared_ptr<RunPrincipal>
InputSource::readAndCacheRun(HistoryAppender& historyAppender) {
RunSourceSentry sentry(*this);
boost::shared_ptr<RunPrincipal> rp(new RunPrincipal(runAuxiliary(), productRegistry_, processConfiguration(), &historyAppender));
boost::shared_ptr<RunPrincipal> rp(new RunPrincipal(runAuxiliary(), productRegistry_, processConfiguration(), &historyAppender,0));
callWithTryCatchAndPrint<boost::shared_ptr<RunPrincipal> >( [this,&rp](){ return readRun_(rp); }, "Calling InputSource::readRun_" );
return rp;
}
Expand All @@ -304,7 +304,7 @@ namespace edm {
new LuminosityBlockPrincipal(luminosityBlockAuxiliary(),
productRegistry_,
processConfiguration(),
&historyAppender));
&historyAppender,0));
callWithTryCatchAndPrint<boost::shared_ptr<LuminosityBlockPrincipal> >( [this,&lbp](){ return readLuminosityBlock_(lbp); },
"Calling InputSource::readLuminosityBlock_" );
if(remainingLumis_ > 0) {
Expand Down
6 changes: 6 additions & 0 deletions FWCore/Framework/src/LuminosityBlock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ namespace edm {
for_all(putProducts_, principal_get_adapter_detail::deleter());
}

LuminosityBlockIndex
LuminosityBlock::index() const {
return luminosityBlockPrincipal().index();
}


LuminosityBlockPrincipal&
LuminosityBlock::luminosityBlockPrincipal() {
return dynamic_cast<LuminosityBlockPrincipal&>(provRecorder_.principal());
Expand Down
4 changes: 3 additions & 1 deletion FWCore/Framework/src/LuminosityBlockPrincipal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ namespace edm {
boost::shared_ptr<LuminosityBlockAuxiliary> aux,
boost::shared_ptr<ProductRegistry const> reg,
ProcessConfiguration const& pc,
HistoryAppender* historyAppender) :
HistoryAppender* historyAppender,
unsigned int index) :
Base(reg, reg->productLookup(InLumi), pc, InLumi, historyAppender),
runPrincipal_(),
aux_(aux),
index_(index),
complete_(false) {
}

Expand Down
2 changes: 2 additions & 0 deletions FWCore/Framework/src/Run.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ namespace edm {
for_all(putProducts_, principal_get_adapter_detail::deleter());
}

RunIndex Run::index() const { return runPrincipal().index();}

RunPrincipal&
Run::runPrincipal() {
return dynamic_cast<RunPrincipal&>(provRecorder_.principal());
Expand Down
5 changes: 3 additions & 2 deletions FWCore/Framework/src/RunPrincipal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ namespace edm {
boost::shared_ptr<RunAuxiliary> aux,
boost::shared_ptr<ProductRegistry const> reg,
ProcessConfiguration const& pc,
HistoryAppender* historyAppender) :
HistoryAppender* historyAppender,
unsigned int iRunIndex) :
Base(reg, reg->productLookup(InRun), pc, InRun, historyAppender),
aux_(aux), complete_(false) {
aux_(aux), index_(iRunIndex), complete_(false) {
}

void
Expand Down
8 changes: 5 additions & 3 deletions FWCore/Framework/src/SubProcess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ namespace edm {
std::map<std::string, std::vector<std::pair<std::string, int> > > outputModulePathPositions;
setEventSelectionInfo(outputModulePathPositions, parentProductRegistry->anyProductProduced());

boost::shared_ptr<EventPrincipal> ep(new EventPrincipal(preg_, branchIDListHelper_, *processConfiguration_, historyAppender_.get()));
boost::shared_ptr<EventPrincipal> ep(new EventPrincipal(preg_, branchIDListHelper_, *processConfiguration_, historyAppender_.get(),
StreamID::invalidStreamID()));
principalCache_.insert(ep);

if(subProcessParameterSet) {
Expand Down Expand Up @@ -194,6 +195,7 @@ namespace edm {
}

EventPrincipal& ep = principalCache_.eventPrincipal();
ep.setStreamID(principal.streamID());
ep.fillEventPrincipal(aux,
esids,
boost::shared_ptr<BranchListIndexes>(new BranchListIndexes(principal.branchListIndexes())),
Expand All @@ -220,7 +222,7 @@ namespace edm {
SubProcess::beginRun(RunPrincipal const& principal) {
boost::shared_ptr<RunAuxiliary> aux(new RunAuxiliary(principal.aux()));
aux->setProcessHistoryID(principal.processHistoryID());
boost::shared_ptr<RunPrincipal> rpp(new RunPrincipal(aux, preg_, *processConfiguration_, historyAppender_.get()));
boost::shared_ptr<RunPrincipal> rpp(new RunPrincipal(aux, preg_, *processConfiguration_, historyAppender_.get(),principal.index()));
rpp->fillRunPrincipal(principal.reader());
principalCache_.insert(rpp);

Expand Down Expand Up @@ -286,7 +288,7 @@ namespace edm {
SubProcess::beginLuminosityBlock(LuminosityBlockPrincipal const& principal) {
boost::shared_ptr<LuminosityBlockAuxiliary> aux(new LuminosityBlockAuxiliary(principal.aux()));
aux->setProcessHistoryID(principal.processHistoryID());
boost::shared_ptr<LuminosityBlockPrincipal> lbpp(new LuminosityBlockPrincipal(aux, preg_, *processConfiguration_, historyAppender_.get()));
boost::shared_ptr<LuminosityBlockPrincipal> lbpp(new LuminosityBlockPrincipal(aux, preg_, *processConfiguration_, historyAppender_.get(),principal.index()));
lbpp->fillLuminosityBlockPrincipal(principal.reader());
lbpp->setRunPrincipal(principalCache_.runPrincipalPtr());
principalCache_.insert(lbpp);
Expand Down
6 changes: 3 additions & 3 deletions FWCore/Framework/test/Event_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,13 @@ void testEvent::setUp() {
EventID id = make_id();
ProcessConfiguration const& pc = currentModuleDescription_->processConfiguration();
boost::shared_ptr<RunAuxiliary> runAux(new RunAuxiliary(id.run(), time, time));
boost::shared_ptr<RunPrincipal> rp(new RunPrincipal(runAux, preg, pc, &historyAppender_));
boost::shared_ptr<RunPrincipal> rp(new RunPrincipal(runAux, preg, pc, &historyAppender_,0));
boost::shared_ptr<LuminosityBlockAuxiliary> lumiAux(new LuminosityBlockAuxiliary(rp->run(), 1, time, time));
boost::shared_ptr<LuminosityBlockPrincipal>lbp(new LuminosityBlockPrincipal(lumiAux, preg, pc, &historyAppender_));
boost::shared_ptr<LuminosityBlockPrincipal>lbp(new LuminosityBlockPrincipal(lumiAux, preg, pc, &historyAppender_,0));
lbp->setRunPrincipal(rp);
EventAuxiliary eventAux(id, uuid, time, true);
const_cast<ProcessHistoryID &>(eventAux.processHistoryID()) = processHistoryID;
principal_.reset(new edm::EventPrincipal(preg, branchIDListHelper_, pc, &historyAppender_));
principal_.reset(new edm::EventPrincipal(preg, branchIDListHelper_, pc, &historyAppender_,edm::StreamID::invalidStreamID()));
principal_->fillEventPrincipal(eventAux);
principal_->setLuminosityBlockPrincipal(lbp);
currentEvent_.reset(new Event(*principal_, *currentModuleDescription_));
Expand Down
12 changes: 6 additions & 6 deletions FWCore/Framework/test/event_getrefbeforeput_t.cppunit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ void testEventGetRefBeforePut::failGetProductNotRegisteredTest() {
edm::ProcessConfiguration pc("PROD", edm::ParameterSetID(), edm::getReleaseVersion(), edm::getPassID());
boost::shared_ptr<edm::ProductRegistry const> pregc(preg.release());
boost::shared_ptr<edm::RunAuxiliary> runAux(new edm::RunAuxiliary(col.run(), fakeTime, fakeTime));
boost::shared_ptr<edm::RunPrincipal> rp(new edm::RunPrincipal(runAux, pregc, pc, &historyAppender_));
boost::shared_ptr<edm::RunPrincipal> rp(new edm::RunPrincipal(runAux, pregc, pc, &historyAppender_,0));
boost::shared_ptr<edm::LuminosityBlockAuxiliary> lumiAux(new edm::LuminosityBlockAuxiliary(rp->run(), 1, fakeTime, fakeTime));
boost::shared_ptr<edm::LuminosityBlockPrincipal>lbp(new edm::LuminosityBlockPrincipal(lumiAux, pregc, pc, &historyAppender_));
boost::shared_ptr<edm::LuminosityBlockPrincipal>lbp(new edm::LuminosityBlockPrincipal(lumiAux, pregc, pc, &historyAppender_,0));
lbp->setRunPrincipal(rp);
edm::EventAuxiliary eventAux(col, uuid, fakeTime, true);
edm::EventPrincipal ep(pregc, branchIDListHelper, pc, &historyAppender_);
edm::EventPrincipal ep(pregc, branchIDListHelper, pc, &historyAppender_,edm::StreamID::invalidStreamID());
ep.fillEventPrincipal(eventAux);
ep.setLuminosityBlockPrincipal(lbp);
try {
Expand Down Expand Up @@ -145,12 +145,12 @@ void testEventGetRefBeforePut::getRefTest() {
edm::ProcessConfiguration& pc = *pcPtr;
boost::shared_ptr<edm::ProductRegistry const> pregc(preg.release());
boost::shared_ptr<edm::RunAuxiliary> runAux(new edm::RunAuxiliary(col.run(), fakeTime, fakeTime));
boost::shared_ptr<edm::RunPrincipal> rp(new edm::RunPrincipal(runAux, pregc, pc, &historyAppender_));
boost::shared_ptr<edm::RunPrincipal> rp(new edm::RunPrincipal(runAux, pregc, pc, &historyAppender_,0));
boost::shared_ptr<edm::LuminosityBlockAuxiliary> lumiAux(new edm::LuminosityBlockAuxiliary(rp->run(), 1, fakeTime, fakeTime));
boost::shared_ptr<edm::LuminosityBlockPrincipal>lbp(new edm::LuminosityBlockPrincipal(lumiAux, pregc, pc, &historyAppender_));
boost::shared_ptr<edm::LuminosityBlockPrincipal>lbp(new edm::LuminosityBlockPrincipal(lumiAux, pregc, pc, &historyAppender_,0));
lbp->setRunPrincipal(rp);
edm::EventAuxiliary eventAux(col, uuid, fakeTime, true);
edm::EventPrincipal ep(pregc, branchIDListHelper, pc, &historyAppender_);
edm::EventPrincipal ep(pregc, branchIDListHelper, pc, &historyAppender_,edm::StreamID::invalidStreamID());
ep.fillEventPrincipal(eventAux);
ep.setLuminosityBlockPrincipal(lbp);

Expand Down