CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 *) 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::OutputModuleCommunicator
createIfNeeded (T *iMod)
 

Private Member Functions

Tmodule () const
 

Private Attributes

Tmodule_
 

Detailed Description

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

Definition at line 33 of file OutputModuleCommunicatorT.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file OutputModuleCommunicatorT.h.

Member Function Documentation

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  }
template<typename T >
void edm::OutputModuleCommunicatorT< T >::configure ( edm::OutputModuleDescription const &  desc)
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 190 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

190  {
191  module().configure(desc);
192  }
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(), and eostools::move().

79  {
81  }
def move
Definition: eostools.py:511
std::unique_ptr< edm::OutputModuleCommunicator > createCommunicatorIfNeeded(void *)
template<typename T >
ModuleDescription const & edm::OutputModuleCommunicatorT< T >::description ( ) const
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 214 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

214  {
215  return module().description();
216  }
template<typename T >
edm::SelectedProductsForBranchType const & edm::OutputModuleCommunicatorT< T >::keptProducts ( ) const
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 195 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

195  {
196  return module().keptProducts();
197  }
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.

References callgraph::module.

185  {
186  return module().limitReached();
187  }
template<typename T >
T& edm::OutputModuleCommunicatorT< T >::module ( ) const
inlineprivate
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  }
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 200 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

202  {
203  module().selectProducts(preg, helper, processBlockHelper);
204  }
preg
Definition: Schedule.cc:687
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 207 of file OutputModuleCommunicatorT.cc.

References callgraph::module.

209  {
210  module().setEventSelectionInfo(outputModulePathPositions, anyProductProduced);
211  }
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  }
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.

References callgraph::module.

180  {
181  return module().wantAllEvents();
182  }
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.

References edm::LuminosityBlockPrincipal::beginTime(), CMS_SA_ALLOW, submitPVResolutionJobs::desc, getPayloadData::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(), callgraph::module, eostools::move(), edm::ActivityRegistry::postModuleWriteLumiSignal_, edm::ServiceRegistry::presentToken(), edm::LuminosityBlockPrincipal::runPrincipal(), submitPVValidationJobs::t, and unpackBuffers-CaloStage2::token.

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 {
161  ServiceRegistry::Operate op(token);
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  }
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
ServiceToken presentToken() const
def move
Definition: eostools.py:511
static ServiceRegistry & instance()
ModuleDescription const & description() const override
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
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.

References CMS_SA_ALLOW, submitPVResolutionJobs::desc, getPayloadData::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(), callgraph::module, eostools::move(), edm::ActivityRegistry::postModuleWriteProcessBlockSignal_, edm::ActivityRegistry::preModuleWriteProcessBlockSignal_, 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 {
87  ServiceRegistry::Operate op(token);
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:82
ServiceToken presentToken() const
static RunIndex invalidRunIndex()
Definition: RunIndex.cc:9
def move
Definition: eostools.py:511
static ServiceRegistry & instance()
static LuminosityBlockIndex invalidLuminosityBlockIndex()
ModuleDescription const & description() const override
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
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.

References CMS_SA_ALLOW, submitPVResolutionJobs::desc, getPayloadData::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(), callgraph::module, eostools::move(), edm::ActivityRegistry::postModuleWriteRunSignal_, edm::ActivityRegistry::preModuleWriteRunSignal_, edm::ServiceRegistry::presentToken(), edm::RunPrincipal::run(), submitPVValidationJobs::t, and unpackBuffers-CaloStage2::token.

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 {
128  ServiceRegistry::Operate op(token);
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  }
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
ServiceToken presentToken() const
def move
Definition: eostools.py:511
static ServiceRegistry & instance()
static LuminosityBlockIndex invalidLuminosityBlockIndex()
ModuleDescription const & description() const override
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4

Member Data Documentation

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