Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-11 03:34:14

0001 // -*- C++ -*-
0002 //
0003 // Package:     FWCore/Framework
0004 // Class  :     edm::stream::EDProducerAdaptorBase
0005 //
0006 // Implementation:
0007 //     [Notes on implementation]
0008 //
0009 // Original Author:  Chris Jones
0010 //         Created:  Fri, 02 Aug 2013 21:43:44 GMT
0011 //
0012 
0013 // system include files
0014 
0015 // user include files
0016 #include "FWCore/Framework/interface/stream/EDProducerAdaptorBase.h"
0017 #include "FWCore/Framework/interface/stream/EDProducerBase.h"
0018 #include "FWCore/Framework/interface/Event.h"
0019 #include "FWCore/Framework/interface/LuminosityBlock.h"
0020 #include "FWCore/Framework/interface/Run.h"
0021 #include "FWCore/Framework/interface/EventPrincipal.h"
0022 #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h"
0023 #include "FWCore/Framework/interface/RunPrincipal.h"
0024 #include "FWCore/Framework/interface/EventSetup.h"
0025 #include "FWCore/Framework/src/EventAcquireSignalsSentry.h"
0026 #include "FWCore/Framework/src/EventSignalsSentry.h"
0027 #include "FWCore/Framework/src/stream/ProducingModuleAdaptorBase.cc"
0028 #include "FWCore/Framework/interface/TransitionInfoTypes.h"
0029 #include "FWCore/ServiceRegistry/interface/ESParentContext.h"
0030 
0031 using namespace edm::stream;
0032 namespace edm {
0033   namespace stream {
0034 
0035     template <>
0036     ProductResolverIndex ProducingModuleAdaptorBase<edm::stream::EDProducerBase>::transformPrefetch_(
0037         size_t iTransformIndex) const noexcept {
0038       return m_streamModules[0]->transformPrefetch_(iTransformIndex);
0039     }
0040     template <>
0041     size_t ProducingModuleAdaptorBase<edm::stream::EDProducerBase>::transformIndex_(
0042         edm::BranchDescription const& iBranch) const noexcept {
0043       return m_streamModules[0]->transformIndex_(iBranch);
0044     }
0045     template <>
0046     void ProducingModuleAdaptorBase<edm::stream::EDProducerBase>::doTransformAsync(
0047         WaitingTaskHolder iTask,
0048         size_t iTransformIndex,
0049         EventPrincipal const& iEvent,
0050         ActivityRegistry* iAct,
0051         ModuleCallingContext iMCC,
0052         ServiceWeakToken const& iToken) noexcept {
0053       EventForTransformer ev(iEvent, iMCC);
0054       m_streamModules[iEvent.streamID()]->transformAsync_(iTask, iTransformIndex, ev, iAct, iToken);
0055     }
0056 
0057     //
0058     // constants, enums and typedefs
0059     //
0060 
0061     //
0062     // static data member definitions
0063     //
0064 
0065     //
0066     // constructors and destructor
0067     //
0068     EDProducerAdaptorBase::EDProducerAdaptorBase() {}
0069 
0070     bool EDProducerAdaptorBase::doEvent(EventTransitionInfo const& info,
0071                                         ActivityRegistry* act,
0072                                         ModuleCallingContext const* mcc) {
0073       EventPrincipal const& ep = info.principal();
0074       assert(ep.streamID() < m_streamModules.size());
0075       auto mod = m_streamModules[ep.streamID()];
0076       Event e(ep, moduleDescription(), mcc);
0077       e.setConsumer(mod);
0078       e.setProducer(mod, &mod->previousParentage_, &mod->gotBranchIDsFromAcquire_);
0079       EventSignalsSentry sentry(act, mcc);
0080       ESParentContext parentC(mcc);
0081       const EventSetup c{
0082           info, static_cast<unsigned int>(Transition::Event), mod->esGetTokenIndices(Transition::Event), parentC};
0083       mod->produce(e, c);
0084       commit(e, &mod->previousParentageId_);
0085       return true;
0086     }
0087 
0088     void EDProducerAdaptorBase::doAcquire(EventTransitionInfo const& info,
0089                                           ActivityRegistry* act,
0090                                           ModuleCallingContext const* mcc,
0091                                           WaitingTaskWithArenaHolder& holder) {
0092       EventPrincipal const& ep = info.principal();
0093       assert(ep.streamID() < m_streamModules.size());
0094       auto mod = m_streamModules[ep.streamID()];
0095       Event e(ep, moduleDescription(), mcc);
0096       e.setConsumer(mod);
0097       e.setProducerForAcquire(mod, nullptr, mod->gotBranchIDsFromAcquire_);
0098       EventAcquireSignalsSentry sentry(act, mcc);
0099       ESParentContext parentC(mcc);
0100       const EventSetup c{
0101           info, static_cast<unsigned int>(Transition::Event), mod->esGetTokenIndices(Transition::Event), parentC};
0102       mod->doAcquire_(e, c, holder);
0103     }
0104 
0105     template class edm::stream::ProducingModuleAdaptorBase<edm::stream::EDProducerBase>;
0106   }  // namespace stream
0107 }  // namespace edm