Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:08

0001 // -*- C++ -*-
0002 //
0003 // Package:     FWCore/Framework
0004 // Class  :     edm::stream::EDFilterAdaptorBase
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/EDFilterAdaptorBase.h"
0017 #include "FWCore/Framework/interface/stream/EDFilterBase.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/EventSetup.h"
0022 #include "FWCore/Framework/interface/EventPrincipal.h"
0023 #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h"
0024 #include "FWCore/Framework/interface/RunPrincipal.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     //
0036     // constants, enums and typedefs
0037     //
0038 
0039     //
0040     // static data member definitions
0041     //
0042 
0043     //
0044     // constructors and destructor
0045     //
0046     EDFilterAdaptorBase::EDFilterAdaptorBase() {}
0047 
0048     bool EDFilterAdaptorBase::doEvent(EventTransitionInfo const& info,
0049                                       ActivityRegistry* act,
0050                                       ModuleCallingContext const* mcc) {
0051       EventPrincipal const& ep = info.principal();
0052       assert(ep.streamID() < m_streamModules.size());
0053       auto mod = m_streamModules[ep.streamID()];
0054       Event e(ep, moduleDescription(), mcc);
0055       e.setConsumer(mod);
0056       e.setProducer(mod, &mod->previousParentage_, &mod->gotBranchIDsFromAcquire_);
0057       EventSignalsSentry sentry(act, mcc);
0058       ESParentContext parentC(mcc);
0059       const EventSetup c{
0060           info, static_cast<unsigned int>(Transition::Event), mod->esGetTokenIndices(Transition::Event), parentC};
0061       bool result = mod->filter(e, c);
0062       commit(e, &mod->previousParentageId_);
0063       return result;
0064     }
0065 
0066     void EDFilterAdaptorBase::doAcquire(EventTransitionInfo const& info,
0067                                         ActivityRegistry* act,
0068                                         ModuleCallingContext const* mcc,
0069                                         WaitingTaskWithArenaHolder& holder) {
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.setProducerForAcquire(mod, nullptr, mod->gotBranchIDsFromAcquire_);
0076       EventAcquireSignalsSentry 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->doAcquire_(e, c, holder);
0081     }
0082 
0083     template class edm::stream::ProducingModuleAdaptorBase<edm::stream::EDFilterBase>;
0084   }  // namespace stream
0085 }  // namespace edm