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 <OutputModuleCommunicatorT.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 &, ProcessBlockHelperBase 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 *) noexcept override
 
void writeProcessBlockAsync (WaitingTaskHolder iTask, ProcessBlockPrincipal const &, ProcessContext const *, ActivityRegistry *) noexcept override
 
void writeRunAsync (WaitingTaskHolder iTask, edm::RunPrincipal const &rp, ProcessContext const *, ActivityRegistry *, MergeableRunProductMetadata const *) noexcept override
 
- Public Member Functions inherited from edm::OutputModuleCommunicator
OutputModuleCommunicatoroperator= (const OutputModuleCommunicator &)=delete
 
 OutputModuleCommunicator ()=default
 
 OutputModuleCommunicator (const OutputModuleCommunicator &)=delete
 
virtual ~OutputModuleCommunicator ()
 

Static Public Member Functions

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

Private Member Functions

Tmodule () const noexcept
 

Private Attributes

Tmodule_
 

Detailed Description

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

Definition at line 33 of file OutputModuleCommunicatorT.h.

Constructor & Destructor Documentation

◆ OutputModuleCommunicatorT()

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

Definition at line 35 of file OutputModuleCommunicatorT.h.

Member Function Documentation

◆ closeFile()

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

Implements edm::OutputModuleCommunicator.

Definition at line 51 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

51  {
52  module().doCloseFile();
53  }

◆ configure()

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

Implements edm::OutputModuleCommunicator.

Definition at line 191 of file OutputModuleCommunicatorT.cc.

References submitPVResolutionJobs::desc, and callgraph::module.

191  {
192  module().configure(desc);
193  }

◆ createIfNeeded()

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

Definition at line 79 of file OutputModuleCommunicatorT.h.

References edm::impl::createCommunicatorIfNeeded().

Referenced by edm::maker::ModuleHolderT< T >::createOutputModuleCommunicator().

79  {
81  }
std::unique_ptr< edm::OutputModuleCommunicator > createCommunicatorIfNeeded(void *)

◆ description()

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

Implements edm::OutputModuleCommunicator.

Definition at line 215 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

215  {
216  return module().description();
217  }

◆ keptProducts()

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

Implements edm::OutputModuleCommunicator.

Definition at line 196 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

196  {
197  return module().keptProducts();
198  }

◆ 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 186 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

186  {
187  return module().limitReached();
188  }

◆ module()

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

◆ openFile()

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

Implements edm::OutputModuleCommunicator.

Definition at line 61 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

61  {
62  module().doOpenFile(fb);
63  }

◆ selectProducts()

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

Implements edm::OutputModuleCommunicator.

Definition at line 201 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

203  {
204  module().selectProducts(preg, helper, processBlockHelper);
205  }
Definition: helper.py:1

◆ 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 208 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

210  {
211  module().setEventSelectionInfo(outputModulePathPositions, anyProductProduced);
212  }

◆ 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 56 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

56  {
57  return module().shouldWeCloseFile();
58  }

◆ 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 181 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

181  {
182  return module().wantAllEvents();
183  }

◆ writeLumiAsync()

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

Implements edm::OutputModuleCommunicator.

Definition at line 147 of file OutputModuleCommunicatorT.cc.

References CMS_SA_ALLOW, submitPVResolutionJobs::desc, makeListRunsInFiles::description, edm::ServiceRegistry::instance(), edm::GlobalContext::kWriteLuminosityBlock, edm::make_sentry(), mod(), callgraph::module, eostools::move(), findAndChange::op, edm::ActivityRegistry::postModuleWriteLumiSignal_, edm::ServiceRegistry::presentToken(), submitPVValidationJobs::t, and unpackBuffers-CaloStage2::token.

150  {
152  GlobalContext globalContext(GlobalContext::Transition::kWriteLuminosityBlock,
153  lbp.id(),
154  lbp.runPrincipal().index(),
155  lbp.index(),
156  lbp.beginTime(),
157  processContext);
158  auto t = [&mod = module(), &lbp, activityRegistry, token, globalContext, desc = &description(), iTask]() mutable {
159  std::exception_ptr ex;
160  // Caught exception is propagated via WaitingTaskHolder
161  CMS_SA_ALLOW try {
163 
164  ParentContext parentContext(&globalContext);
165  ModuleCallingContext mcc(desc);
166  ModuleContextSentry moduleContextSentry(&mcc, parentContext);
167  activityRegistry->preModuleWriteLumiSignal_(globalContext, mcc);
168  auto sentry(make_sentry(activityRegistry, [&globalContext, &mcc](ActivityRegistry* ar) {
169  ar->postModuleWriteLumiSignal_(globalContext, mcc);
170  }));
171  mod.doWriteLuminosityBlock(lbp, &mcc);
172  } catch (...) {
173  ex = std::current_exception();
174  }
175  iTask.doneWaiting(ex);
176  };
177  async(module(), *iTask.group(), std::move(t));
178  }
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
#define CMS_SA_ALLOW
ModuleDescription const & description() const override
static ServiceRegistry & instance()
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
ServiceToken presentToken() const
def move(src, dest)
Definition: eostools.py:511

◆ writeProcessBlockAsync()

template<typename T >
void edm::OutputModuleCommunicatorT< T >::writeProcessBlockAsync ( WaitingTaskHolder  iTask,
ProcessBlockPrincipal const &  processBlockPrincipal,
ProcessContext const *  processContext,
ActivityRegistry activityRegistry 
)
overridevirtualnoexcept

Implements edm::OutputModuleCommunicator.

Definition at line 66 of file OutputModuleCommunicatorT.cc.

References CMS_SA_ALLOW, submitPVResolutionJobs::desc, makeListRunsInFiles::description, edm::ServiceRegistry::instance(), edm::LuminosityBlockIndex::invalidLuminosityBlockIndex(), edm::RunIndex::invalidRunIndex(), edm::Timestamp::invalidTimestamp(), edm::GlobalContext::kWriteProcessBlock, edm::make_sentry(), mod(), callgraph::module, eostools::move(), findAndChange::op, edm::ActivityRegistry::postModuleWriteProcessBlockSignal_, edm::ServiceRegistry::presentToken(), submitPVValidationJobs::t, and unpackBuffers-CaloStage2::token.

69  {
71  GlobalContext globalContext(GlobalContext::Transition::kWriteProcessBlock,
72  LuminosityBlockID(),
76  processContext);
77  auto t = [&mod = module(),
78  &processBlockPrincipal,
79  globalContext,
80  token,
81  desc = &description(),
82  activityRegistry,
83  iTask]() mutable {
84  std::exception_ptr ex;
85  // Caught exception is propagated via WaitingTaskHolder
86  CMS_SA_ALLOW try {
88  ParentContext parentContext(&globalContext);
89  ModuleCallingContext mcc(desc);
90  ModuleContextSentry moduleContextSentry(&mcc, parentContext);
91  activityRegistry->preModuleWriteProcessBlockSignal_(globalContext, mcc);
92  auto sentry(make_sentry(activityRegistry, [&globalContext, &mcc](ActivityRegistry* ar) {
93  ar->postModuleWriteProcessBlockSignal_(globalContext, mcc);
94  }));
95  mod.doWriteProcessBlock(processBlockPrincipal, &mcc);
96  } catch (...) {
97  ex = std::current_exception();
98  }
99  iTask.doneWaiting(ex);
100  };
101  async(module(), *iTask.group(), std::move(t));
102  }
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
#define CMS_SA_ALLOW
static Timestamp invalidTimestamp()
Definition: Timestamp.h:75
ModuleDescription const & description() const override
static RunIndex invalidRunIndex()
Definition: RunIndex.cc:9
static ServiceRegistry & instance()
static LuminosityBlockIndex invalidLuminosityBlockIndex()
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
ServiceToken presentToken() const
def move(src, dest)
Definition: eostools.py:511

◆ writeRunAsync()

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

Implements edm::OutputModuleCommunicator.

Definition at line 105 of file OutputModuleCommunicatorT.cc.

References CMS_SA_ALLOW, submitPVResolutionJobs::desc, makeListRunsInFiles::description, edm::ServiceRegistry::instance(), edm::LuminosityBlockIndex::invalidLuminosityBlockIndex(), edm::GlobalContext::kWriteRun, edm::make_sentry(), mod(), callgraph::module, eostools::move(), findAndChange::op, edm::ActivityRegistry::postModuleWriteRunSignal_, edm::ServiceRegistry::presentToken(), submitPVValidationJobs::t, and unpackBuffers-CaloStage2::token.

110  {
112  GlobalContext globalContext(GlobalContext::Transition::kWriteRun,
113  LuminosityBlockID(rp.run(), 0),
114  rp.index(),
116  rp.endTime(),
117  processContext);
118  auto t = [&mod = module(),
119  &rp,
120  globalContext,
121  token,
122  desc = &description(),
123  activityRegistry,
124  mergeableRunProductMetadata,
125  iTask]() mutable {
126  std::exception_ptr ex;
127  // Caught exception is propagated via WaitingTaskHolder
128  CMS_SA_ALLOW try {
130  ParentContext parentContext(&globalContext);
131  ModuleCallingContext mcc(desc);
132  ModuleContextSentry moduleContextSentry(&mcc, parentContext);
133  activityRegistry->preModuleWriteRunSignal_(globalContext, mcc);
134  auto sentry(make_sentry(activityRegistry, [&globalContext, &mcc](ActivityRegistry* ar) {
135  ar->postModuleWriteRunSignal_(globalContext, mcc);
136  }));
137  mod.doWriteRun(rp, &mcc, mergeableRunProductMetadata);
138  } catch (...) {
139  ex = std::current_exception();
140  }
141  iTask.doneWaiting(ex);
142  };
143  async(module(), *iTask.group(), std::move(t));
144  }
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
#define CMS_SA_ALLOW
ModuleDescription const & description() const override
static ServiceRegistry & instance()
static LuminosityBlockIndex invalidLuminosityBlockIndex()
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
ServiceToken presentToken() const
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ module_

template<typename T >
T* edm::OutputModuleCommunicatorT< T >::module_
private