diff --git a/FWCore/Framework/interface/Event.h b/FWCore/Framework/interface/Event.h index e9968c1619217..0c6b666abcc0e 100644 --- a/FWCore/Framework/interface/Event.h +++ b/FWCore/Framework/interface/Event.h @@ -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" @@ -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 { @@ -246,6 +252,8 @@ namespace edm { // We own the retrieved Views, and have to destroy them. mutable std::vector > gotViews_; + + StreamID streamID_; static const std::string emptyString_; }; diff --git a/FWCore/Framework/interface/EventPrincipal.h b/FWCore/Framework/interface/EventPrincipal.h index cad6d4bca613c..28f84eee5562a 100644 --- a/FWCore/Framework/interface/EventPrincipal.h +++ b/FWCore/Framework/interface/EventPrincipal.h @@ -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" @@ -49,7 +50,8 @@ namespace edm { boost::shared_ptr reg, boost::shared_ptr branchIDListHelper, ProcessConfiguration const& pc, - HistoryAppender* historyAppender); + HistoryAppender* historyAppender, + StreamID const& streamID = StreamID::invalidStreamID()); ~EventPrincipal() {} void fillEventPrincipal(EventAuxiliary const& aux, @@ -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(); } @@ -176,6 +183,8 @@ namespace edm { boost::shared_ptr branchListIndexes_; std::map branchListIndexToProcessIndex_; + + StreamID streamID_; }; diff --git a/FWCore/Framework/interface/LuminosityBlock.h b/FWCore/Framework/interface/LuminosityBlock.h index 871f7c159376d..6413b1c0e15af 100644 --- a/FWCore/Framework/interface/LuminosityBlock.h +++ b/FWCore/Framework/interface/LuminosityBlock.h @@ -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" @@ -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 diff --git a/FWCore/Framework/interface/LuminosityBlockPrincipal.h b/FWCore/Framework/interface/LuminosityBlockPrincipal.h index 05d8c776fbbb4..e8c8ceb2aba6a 100644 --- a/FWCore/Framework/interface/LuminosityBlockPrincipal.h +++ b/FWCore/Framework/interface/LuminosityBlockPrincipal.h @@ -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" @@ -35,7 +36,8 @@ namespace edm { boost::shared_ptr aux, boost::shared_ptr reg, ProcessConfiguration const& pc, - HistoryAppender* historyAppender); + HistoryAppender* historyAppender, + unsigned int index); ~LuminosityBlockPrincipal() {} @@ -53,6 +55,10 @@ namespace edm { runPrincipal_ = rp; } + LuminosityBlockIndex index() const { + return index_; + } + LuminosityBlockID id() const { return aux().id(); } @@ -109,6 +115,8 @@ namespace edm { boost::shared_ptr aux_; + LuminosityBlockIndex index_; + bool complete_; }; } diff --git a/FWCore/Framework/interface/Run.h b/FWCore/Framework/interface/Run.h index f70190032392a..4faeebad7e50e 100644 --- a/FWCore/Framework/interface/Run.h +++ b/FWCore/Framework/interface/Run.h @@ -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 #include @@ -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 bool getByLabel(std::string const& label, Handle& result) const; diff --git a/FWCore/Framework/interface/RunPrincipal.h b/FWCore/Framework/interface/RunPrincipal.h index 5702f57cbd3a9..4c094dcebdd00 100644 --- a/FWCore/Framework/interface/RunPrincipal.h +++ b/FWCore/Framework/interface/RunPrincipal.h @@ -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 { @@ -34,11 +35,23 @@ namespace edm { boost::shared_ptr aux, boost::shared_ptr 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_; } @@ -89,6 +102,7 @@ namespace edm { // A vector of product holders. boost::shared_ptr aux_; + RunIndex index_; bool complete_; }; diff --git a/FWCore/Framework/src/Event.cc b/FWCore/Framework/src/Event.cc index dd1fc5fdd5ed8..0f79c85251828 100644 --- a/FWCore/Framework/src/Event.cc +++ b/FWCore/Framework/src/Event.cc @@ -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() { diff --git a/FWCore/Framework/src/EventPrincipal.cc b/FWCore/Framework/src/EventPrincipal.cc index eefc5881c8bc2..814aef4d82b87 100644 --- a/FWCore/Framework/src/EventPrincipal.cc +++ b/FWCore/Framework/src/EventPrincipal.cc @@ -22,7 +22,8 @@ namespace edm { boost::shared_ptr reg, boost::shared_ptr branchIDListHelper, ProcessConfiguration const& pc, - HistoryAppender* historyAppender) : + HistoryAppender* historyAppender, + StreamID const& streamID) : Base(reg, reg->productLookup(InEvent), pc, InEvent, historyAppender), aux_(), luminosityBlockPrincipal_(), @@ -32,7 +33,8 @@ namespace edm { eventSelectionIDs_(new EventSelectionIDVector), branchIDListHelper_(branchIDListHelper), branchListIndexes_(new BranchListIndexes), - branchListIndexToProcessIndex_() {} + branchListIndexToProcessIndex_(), + streamID_(streamID){} void EventPrincipal::clearEventPrincipal() { diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index 0ff363e855033..da20cf43189b4 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -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" @@ -658,7 +659,11 @@ namespace edm { connectSigs(this); // Reusable event principal - boost::shared_ptr ep(new EventPrincipal(preg_, branchIDListHelper_, *processConfiguration_, historyAppender_.get())); + boost::shared_ptr ep(new EventPrincipal(preg_, + branchIDListHelper_, + *processConfiguration_, + historyAppender_.get(), + StreamID{0})); principalCache_.insert(ep); // initialize the subprocess, if there is one diff --git a/FWCore/Framework/src/InputSource.cc b/FWCore/Framework/src/InputSource.cc index 91110975ca235..c67eb1896c559 100644 --- a/FWCore/Framework/src/InputSource.cc +++ b/FWCore/Framework/src/InputSource.cc @@ -286,7 +286,7 @@ namespace edm { boost::shared_ptr InputSource::readAndCacheRun(HistoryAppender& historyAppender) { RunSourceSentry sentry(*this); - boost::shared_ptr rp(new RunPrincipal(runAuxiliary(), productRegistry_, processConfiguration(), &historyAppender)); + boost::shared_ptr rp(new RunPrincipal(runAuxiliary(), productRegistry_, processConfiguration(), &historyAppender,0)); callWithTryCatchAndPrint >( [this,&rp](){ return readRun_(rp); }, "Calling InputSource::readRun_" ); return rp; } @@ -304,7 +304,7 @@ namespace edm { new LuminosityBlockPrincipal(luminosityBlockAuxiliary(), productRegistry_, processConfiguration(), - &historyAppender)); + &historyAppender,0)); callWithTryCatchAndPrint >( [this,&lbp](){ return readLuminosityBlock_(lbp); }, "Calling InputSource::readLuminosityBlock_" ); if(remainingLumis_ > 0) { diff --git a/FWCore/Framework/src/LuminosityBlock.cc b/FWCore/Framework/src/LuminosityBlock.cc index 23478b402cae2..6c0057c296c10 100644 --- a/FWCore/Framework/src/LuminosityBlock.cc +++ b/FWCore/Framework/src/LuminosityBlock.cc @@ -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(provRecorder_.principal()); diff --git a/FWCore/Framework/src/LuminosityBlockPrincipal.cc b/FWCore/Framework/src/LuminosityBlockPrincipal.cc index 93d913a2d08ce..fd2b5d0e94156 100644 --- a/FWCore/Framework/src/LuminosityBlockPrincipal.cc +++ b/FWCore/Framework/src/LuminosityBlockPrincipal.cc @@ -12,10 +12,12 @@ namespace edm { boost::shared_ptr aux, boost::shared_ptr 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) { } diff --git a/FWCore/Framework/src/Run.cc b/FWCore/Framework/src/Run.cc index 9613194f2148a..016d037e8f20c 100644 --- a/FWCore/Framework/src/Run.cc +++ b/FWCore/Framework/src/Run.cc @@ -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(provRecorder_.principal()); diff --git a/FWCore/Framework/src/RunPrincipal.cc b/FWCore/Framework/src/RunPrincipal.cc index 182e1ff10dc34..8ca7a78efbb1e 100644 --- a/FWCore/Framework/src/RunPrincipal.cc +++ b/FWCore/Framework/src/RunPrincipal.cc @@ -12,9 +12,10 @@ namespace edm { boost::shared_ptr aux, boost::shared_ptr 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 diff --git a/FWCore/Framework/src/SubProcess.cc b/FWCore/Framework/src/SubProcess.cc index 003aa3d27a1d5..ce40945529292 100644 --- a/FWCore/Framework/src/SubProcess.cc +++ b/FWCore/Framework/src/SubProcess.cc @@ -122,7 +122,8 @@ namespace edm { std::map > > outputModulePathPositions; setEventSelectionInfo(outputModulePathPositions, parentProductRegistry->anyProductProduced()); - boost::shared_ptr ep(new EventPrincipal(preg_, branchIDListHelper_, *processConfiguration_, historyAppender_.get())); + boost::shared_ptr ep(new EventPrincipal(preg_, branchIDListHelper_, *processConfiguration_, historyAppender_.get(), + StreamID::invalidStreamID())); principalCache_.insert(ep); if(subProcessParameterSet) { @@ -194,6 +195,7 @@ namespace edm { } EventPrincipal& ep = principalCache_.eventPrincipal(); + ep.setStreamID(principal.streamID()); ep.fillEventPrincipal(aux, esids, boost::shared_ptr(new BranchListIndexes(principal.branchListIndexes())), @@ -220,7 +222,7 @@ namespace edm { SubProcess::beginRun(RunPrincipal const& principal) { boost::shared_ptr aux(new RunAuxiliary(principal.aux())); aux->setProcessHistoryID(principal.processHistoryID()); - boost::shared_ptr rpp(new RunPrincipal(aux, preg_, *processConfiguration_, historyAppender_.get())); + boost::shared_ptr rpp(new RunPrincipal(aux, preg_, *processConfiguration_, historyAppender_.get(),principal.index())); rpp->fillRunPrincipal(principal.reader()); principalCache_.insert(rpp); @@ -286,7 +288,7 @@ namespace edm { SubProcess::beginLuminosityBlock(LuminosityBlockPrincipal const& principal) { boost::shared_ptr aux(new LuminosityBlockAuxiliary(principal.aux())); aux->setProcessHistoryID(principal.processHistoryID()); - boost::shared_ptr lbpp(new LuminosityBlockPrincipal(aux, preg_, *processConfiguration_, historyAppender_.get())); + boost::shared_ptr lbpp(new LuminosityBlockPrincipal(aux, preg_, *processConfiguration_, historyAppender_.get(),principal.index())); lbpp->fillLuminosityBlockPrincipal(principal.reader()); lbpp->setRunPrincipal(principalCache_.runPrincipalPtr()); principalCache_.insert(lbpp); diff --git a/FWCore/Framework/test/Event_t.cpp b/FWCore/Framework/test/Event_t.cpp index ea172b8a90e60..857f1158cf38f 100644 --- a/FWCore/Framework/test/Event_t.cpp +++ b/FWCore/Framework/test/Event_t.cpp @@ -365,13 +365,13 @@ void testEvent::setUp() { EventID id = make_id(); ProcessConfiguration const& pc = currentModuleDescription_->processConfiguration(); boost::shared_ptr runAux(new RunAuxiliary(id.run(), time, time)); - boost::shared_ptr rp(new RunPrincipal(runAux, preg, pc, &historyAppender_)); + boost::shared_ptr rp(new RunPrincipal(runAux, preg, pc, &historyAppender_,0)); boost::shared_ptr lumiAux(new LuminosityBlockAuxiliary(rp->run(), 1, time, time)); - boost::shared_ptrlbp(new LuminosityBlockPrincipal(lumiAux, preg, pc, &historyAppender_)); + boost::shared_ptrlbp(new LuminosityBlockPrincipal(lumiAux, preg, pc, &historyAppender_,0)); lbp->setRunPrincipal(rp); EventAuxiliary eventAux(id, uuid, time, true); const_cast(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_)); diff --git a/FWCore/Framework/test/event_getrefbeforeput_t.cppunit.cc b/FWCore/Framework/test/event_getrefbeforeput_t.cppunit.cc index 5cf3c69483710..11765c599aa4d 100644 --- a/FWCore/Framework/test/event_getrefbeforeput_t.cppunit.cc +++ b/FWCore/Framework/test/event_getrefbeforeput_t.cppunit.cc @@ -73,12 +73,12 @@ void testEventGetRefBeforePut::failGetProductNotRegisteredTest() { edm::ProcessConfiguration pc("PROD", edm::ParameterSetID(), edm::getReleaseVersion(), edm::getPassID()); boost::shared_ptr pregc(preg.release()); boost::shared_ptr runAux(new edm::RunAuxiliary(col.run(), fakeTime, fakeTime)); - boost::shared_ptr rp(new edm::RunPrincipal(runAux, pregc, pc, &historyAppender_)); + boost::shared_ptr rp(new edm::RunPrincipal(runAux, pregc, pc, &historyAppender_,0)); boost::shared_ptr lumiAux(new edm::LuminosityBlockAuxiliary(rp->run(), 1, fakeTime, fakeTime)); - boost::shared_ptrlbp(new edm::LuminosityBlockPrincipal(lumiAux, pregc, pc, &historyAppender_)); + boost::shared_ptrlbp(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 { @@ -145,12 +145,12 @@ void testEventGetRefBeforePut::getRefTest() { edm::ProcessConfiguration& pc = *pcPtr; boost::shared_ptr pregc(preg.release()); boost::shared_ptr runAux(new edm::RunAuxiliary(col.run(), fakeTime, fakeTime)); - boost::shared_ptr rp(new edm::RunPrincipal(runAux, pregc, pc, &historyAppender_)); + boost::shared_ptr rp(new edm::RunPrincipal(runAux, pregc, pc, &historyAppender_,0)); boost::shared_ptr lumiAux(new edm::LuminosityBlockAuxiliary(rp->run(), 1, fakeTime, fakeTime)); - boost::shared_ptrlbp(new edm::LuminosityBlockPrincipal(lumiAux, pregc, pc, &historyAppender_)); + boost::shared_ptrlbp(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); diff --git a/FWCore/Framework/test/eventprincipal_t.cppunit.cc b/FWCore/Framework/test/eventprincipal_t.cppunit.cc index 6fd267400ef1e..97f9a4f7f22a7 100644 --- a/FWCore/Framework/test/eventprincipal_t.cppunit.cc +++ b/FWCore/Framework/test/eventprincipal_t.cppunit.cc @@ -186,12 +186,12 @@ void test_ep::setUp() { std::string uuid = edm::createGlobalIdentifier(); edm::Timestamp now(1234567UL); boost::shared_ptr runAux(new edm::RunAuxiliary(eventID_.run(), now, now)); - boost::shared_ptr rp(new edm::RunPrincipal(runAux, pProductRegistry_, *process, &historyAppender_)); + boost::shared_ptr rp(new edm::RunPrincipal(runAux, pProductRegistry_, *process, &historyAppender_,0)); boost::shared_ptr lumiAux(new edm::LuminosityBlockAuxiliary(rp->run(), 1, now, now)); - boost::shared_ptrlbp(new edm::LuminosityBlockPrincipal(lumiAux, pProductRegistry_, *process, &historyAppender_)); + boost::shared_ptrlbp(new edm::LuminosityBlockPrincipal(lumiAux, pProductRegistry_, *process, &historyAppender_,0)); lbp->setRunPrincipal(rp); edm::EventAuxiliary eventAux(eventID_, uuid, now, true); - pEvent_.reset(new edm::EventPrincipal(pProductRegistry_, branchIDListHelper, *process, &historyAppender_)); + pEvent_.reset(new edm::EventPrincipal(pProductRegistry_, branchIDListHelper, *process, &historyAppender_,edm::StreamID::invalidStreamID())); pEvent_->fillEventPrincipal(eventAux); pEvent_->setLuminosityBlockPrincipal(lbp); pEvent_->put(branchFromRegistry, product, prov); diff --git a/FWCore/Framework/test/generichandle_t.cppunit.cc b/FWCore/Framework/test/generichandle_t.cppunit.cc index 38e0c5b1d9821..8eadef1450ce3 100644 --- a/FWCore/Framework/test/generichandle_t.cppunit.cc +++ b/FWCore/Framework/test/generichandle_t.cppunit.cc @@ -85,14 +85,14 @@ void testGenericHandle::failgetbyLabelTest() { boost::shared_ptr preg(new edm::ProductRegistry); preg->setFrozen(); boost::shared_ptr runAux(new edm::RunAuxiliary(id.run(), time, time)); - boost::shared_ptr rp(new edm::RunPrincipal(runAux, preg, pc, &historyAppender_)); + boost::shared_ptr rp(new edm::RunPrincipal(runAux, preg, pc, &historyAppender_,0)); boost::shared_ptr lumiAux(new edm::LuminosityBlockAuxiliary(rp->run(), 1, time, time)); - boost::shared_ptrlbp(new edm::LuminosityBlockPrincipal(lumiAux, preg, pc, &historyAppender_)); + boost::shared_ptrlbp(new edm::LuminosityBlockPrincipal(lumiAux, preg, pc, &historyAppender_,0)); lbp->setRunPrincipal(rp); boost::shared_ptr branchIDListHelper(new edm::BranchIDListHelper()); branchIDListHelper->updateRegistries(*preg); edm::EventAuxiliary eventAux(id, uuid, time, true); - edm::EventPrincipal ep(preg, branchIDListHelper, pc, &historyAppender_); + edm::EventPrincipal ep(preg, branchIDListHelper, pc, &historyAppender_,edm::StreamID::invalidStreamID()); ep.fillEventPrincipal(eventAux); ep.setLuminosityBlockPrincipal(lbp); edm::GenericHandle h("edmtest::DummyProduct"); @@ -176,12 +176,12 @@ void testGenericHandle::getbyLabelTest() { edm::ProcessConfiguration pc("PROD", dummyProcessPset.id(), edm::getReleaseVersion(), edm::getPassID()); boost::shared_ptr pregc(preg.release()); boost::shared_ptr runAux(new edm::RunAuxiliary(col.run(), fakeTime, fakeTime)); - boost::shared_ptr rp(new edm::RunPrincipal(runAux, pregc, pc, &historyAppender_)); + boost::shared_ptr rp(new edm::RunPrincipal(runAux, pregc, pc, &historyAppender_,0)); boost::shared_ptr lumiAux(new edm::LuminosityBlockAuxiliary(rp->run(), 1, fakeTime, fakeTime)); - boost::shared_ptrlbp(new edm::LuminosityBlockPrincipal(lumiAux, pregc, pc, &historyAppender_)); + boost::shared_ptrlbp(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); edm::BranchDescription const& branchFromRegistry = it->second; diff --git a/FWCore/Integration/test/TestRunLumiSource.cc b/FWCore/Integration/test/TestRunLumiSource.cc index ce21cbc099a4f..2310fe327d345 100644 --- a/FWCore/Integration/test/TestRunLumiSource.cc +++ b/FWCore/Integration/test/TestRunLumiSource.cc @@ -107,19 +107,19 @@ namespace edm { boost::shared_ptr runAux(new RunAuxiliary(run, ts, Timestamp::invalidTimestamp())); boost::shared_ptr rp2( - new RunPrincipal(runAux, productRegistry(), processConfiguration(), &historyAppender_)); + new RunPrincipal(runAux, productRegistry(), processConfiguration(), &historyAppender_,0)); boost::shared_ptr lumiAux( new LuminosityBlockAuxiliary(rp2->run(), lumi, ts, Timestamp::invalidTimestamp())); boost::shared_ptr lbp2( - new LuminosityBlockPrincipal(lumiAux, productRegistry(), processConfiguration(), &historyAppender_)); + new LuminosityBlockPrincipal(lumiAux, productRegistry(), processConfiguration(), &historyAppender_,0)); lbp2->setRunPrincipal(rp2); EventID id(run, lbp2->luminosityBlock(), event); currentIndex_ += 3; EventAuxiliary eventAux(id, processGUID(), ts, false); boost::shared_ptr branchIDListHelper(new BranchIDListHelper()); - EventPrincipal* result(new EventPrincipal(productRegistry(), branchIDListHelper, processConfiguration(), &historyAppender_)); + EventPrincipal* result(new EventPrincipal(productRegistry(), branchIDListHelper, processConfiguration(), &historyAppender_,eventPrincipal.streamID())); result->fillEventPrincipal(eventAux); result->setLuminosityBlockPrincipal(lbp2); return result; diff --git a/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc b/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc index 9a400106d0864..3e8bd0fdbd07d 100644 --- a/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc +++ b/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc @@ -282,11 +282,11 @@ TFWLiteSelectorBasic::Process(Long64_t iEntry) { try { m_->reader_->setEntry(iEntry); boost::shared_ptr runAux(new edm::RunAuxiliary(aux.run(), aux.time(), aux.time())); - boost::shared_ptr rp(new edm::RunPrincipal(runAux, m_->reg_, m_->pc_, nullptr)); + boost::shared_ptr rp(new edm::RunPrincipal(runAux, m_->reg_, m_->pc_, nullptr,0)); boost::shared_ptr lumiAux( new edm::LuminosityBlockAuxiliary(rp->run(), 1, aux.time(), aux.time())); boost::shared_ptrlbp( - new edm::LuminosityBlockPrincipal(lumiAux, m_->reg_, m_->pc_, nullptr)); + new edm::LuminosityBlockPrincipal(lumiAux, m_->reg_, m_->pc_, nullptr,0)); m_->ep_->fillEventPrincipal(*eaux, eventSelectionIDs_, branchListIndexes_, m_->mapper_, m_->reader_.get()); lbp->setRunPrincipal(rp); m_->ep_->setLuminosityBlockPrincipal(lbp); @@ -452,7 +452,7 @@ TFWLiteSelectorBasic::setupNewFile(TFile& iFile) { } } m_->branchIDListHelper_->updateFromInput(*branchIDListsPtr); - m_->ep_.reset(new edm::EventPrincipal(m_->reg_, m_->branchIDListHelper_, m_->pc_, nullptr)); + m_->ep_.reset(new edm::EventPrincipal(m_->reg_, m_->branchIDListHelper_, m_->pc_, nullptr,edm::StreamID::invalidStreamID())); everythingOK_ = true; } diff --git a/FWCore/Utilities/interface/LuminosityBlockIndex.h b/FWCore/Utilities/interface/LuminosityBlockIndex.h new file mode 100644 index 0000000000000..cef771edf638a --- /dev/null +++ b/FWCore/Utilities/interface/LuminosityBlockIndex.h @@ -0,0 +1,70 @@ +#ifndef FWCore_Utilities_LuminosityBlockIndex_h +#define FWCore_Utilities_LuminosityBlockIndex_h +// -*- C++ -*- +// +// Package: FWCore/Utilities +// Class : edm::LuminosityBlockIndex +// +/**\class edm::LuminosityBlockIndex LuminosityBlockIndex.h "FWCore/Utilities/interface/LuminosityBlockIndex.h" + + Description: Identifies a 'slot' being used to hold an active LuminosityBlock + + Usage: + Various APIs used this to access per LuminosityBlock information. + It is important to realize that the same LuminosityBockIndex may be used to refer + to different LuminosityBlocks over the lifetime of a job. A LuminosityBlockIndex + will only get a new LuminosityBlock after the previous LuminosityBlock using + that index has finished being used. + +*/ +// +// Original Author: Chris Jones +// Created: Fri, 26 Apr 2013 19:39:10 GMT +// $Id$ +// + +// system include files + +// user include files + +// forward declarations +namespace edm { + class LuminosityBlockPrincipal; + + class LuminosityBlockIndex + { + + public: + LuminosityBlockIndex(const LuminosityBlockIndex&) = default; + LuminosityBlockIndex& operator=(const LuminosityBlockIndex&) = default; + ~LuminosityBlockIndex() = default; + + // ---------- const member functions --------------------- + operator unsigned int() const { + return value_; + } + + bool operator==(LuminosityBlockIndex const& iRHS) const { + return value() == iRHS.value(); + } + + /** \return value ranging from 0 to one less than max number of simultaneous luminosityblocks. + */ + unsigned int value() const { return value_;} + + private: + ///Only the LuminosityBlockPrincipal is allowed to make one of these + friend class LuminosityBlockPrincipal; + + explicit LuminosityBlockIndex(unsigned int iValue): value_{iValue} {} + + LuminosityBlockIndex()= delete; + + // ---------- member data -------------------------------- + unsigned int value_; + + }; +} + + +#endif diff --git a/FWCore/Utilities/interface/RunIndex.h b/FWCore/Utilities/interface/RunIndex.h new file mode 100644 index 0000000000000..c40acc17c4b0a --- /dev/null +++ b/FWCore/Utilities/interface/RunIndex.h @@ -0,0 +1,68 @@ +#ifndef FWCore_Utilities_RunIndex_h +#define FWCore_Utilities_RunIndex_h +// -*- C++ -*- +// +// Package: FWCore/Utilities +// Class : edm::RunIndex +// +/**\class edm::RunIndex RunIndex.h "FWCore/Utilities/interface/RunIndex.h" + + Description: Identifies a 'slot' being used to hold an active Run + + Usage: + Various APIs used this to access per Run information. + It is important to realize that the same RunIndex may be used to refer + to different Runs over the lifetime of a job. An RunIndex will only get + a new Run after the previous Run using that index has finished being used. + +*/ +// +// Original Author: Chris Jones +// Created: Fri, 26 Apr 2013 19:38:56 GMT +// $Id$ +// + +// system include files + +// user include files + +// forward declarations +namespace edm { + class RunPrincipal; + + class RunIndex + { + + public: + ~RunIndex() = default; + RunIndex(const RunIndex&) = default; + RunIndex& operator=(const RunIndex&) = default; + + // ---------- const member functions --------------------- + bool operator==(const RunIndex& iIndex) const { + return value() == iIndex.value(); + } + operator unsigned int() const { + return value_; + } + + /** \return value ranging from 0 to one less than max number of simultaneous runs. + */ + unsigned int value() const { return value_;} + + + private: + ///Only the RunPrincipal is allowed to make one of these + friend class RunPrincipal; + explicit RunIndex(unsigned int iIndex) : value_(iIndex) {} + + RunIndex() = delete; + + // ---------- member data -------------------------------- + unsigned int value_; + + }; +} + + +#endif diff --git a/FWCore/Utilities/interface/StreamID.h b/FWCore/Utilities/interface/StreamID.h new file mode 100644 index 0000000000000..b36c5a9f94c93 --- /dev/null +++ b/FWCore/Utilities/interface/StreamID.h @@ -0,0 +1,65 @@ +#ifndef FWCore_Utilities_StreamID_h +#define FWCore_Utilities_StreamID_h +// -*- C++ -*- +// +// Package: FWCore/Utilities +// Class : edm::StreamID +// +/**\class edm::StreamID StreamID.h "FWCore/Utilities/interface/StreamID.h" + + Description: Identifies an edm stream + + Usage: + Various APIs use this type to allow access to per stream information. + +*/ +// +// Original Author: Chris Jones +// Created: Fri, 26 Apr 2013 19:37:37 GMT +// $Id$ +// + +// system include files + +// user include files + +// forward declarations +namespace edm { + class EventProcessor; + + class StreamID + { + + public: + ~StreamID() = default; + StreamID(const StreamID&) = default; + StreamID& operator=(const StreamID&) = default; + + bool operator==(const StreamID& iID) const { + return iID.value_ == value_; + } + + operator unsigned int() const {return value_;} + + /** \return value ranging from 0 to one less than max number of streams. + */ + unsigned int value() const { return value_; } + + static StreamID invalidStreamID() { + return StreamID(0xFFFFFFFFU); + } + + private: + ///Only a Schedule is allowed to create one of these + friend class EventProcessor; + explicit StreamID(unsigned int iValue) : value_(iValue) {} + + StreamID() = delete; + + // ---------- member data -------------------------------- + unsigned int value_; + }; +} + + +#endif diff --git a/IOPool/Input/src/PoolSource.cc b/IOPool/Input/src/PoolSource.cc index a2b47e63615e9..9a31b32c4ac97 100644 --- a/IOPool/Input/src/PoolSource.cc +++ b/IOPool/Input/src/PoolSource.cc @@ -60,7 +60,7 @@ namespace edm { new RootInputFileSequence(pset, *this, catalog(1), InputType::SecondaryFile)), secondaryRunPrincipal_(), secondaryLumiPrincipal_(), - secondaryEventPrincipal_(secondaryFileSequence_ ? new EventPrincipal(secondaryFileSequence_->fileProductRegistry(), secondaryFileSequence_->fileBranchIDListHelper(), processConfiguration(), nullptr) : 0), + secondaryEventPrincipal_(secondaryFileSequence_ ? new EventPrincipal(secondaryFileSequence_->fileProductRegistry(), secondaryFileSequence_->fileBranchIDListHelper(), processConfiguration(), nullptr,StreamID::invalidStreamID()) : 0), branchIDsToReplace_() { if(secondaryFileSequence_) { assert(primary()); @@ -138,7 +138,7 @@ namespace edm { if(found) { boost::shared_ptr secondaryAuxiliary = secondaryFileSequence_->readRunAuxiliary_(); checkConsistency(primaryPrincipal->aux(), *secondaryAuxiliary); - boost::shared_ptr rp(new RunPrincipal(secondaryAuxiliary, secondaryFileSequence_->fileProductRegistry(), processConfiguration(), nullptr)); + boost::shared_ptr rp(new RunPrincipal(secondaryAuxiliary, secondaryFileSequence_->fileProductRegistry(), processConfiguration(), nullptr,runPrincipal->index())); secondaryRunPrincipal_ = secondaryFileSequence_->readRun_(rp); checkHistoryConsistency(*primaryPrincipal, *secondaryRunPrincipal_); primaryPrincipal->recombine(*secondaryRunPrincipal_, branchIDsToReplace_[InRun]); @@ -160,7 +160,7 @@ namespace edm { if(found) { boost::shared_ptr secondaryAuxiliary = secondaryFileSequence_->readLuminosityBlockAuxiliary_(); checkConsistency(primaryPrincipal->aux(), *secondaryAuxiliary); - boost::shared_ptr lbp(new LuminosityBlockPrincipal(secondaryAuxiliary, secondaryFileSequence_->fileProductRegistry(), processConfiguration(), nullptr)); + boost::shared_ptr lbp(new LuminosityBlockPrincipal(secondaryAuxiliary, secondaryFileSequence_->fileProductRegistry(), processConfiguration(), nullptr,lumiPrincipal->index())); secondaryLumiPrincipal_ = secondaryFileSequence_->readLuminosityBlock_(lbp); checkHistoryConsistency(*primaryPrincipal, *secondaryLumiPrincipal_); primaryPrincipal->recombine(*secondaryLumiPrincipal_, branchIDsToReplace_[InLumi]); diff --git a/IOPool/SecondaryInput/test/SecondaryProducer.cc b/IOPool/SecondaryInput/test/SecondaryProducer.cc index fff2d6fa44d20..4db3870a5cc7e 100644 --- a/IOPool/SecondaryInput/test/SecondaryProducer.cc +++ b/IOPool/SecondaryInput/test/SecondaryProducer.cc @@ -65,7 +65,7 @@ namespace edm { eventPrincipal_.reset(new EventPrincipal(secInput_->productRegistry(), secInput_->branchIDListHelper(), *processConfiguration_, - nullptr)); + nullptr, StreamID::invalidStreamID())); }