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

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

Member Function Documentation

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

Implements edm::OutputModuleCommunicator.

Definition at line 51 of file OutputModuleCommunicatorT.cc.

Referenced by Vispa.Main.Application.Application::tabCloseRequest().

51  {
52  module().doCloseFile();
53  }
template<typename T >
void edm::OutputModuleCommunicatorT< T >::configure ( edm::OutputModuleDescription const &  desc)
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 149 of file OutputModuleCommunicatorT.cc.

149  {
150  module().configure(desc);
151  }
template<typename T >
static std::unique_ptr<edm::OutputModuleCommunicator> edm::OutputModuleCommunicatorT< T >::createIfNeeded ( T iMod)
inlinestatic

Definition at line 73 of file OutputModuleCommunicatorT.h.

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

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

Implements edm::OutputModuleCommunicator.

Definition at line 172 of file OutputModuleCommunicatorT.cc.

172  {
173  return module().description();
174  }
template<typename T >
edm::SelectedProductsForBranchType const & edm::OutputModuleCommunicatorT< T >::keptProducts ( ) const
overridevirtual

Implements edm::OutputModuleCommunicator.

Definition at line 154 of file OutputModuleCommunicatorT.cc.

154  {
155  return module().keptProducts();
156  }
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 144 of file OutputModuleCommunicatorT.cc.

144  {
145  return module().limitReached();
146  }
template<typename T >
T& edm::OutputModuleCommunicatorT< T >::module ( ) const
inlineprivate

Definition at line 78 of file OutputModuleCommunicatorT.h.

References sistrip::module_.

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

Implements edm::OutputModuleCommunicator.

Definition at line 159 of file OutputModuleCommunicatorT.cc.

160  {
161  module().selectProducts(preg, helper);
162  }
Definition: helper.py:1
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 165 of file OutputModuleCommunicatorT.cc.

167  {
168  module().setEventSelectionInfo(outputModulePathPositions, anyProductProduced);
169  }
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  }
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 139 of file OutputModuleCommunicatorT.cc.

139  {
140  return module().wantAllEvents();
141  }
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 106 of file OutputModuleCommunicatorT.cc.

References edm::LuminosityBlockPrincipal::beginTime(), heppy_report::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(), and protons_cff::t.

109  {
110  auto token = ServiceRegistry::instance().presentToken();
111  GlobalContext globalContext(GlobalContext::Transition::kWriteLuminosityBlock,
112  lbp.id(),
113  lbp.runPrincipal().index(),
114  lbp.index(),
115  lbp.beginTime(),
116  processContext);
117  auto t = [& mod = module(), &lbp, activityRegistry, token, globalContext, desc = &description(), iTask]() mutable {
118  std::exception_ptr ex;
119  try {
120  ServiceRegistry::Operate op(token);
121 
122  ParentContext parentContext(&globalContext);
123  ModuleCallingContext mcc(desc);
124  ModuleContextSentry moduleContextSentry(&mcc, parentContext);
125  activityRegistry->preModuleWriteLumiSignal_(globalContext, mcc);
126  auto sentry(make_sentry(activityRegistry, [&globalContext, &mcc](ActivityRegistry* activityRegistry) {
127  activityRegistry->postModuleWriteLumiSignal_(globalContext, mcc);
128  }));
129  mod.doWriteLuminosityBlock(lbp, &mcc);
130  } catch (...) {
131  ex = std::current_exception();
132  }
133  iTask.doneWaiting(ex);
134  };
135  async(module(), std::move(t));
136  }
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
ServiceToken presentToken() const
ModuleDescription const & description() const override
static ServiceRegistry & instance()
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
def move(src, dest)
Definition: eostools.py:511
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 66 of file OutputModuleCommunicatorT.cc.

References heppy_report::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(), and protons_cff::t.

70  {
71  auto token = ServiceRegistry::instance().presentToken();
72  GlobalContext globalContext(GlobalContext::Transition::kWriteRun,
73  LuminosityBlockID(rp.run(), 0),
74  rp.index(),
76  rp.endTime(),
77  processContext);
78  auto t = [& mod = module(),
79  &rp,
80  globalContext,
81  token,
82  desc = &description(),
83  activityRegistry,
84  mergeableRunProductMetadata,
85  iTask]() mutable {
86  std::exception_ptr ex;
87  try {
88  ServiceRegistry::Operate op(token);
89  ParentContext parentContext(&globalContext);
90  ModuleCallingContext mcc(desc);
91  ModuleContextSentry moduleContextSentry(&mcc, parentContext);
92  activityRegistry->preModuleWriteRunSignal_(globalContext, mcc);
93  auto sentry(make_sentry(activityRegistry, [&globalContext, &mcc](ActivityRegistry* activityRegistry) {
94  activityRegistry->postModuleWriteRunSignal_(globalContext, mcc);
95  }));
96  mod.doWriteRun(rp, &mcc, mergeableRunProductMetadata);
97  } catch (...) {
98  ex = std::current_exception();
99  }
100  iTask.doneWaiting(ex);
101  };
102  async(module(), std::move(t));
103  }
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
ServiceToken presentToken() const
ModuleDescription const & description() const override
static ServiceRegistry & instance()
static LuminosityBlockIndex invalidLuminosityBlockIndex()
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

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

Definition at line 79 of file OutputModuleCommunicatorT.h.