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

186  {
187  module().configure(desc);
188  }

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

209  {
210  return module().description();
211  }

◆ keptProducts()

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

Implements edm::OutputModuleCommunicator.

Definition at line 191 of file OutputModuleCommunicatorT.cc.

191  {
192  return module().keptProducts();
193  }

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

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

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

197  {
198  module().selectProducts(preg, helper);
199  }

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

204  {
205  module().setEventSelectionInfo(outputModulePathPositions, anyProductProduced);
206  }

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

176  {
177  return module().wantAllEvents();
178  }

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

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

References edm::LuminosityBlockPrincipal::beginTime(), CMS_SA_ALLOW, submitPVResolutionJobs::desc, 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(), 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 62 of file OutputModuleCommunicatorT.cc.

65  {
67  GlobalContext globalContext(GlobalContext::Transition::kWriteProcessBlock,
68  LuminosityBlockID(),
72  processContext);
73  auto t = [&mod = module(),
74  &processBlockPrincipal,
75  globalContext,
76  token,
77  desc = &description(),
78  activityRegistry,
79  iTask]() mutable {
80  std::exception_ptr ex;
81  // Caught exception is propagated via WaitingTaskHolder
82  CMS_SA_ALLOW try {
84  ParentContext parentContext(&globalContext);
85  ModuleCallingContext mcc(desc);
86  ModuleContextSentry moduleContextSentry(&mcc, parentContext);
87  activityRegistry->preModuleWriteProcessBlockSignal_(globalContext, mcc);
88  auto sentry(make_sentry(activityRegistry, [&globalContext, &mcc](ActivityRegistry* ar) {
89  ar->postModuleWriteProcessBlockSignal_(globalContext, mcc);
90  }));
91  mod.doWriteProcessBlock(processBlockPrincipal, &mcc);
92  } catch (...) {
93  ex = std::current_exception();
94  }
95  iTask.doneWaiting(ex);
96  };
97  async(module(), std::move(t));
98  }

References CMS_SA_ALLOW, submitPVResolutionJobs::desc, edmLumisInFiles::description, edm::WaitingTaskHolder::doneWaiting(), 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 101 of file OutputModuleCommunicatorT.cc.

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

References CMS_SA_ALLOW, submitPVResolutionJobs::desc, 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(), 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:209
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:214
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:318