Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-09-11 22:29:31

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