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 writeProcessBlockAsync (WaitingTaskHolder iTask, ProcessBlockPrincipal const &, 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
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
 

Private Attributes

Tmodule_
 

Detailed Description

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

Definition at line 55 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 51 of file OutputModuleCommunicatorT.cc.

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

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

References submitPVResolutionJobs::desc.

◆ createIfNeeded()

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

Definition at line 76 of file OutputModuleCommunicatorT.h.

76  {
78  }

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

213  {
214  return module().description();
215  }

◆ keptProducts()

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

Implements edm::OutputModuleCommunicator.

Definition at line 195 of file OutputModuleCommunicatorT.cc.

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

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

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

◆ module()

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

Definition at line 81 of file OutputModuleCommunicatorT.h.

81 { 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 61 of file OutputModuleCommunicatorT.cc.

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

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

201  {
202  module().selectProducts(preg, helper);
203  }

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

208  {
209  module().setEventSelectionInfo(outputModulePathPositions, anyProductProduced);
210  }

◆ 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.

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

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

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

149  {
151  GlobalContext globalContext(GlobalContext::Transition::kWriteLuminosityBlock,
152  lbp.id(),
153  lbp.runPrincipal().index(),
154  lbp.index(),
155  lbp.beginTime(),
156  processContext);
157  auto t = [&mod = module(), &lbp, activityRegistry, token, globalContext, desc = &description(), iTask]() mutable {
158  std::exception_ptr ex;
159  // Caught exception is propagated via WaitingTaskHolder
160  CMS_SA_ALLOW try {
162 
163  ParentContext parentContext(&globalContext);
164  ModuleCallingContext mcc(desc);
165  ModuleContextSentry moduleContextSentry(&mcc, parentContext);
166  activityRegistry->preModuleWriteLumiSignal_(globalContext, mcc);
167  auto sentry(make_sentry(activityRegistry, [&globalContext, &mcc](ActivityRegistry* ar) {
168  ar->postModuleWriteLumiSignal_(globalContext, mcc);
169  }));
170  mod.doWriteLuminosityBlock(lbp, &mcc);
171  } catch (...) {
172  ex = std::current_exception();
173  }
174  iTask.doneWaiting(ex);
175  };
176  async(module(), *iTask.group(), std::move(t));
177  }

References edm::LuminosityBlockPrincipal::beginTime(), CMS_SA_ALLOW, submitPVResolutionJobs::desc, edmLumisInFiles::description, edm::WaitingTaskHolder::doneWaiting(), edm::WaitingTaskHolder::group(), 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(), submitPVValidationJobs::t, and unpackBuffers-CaloStage2::token.

◆ writeProcessBlockAsync()

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

Implements edm::OutputModuleCommunicator.

Definition at line 66 of file OutputModuleCommunicatorT.cc.

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  }

References CMS_SA_ALLOW, submitPVResolutionJobs::desc, edmLumisInFiles::description, edm::WaitingTaskHolder::doneWaiting(), edm::WaitingTaskHolder::group(), edm::ServiceRegistry::instance(), edm::LuminosityBlockIndex::invalidLuminosityBlockIndex(), edm::RunIndex::invalidRunIndex(), edm::Timestamp::invalidTimestamp(), edm::GlobalContext::kWriteProcessBlock, edm::make_sentry(), mod(), eostools::move(), edm::ActivityRegistry::postModuleWriteProcessBlockSignal_, edm::ActivityRegistry::preModuleWriteProcessBlockSignal_, edm::ServiceRegistry::presentToken(), submitPVValidationJobs::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 105 of file OutputModuleCommunicatorT.cc.

109  {
111  GlobalContext globalContext(GlobalContext::Transition::kWriteRun,
112  LuminosityBlockID(rp.run(), 0),
113  rp.index(),
115  rp.endTime(),
116  processContext);
117  auto t = [&mod = module(),
118  &rp,
119  globalContext,
120  token,
121  desc = &description(),
122  activityRegistry,
123  mergeableRunProductMetadata,
124  iTask]() mutable {
125  std::exception_ptr ex;
126  // Caught exception is propagated via WaitingTaskHolder
127  CMS_SA_ALLOW try {
129  ParentContext parentContext(&globalContext);
130  ModuleCallingContext mcc(desc);
131  ModuleContextSentry moduleContextSentry(&mcc, parentContext);
132  activityRegistry->preModuleWriteRunSignal_(globalContext, mcc);
133  auto sentry(make_sentry(activityRegistry, [&globalContext, &mcc](ActivityRegistry* ar) {
134  ar->postModuleWriteRunSignal_(globalContext, mcc);
135  }));
136  mod.doWriteRun(rp, &mcc, mergeableRunProductMetadata);
137  } catch (...) {
138  ex = std::current_exception();
139  }
140  iTask.doneWaiting(ex);
141  };
142  async(module(), *iTask.group(), std::move(t));
143  }

References CMS_SA_ALLOW, submitPVResolutionJobs::desc, edmLumisInFiles::description, edm::WaitingTaskHolder::doneWaiting(), edm::RunPrincipal::endTime(), edm::WaitingTaskHolder::group(), 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(), submitPVValidationJobs::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
edm::GlobalContext::Transition::kWriteProcessBlock
CMS_SA_ALLOW
#define CMS_SA_ALLOW
Definition: thread_safety_macros.h:5
edm::OutputModuleCommunicatorT::description
ModuleDescription const & description() const override
Definition: OutputModuleCommunicatorT.cc:213
edm::OutputModuleCommunicatorT::module_
T * module_
Definition: OutputModuleCommunicatorT.h:82
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:218
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
edm::RunIndex::invalidRunIndex
static RunIndex invalidRunIndex()
Definition: RunIndex.cc:9
edm::Timestamp::invalidTimestamp
static Timestamp invalidTimestamp()
Definition: Timestamp.h:82
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::OutputModuleCommunicatorT::module
T & module() const
Definition: OutputModuleCommunicatorT.h:81
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
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
benchmark_cfg.fb
fb
Definition: benchmark_cfg.py:14
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316