Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:02:10

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 {
0038       return m_streamModules[0]->transformPrefetch_(iTransformIndex);
0039     }
0040     template <>
0041     size_t ProducingModuleAdaptorBase<edm::stream::EDProducerBase>::transformIndex_(
0042         edm::BranchDescription const& iBranch) const {
0043       return m_streamModules[0]->transformIndex_(iBranch);
0044     }
0045     template <>
0046     void ProducingModuleAdaptorBase<edm::stream::EDProducerBase>::doTransformAsync(WaitingTaskHolder iTask,
0047                                                                                    size_t iTransformIndex,
0048                                                                                    EventPrincipal const& iEvent,
0049                                                                                    ActivityRegistry*,
0050                                                                                    ModuleCallingContext const* iMCC,
0051                                                                                    ServiceWeakToken const& iToken) {
0052       EventForTransformer ev(iEvent, iMCC);
0053       m_streamModules[iEvent.streamID()]->transformAsync_(iTask, iTransformIndex, ev, iToken);
0054     }
0055 
0056     //
0057     // constants, enums and typedefs
0058     //
0059 
0060     //
0061     // static data member definitions
0062     //
0063 
0064     //
0065     // constructors and destructor
0066     //
0067     EDProducerAdaptorBase::EDProducerAdaptorBase() {}
0068 
0069     bool EDProducerAdaptorBase::doEvent(EventTransitionInfo const& info,
0070                                         ActivityRegistry* act,
0071                                         ModuleCallingContext const* mcc) {
0072       EventPrincipal const& ep = info.principal();
0073       assert(ep.streamID() < m_streamModules.size());
0074       auto mod = m_streamModules[ep.streamID()];
0075       Event e(ep, moduleDescription(), mcc);
0076       e.setConsumer(mod);
0077       e.setProducer(mod, &mod->previousParentage_, &mod->gotBranchIDsFromAcquire_);
0078       EventSignalsSentry sentry(act, mcc);
0079       ESParentContext parentC(mcc);
0080       const EventSetup c{
0081           info, static_cast<unsigned int>(Transition::Event), mod->esGetTokenIndices(Transition::Event), parentC};
0082       mod->produce(e, c);
0083       commit(e, &mod->previousParentageId_);
0084       return true;
0085     }
0086 
0087     void EDProducerAdaptorBase::doAcquire(EventTransitionInfo const& info,
0088                                           ActivityRegistry* act,
0089                                           ModuleCallingContext const* mcc,
0090                                           WaitingTaskWithArenaHolder& holder) {
0091       EventPrincipal const& ep = info.principal();
0092       assert(ep.streamID() < m_streamModules.size());
0093       auto mod = m_streamModules[ep.streamID()];
0094       Event e(ep, moduleDescription(), mcc);
0095       e.setConsumer(mod);
0096       e.setProducerForAcquire(mod, nullptr, mod->gotBranchIDsFromAcquire_);
0097       EventAcquireSignalsSentry sentry(act, mcc);
0098       ESParentContext parentC(mcc);
0099       const EventSetup c{
0100           info, static_cast<unsigned int>(Transition::Event), mod->esGetTokenIndices(Transition::Event), parentC};
0101       mod->doAcquire_(e, c, holder);
0102     }
0103 
0104     template class edm::stream::ProducingModuleAdaptorBase<edm::stream::EDProducerBase>;
0105   }  // namespace stream
0106 }  // namespace edm