Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-10 02:50:54

0001 #ifndef FWCore_Framework_global_OutputModuleBase_h
0002 #define FWCore_Framework_global_OutputModuleBase_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/Framework
0006 // Class  :     OutputModuleBase
0007 //
0008 /**\class OutputModuleBase OutputModuleBase.h "FWCore/Framework/interface/global/OutputModuleBase.h"
0009 
0010  Description: Base class for all 'global' OutputModules
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 //
0018 
0019 // system include files
0020 
0021 // user include files
0022 #include "FWCore/Framework/interface/OutputModuleCore.h"
0023 
0024 // forward declarations
0025 namespace edm {
0026 
0027   namespace global {
0028 
0029     class OutputModuleBase : public core::OutputModuleCore {
0030     public:
0031       template <typename U>
0032       friend class edm::maker::ModuleHolderT;
0033       template <typename T>
0034       friend class ::edm::WorkerT;
0035       template <typename T>
0036       friend class ::edm::OutputModuleCommunicatorT;
0037       typedef OutputModuleBase ModuleType;
0038 
0039       explicit OutputModuleBase(ParameterSet const& pset);
0040 
0041       OutputModuleBase(OutputModuleBase const&) = delete;             // Disallow copying and moving
0042       OutputModuleBase& operator=(OutputModuleBase const&) = delete;  // Disallow copying and moving
0043 
0044       //Output modules always need writeRun and writeLumi to be called
0045       bool wantsGlobalRuns() const { return true; }
0046       bool wantsGlobalLuminosityBlocks() const { return true; }
0047 
0048       virtual bool wantsProcessBlocks() const = 0;
0049       virtual bool wantsInputProcessBlocks() const = 0;
0050       virtual bool wantsStreamRuns() const = 0;
0051       virtual bool wantsStreamLuminosityBlocks() const = 0;
0052 
0053     protected:
0054       void doPreallocate(PreallocationConfiguration const&);
0055 
0056       void doBeginJob();
0057 
0058       void doBeginStream(StreamID id) { doBeginStream_(id); }
0059       void doEndStream(StreamID id) { doEndStream_(id); }
0060 
0061       bool doEvent(EventTransitionInfo const&, ActivityRegistry*, ModuleCallingContext const*);
0062       void doAcquire(EventTransitionInfo const&,
0063                      ActivityRegistry*,
0064                      ModuleCallingContext const*,
0065                      WaitingTaskWithArenaHolder&);
0066       //For now this is a placeholder
0067       /*virtual*/ void preActionBeforeRunEventAsync(WaitingTaskHolder iTask,
0068                                                     ModuleCallingContext const& iModuleCallingContext,
0069                                                     Principal const& iPrincipal) const {}
0070 
0071     private:
0072       std::string workerType() const { return "WorkerT<edm::global::OutputModuleBase>"; }
0073 
0074       void registerProductsAndCallbacks(OutputModuleBase const*, ProductRegistry const*) {}
0075 
0076       virtual void preallocStreams(unsigned int) {}
0077       virtual void preallocate(PreallocationConfiguration const&) {}
0078       virtual void doBeginStream_(StreamID) {}
0079       virtual void doEndStream_(StreamID) {}
0080       virtual void doStreamBeginRun_(StreamID, RunForOutput const&, EventSetup const&) {}
0081       virtual void doStreamEndRun_(StreamID, RunForOutput const&, EventSetup const&) {}
0082       virtual void doStreamEndRunSummary_(StreamID, RunForOutput const&, EventSetup const&) {}
0083       virtual void doStreamBeginLuminosityBlock_(StreamID, LuminosityBlockForOutput const&, EventSetup const&) {}
0084       virtual void doStreamEndLuminosityBlock_(StreamID, LuminosityBlockForOutput const&, EventSetup const&) {}
0085       virtual void doStreamEndLuminosityBlockSummary_(StreamID, LuminosityBlockForOutput const&, EventSetup const&) {}
0086 
0087       virtual void doBeginRunSummary_(RunForOutput const&, EventSetup const&) {}
0088       virtual void doEndRunSummary_(RunForOutput const&, EventSetup const&) {}
0089       virtual void doBeginLuminosityBlockSummary_(LuminosityBlockForOutput const&, EventSetup const&) {}
0090       virtual void doEndLuminosityBlockSummary_(LuminosityBlockForOutput const&, EventSetup const&) {}
0091       virtual void doAcquire_(StreamID, EventForOutput const&, WaitingTaskWithArenaHolder&) {}
0092 
0093       virtual bool hasAcquire() const { return false; }
0094     };
0095   }  // namespace global
0096 }  // namespace edm
0097 #endif