CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::OutputModuleCommunicatorT< T > Class Template Reference

#include <OutputModuleBase.h>

Inheritance diagram for edm::OutputModuleCommunicatorT< T >:
edm::OutputModuleCommunicator

Public Member Functions

void closeFile () override
 
void configure (edm::OutputModuleDescription const &desc) override
 
ModuleDescription const & description () const override
 
edm::SelectedProductsForBranchType const & keptProducts () const override
 
bool limitReached () const override
 
void openFile (edm::FileBlock const &fb) override
 
 OutputModuleCommunicatorT (T *iModule)
 
void selectProducts (edm::ProductRegistry const &preg, ThinnedAssociationsHelper const &) override
 
void setEventSelectionInfo (std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced) override
 
bool shouldWeCloseFile () const override
 
bool wantAllEvents () const override
 
void writeLumiAsync (WaitingTaskHolder iTask, edm::LuminosityBlockPrincipal const &lbp, ProcessContext const *, ActivityRegistry *) override
 
void writeRunAsync (WaitingTaskHolder iTask, edm::RunPrincipal const &rp, ProcessContext const *, ActivityRegistry *, MergeableRunProductMetadata const *) override
 
- Public Member Functions inherited from edm::OutputModuleCommunicator
 OutputModuleCommunicator ()=default
 
virtual ~OutputModuleCommunicator ()
 

Static Public Member Functions

static std::unique_ptr< edm::OutputModuleCommunicatorcreateIfNeeded (T *iMod)
 

Private Member Functions

Tmodule () const
 

Private Attributes

Tmodule_
 

Detailed Description

template<typename T>
class edm::OutputModuleCommunicatorT< T >

Definition at line 56 of file OutputModuleBase.h.

Constructor & Destructor Documentation

◆ OutputModuleCommunicatorT()

template<typename T >
edm::OutputModuleCommunicatorT< T >::OutputModuleCommunicatorT ( T iModule)
inline

Definition at line 34 of file OutputModuleCommunicatorT.h.

34 : module_(iModule) {}

Member Function Documentation

◆ closeFile()

template<typename T >
void edm::OutputModuleCommunicatorT< T >::closeFile ( )
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 47 of file OutputModuleCommunicatorT.cc.

47  {
48  module().doCloseFile();
49  }

◆ configure()

template<typename T >
void edm::OutputModuleCommunicatorT< T >::configure ( edm::OutputModuleDescription const &  desc)
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 147 of file OutputModuleCommunicatorT.cc.

147  {
148  module().configure(desc);
149  }

◆ createIfNeeded()

template<typename T >
static std::unique_ptr<edm::OutputModuleCommunicator> edm::OutputModuleCommunicatorT< T >::createIfNeeded ( T iMod)
inlinestatic

Definition at line 71 of file OutputModuleCommunicatorT.h.

71  {
73  }

References edm::impl::createCommunicatorIfNeeded(), and eostools::move().

◆ description()

template<typename T >
ModuleDescription const & edm::OutputModuleCommunicatorT< T >::description ( ) const
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 170 of file OutputModuleCommunicatorT.cc.

170  {
171  return module().description();
172  }

◆ keptProducts()

template<typename T >
edm::SelectedProductsForBranchType const & edm::OutputModuleCommunicatorT< T >::keptProducts ( ) const
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 152 of file OutputModuleCommunicatorT.cc.

152  {
153  return module().keptProducts();
154  }

◆ limitReached()

template<typename T >
bool edm::OutputModuleCommunicatorT< T >::limitReached ( ) const
overridevirtual
Returns
true if OutputModule has reached its limit on maximum number of events it wants to see

Implements edm::OutputModuleCommunicator.

Definition at line 142 of file OutputModuleCommunicatorT.cc.

142  {
143  return module().limitReached();
144  }

◆ module()

template<typename T >
T& edm::OutputModuleCommunicatorT< T >::module ( ) const
inlineprivate

Definition at line 76 of file OutputModuleCommunicatorT.h.

76 { return *module_; }

References edm::OutputModuleCommunicatorT< T >::module_.

◆ openFile()

template<typename T >
void edm::OutputModuleCommunicatorT< T >::openFile ( edm::FileBlock const &  fb)
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 57 of file OutputModuleCommunicatorT.cc.

57  {
58  module().doOpenFile(fb);
59  }

References benchmark_cfg::fb.

◆ selectProducts()

template<typename T >
void edm::OutputModuleCommunicatorT< T >::selectProducts ( edm::ProductRegistry const &  preg,
ThinnedAssociationsHelper const &  helper 
)
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 157 of file OutputModuleCommunicatorT.cc.

158  {
159  module().selectProducts(preg, helper);
160  }

◆ setEventSelectionInfo()

template<typename T >
void edm::OutputModuleCommunicatorT< T >::setEventSelectionInfo ( std::map< std::string, std::vector< std::pair< std::string, int > > > const &  outputModulePathPositions,
bool  anyProductProduced 
)
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 163 of file OutputModuleCommunicatorT.cc.

165  {
166  module().setEventSelectionInfo(outputModulePathPositions, anyProductProduced);
167  }

◆ shouldWeCloseFile()

template<typename T >
bool edm::OutputModuleCommunicatorT< T >::shouldWeCloseFile ( ) const
overridevirtual
Returns
true if output module wishes to close its file

Implements edm::OutputModuleCommunicator.

Definition at line 52 of file OutputModuleCommunicatorT.cc.

52  {
53  return module().shouldWeCloseFile();
54  }

◆ wantAllEvents()

template<typename T >
bool edm::OutputModuleCommunicatorT< T >::wantAllEvents ( ) const
overridevirtual
Returns
true if no event filtering is applied to OutputModule

Implements edm::OutputModuleCommunicator.

Definition at line 137 of file OutputModuleCommunicatorT.cc.

137  {
138  return module().wantAllEvents();
139  }

◆ writeLumiAsync()

template<typename T >
void edm::OutputModuleCommunicatorT< T >::writeLumiAsync ( WaitingTaskHolder  iTask,
edm::LuminosityBlockPrincipal const &  lbp,
ProcessContext const *  processContext,
ActivityRegistry activityRegistry 
)
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 103 of file OutputModuleCommunicatorT.cc.

106  {
108  GlobalContext globalContext(GlobalContext::Transition::kWriteLuminosityBlock,
109  lbp.id(),
110  lbp.runPrincipal().index(),
111  lbp.index(),
112  lbp.beginTime(),
113  processContext);
114  auto t = [& mod = module(), &lbp, activityRegistry, token, globalContext, desc = &description(), iTask]() mutable {
115  std::exception_ptr ex;
116  // Caught exception is propagated via WaitingTaskHolder
117  CMS_SA_ALLOW try {
119 
120  ParentContext parentContext(&globalContext);
121  ModuleCallingContext mcc(desc);
122  ModuleContextSentry moduleContextSentry(&mcc, parentContext);
123  activityRegistry->preModuleWriteLumiSignal_(globalContext, mcc);
124  auto sentry(make_sentry(activityRegistry, [&globalContext, &mcc](ActivityRegistry* ar) {
125  ar->postModuleWriteLumiSignal_(globalContext, mcc);
126  }));
127  mod.doWriteLuminosityBlock(lbp, &mcc);
128  } catch (...) {
129  ex = std::current_exception();
130  }
131  iTask.doneWaiting(ex);
132  };
133  async(module(), std::move(t));
134  }

References edm::LuminosityBlockPrincipal::beginTime(), CMS_SA_ALLOW, edmLumisInFiles::description, edm::WaitingTaskHolder::doneWaiting(), edm::LuminosityBlockPrincipal::id(), edm::LuminosityBlockPrincipal::index(), edm::RunPrincipal::index(), edm::ServiceRegistry::instance(), edm::GlobalContext::kWriteLuminosityBlock, edm::make_sentry(), mod(), eostools::move(), edm::ActivityRegistry::postModuleWriteLumiSignal_, edm::ServiceRegistry::presentToken(), edm::LuminosityBlockPrincipal::runPrincipal(), OrderedSet::t, and unpackBuffers-CaloStage2::token.

◆ writeRunAsync()

template<typename T >
void edm::OutputModuleCommunicatorT< T >::writeRunAsync ( WaitingTaskHolder  iTask,
edm::RunPrincipal const &  rp,
ProcessContext const *  processContext,
ActivityRegistry activityRegistry,
MergeableRunProductMetadata const *  mergeableRunProductMetadata 
)
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 62 of file OutputModuleCommunicatorT.cc.

66  {
68  GlobalContext globalContext(GlobalContext::Transition::kWriteRun,
69  LuminosityBlockID(rp.run(), 0),
70  rp.index(),
72  rp.endTime(),
73  processContext);
74  auto t = [& mod = module(),
75  &rp,
76  globalContext,
77  token,
78  desc = &description(),
79  activityRegistry,
80  mergeableRunProductMetadata,
81  iTask]() mutable {
82  std::exception_ptr ex;
83  // Caught exception is propagated via WaitingTaskHolder
84  CMS_SA_ALLOW try {
86  ParentContext parentContext(&globalContext);
87  ModuleCallingContext mcc(desc);
88  ModuleContextSentry moduleContextSentry(&mcc, parentContext);
89  activityRegistry->preModuleWriteRunSignal_(globalContext, mcc);
90  auto sentry(make_sentry(activityRegistry, [&globalContext, &mcc](ActivityRegistry* ar) {
91  ar->postModuleWriteRunSignal_(globalContext, mcc);
92  }));
93  mod.doWriteRun(rp, &mcc, mergeableRunProductMetadata);
94  } catch (...) {
95  ex = std::current_exception();
96  }
97  iTask.doneWaiting(ex);
98  };
99  async(module(), std::move(t));
100  }

References CMS_SA_ALLOW, edmLumisInFiles::description, edm::WaitingTaskHolder::doneWaiting(), edm::RunPrincipal::endTime(), edm::RunPrincipal::index(), edm::ServiceRegistry::instance(), edm::LuminosityBlockIndex::invalidLuminosityBlockIndex(), edm::GlobalContext::kWriteRun, edm::make_sentry(), mod(), eostools::move(), edm::ActivityRegistry::postModuleWriteRunSignal_, edm::ActivityRegistry::preModuleWriteRunSignal_, edm::ServiceRegistry::presentToken(), edm::RunPrincipal::run(), OrderedSet::t, and unpackBuffers-CaloStage2::token.

Member Data Documentation

◆ module_

template<typename T >
T* edm::OutputModuleCommunicatorT< T >::module_
private
ActivityRegistry
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
CMS_SA_ALLOW
#define CMS_SA_ALLOW
Definition: thread_safety_macros.h:5
edm::OutputModuleCommunicatorT::description
ModuleDescription const & description() const override
Definition: OutputModuleCommunicatorT.cc:170
edm::OutputModuleCommunicatorT::module_
T * module_
Definition: OutputModuleCommunicatorT.h:77
OrderedSet.t
t
Definition: OrderedSet.py:90
edm::GlobalContext::Transition::kWriteLuminosityBlock
edm::ServiceRegistry::Operate
friend class Operate
Definition: ServiceRegistry.h:54
edm::impl::createCommunicatorIfNeeded
std::unique_ptr< edm::OutputModuleCommunicator > createCommunicatorIfNeeded(void *)
Definition: OutputModuleCommunicatorT.cc:175
edm::LuminosityBlockIndex::invalidLuminosityBlockIndex
static LuminosityBlockIndex invalidLuminosityBlockIndex()
Definition: LuminosityBlockIndex.cc:9
edm::ServiceRegistry::presentToken
ServiceToken presentToken() const
Definition: ServiceRegistry.cc:63
helper
Definition: helper.py:1
edm::GlobalContext::Transition::kWriteRun
edm::ServiceRegistry::instance
static ServiceRegistry & instance()
Definition: ServiceRegistry.cc:90
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::OutputModuleCommunicatorT::module
T & module() const
Definition: OutputModuleCommunicatorT.h:76
edm::make_sentry
std::unique_ptr< T, F > make_sentry(T *iObject, F iFunc)
NOTE: if iObject is null, then iFunc will not be called.
Definition: make_sentry.h:30
benchmark_cfg.fb
fb
Definition: benchmark_cfg.py:14
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316