test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ProducingModuleAdaptor.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_stream_ProducingModuleAdaptor_h
2 #define FWCore_Framework_stream_ProducingModuleAdaptor_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : ProducingModuleAdaptor
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Fri, 02 Aug 2013 18:09:18 GMT
19 //
20 
21 // system include files
22 
23 // user include files
31 // forward declarations
32 
33 namespace edm {
34  namespace stream {
35 
36  template<typename T, typename M, typename B>
37  class ProducingModuleAdaptor : public B
38  {
39 
40  public:
42  m_pset(&iPSet)
43  {
44  m_runs.resize(1);
45  m_lumis.resize(1);
46  m_runSummaries.resize(1);
47  m_lumiSummaries.resize(1);
48  typename T::GlobalCache const* dummy=nullptr;
49  m_global.reset( impl::makeGlobal<T>(iPSet,dummy).release());
50  }
52  }
53 
54  static void fillDescriptions(ConfigurationDescriptions& descriptions) {
55  T::fillDescriptions(descriptions);
56  }
57  static void prevalidate(ConfigurationDescriptions& descriptions) {
58  T::prevalidate(descriptions);
59  }
60 
61 
62  private:
72 
73  void setupStreamModules() override final {
74  this->createStreamModules([this] () -> M* {
75  auto tmp = impl::makeStreamModule<T>(*m_pset,m_global.get());
76  MyGlobal::set(tmp,m_global.get());
77  return tmp;
78  });
79  m_pset= nullptr;
80  }
81 
82  void doEndJob() override final {
84  }
85  void setupRun(M* iProd, RunIndex iIndex) override final {
86  MyGlobalRun::set(iProd, m_runs[iIndex].get());
87  }
88  void streamEndRunSummary(M* iProd,
89  edm::Run const& iRun,
90  edm::EventSetup const& iES) override final {
91  auto s = m_runSummaries[iRun.index()].get();
93  }
94 
95  void setupLuminosityBlock(M* iProd, LuminosityBlockIndex iIndex) override final
96  {
97  MyGlobalLuminosityBlock::set(iProd, m_lumis[iIndex].get());
98  }
100  edm::LuminosityBlock const& iLumi,
101  edm::EventSetup const& iES) override final {
102  auto s = m_lumiSummaries[iLumi.index()].get();
104  }
105 
107  EventSetup const& c,
108  ModuleCallingContext const* mcc) override final {
110  Run r(rp, this->moduleDescription(), mcc);
111  r.setConsumer(this->consumer());
112  Run const& cnstR = r;
113  RunIndex ri = rp.index();
114  MyGlobalRun::beginRun(cnstR,c,m_global.get(),m_runs[ri]);
115  typename T::RunContext rc(m_runs[ri].get(),m_global.get());
117  if(T::HasAbility::kBeginRunProducer) {
119  this->commit(r);
120  }
121  }
122  }
124  EventSetup const& c,
125  ModuleCallingContext const* mcc) override final
126  {
128 
129  Run r(rp, this->moduleDescription(), mcc);
130  r.setConsumer(this->consumer());
131 
132  RunIndex ri = rp.index();
133  typename T::RunContext rc(m_runs[ri].get(),m_global.get());
134  if(T::HasAbility::kEndRunProducer) {
135  MyEndRunProduce::produce(r,c,&rc,m_runSummaries[ri].get());
136  this->commit(r);
137  }
139  MyGlobalRun::endRun(r,c,&rc);
140  }
141  }
142 
144  ModuleCallingContext const* mcc) override final
145  {
146  if(T::HasAbility::kLuminosityBlockCache or T::HasAbility::kLuminosityBlockSummaryCache or T::HasAbility::kBeginLuminosityBlockProducer) {
147  LuminosityBlock lb(lbp, this->moduleDescription(), mcc);
148  lb.setConsumer(this->consumer());
149  LuminosityBlock const& cnstLb = lb;
150  LuminosityBlockIndex li = lbp.index();
151  RunIndex ri = lbp.runPrincipal().index();
152  typename T::RunContext rc(m_runs[ri].get(),m_global.get());
154  typename T::LuminosityBlockContext lc(m_lumis[li].get(),m_runs[ri].get(),m_global.get());
156  if(T::HasAbility::kBeginLuminosityBlockProducer) {
158  this->commit(lb);
159  }
160  }
161 
162  }
164  EventSetup const& c,
165  ModuleCallingContext const* mcc) override final {
166  if(T::HasAbility::kLuminosityBlockCache or T::HasAbility::kLuminosityBlockSummaryCache or T::HasAbility::kEndLuminosityBlockProducer) {
167 
168  LuminosityBlock lb(lbp, this->moduleDescription(), mcc);
169  lb.setConsumer(this->consumer());
170 
171  LuminosityBlockIndex li = lbp.index();
172  RunIndex ri = lbp.runPrincipal().index();
173  typename T::LuminosityBlockContext lc(m_lumis[li].get(),m_runs[ri].get(),m_global.get());
174  if(T::HasAbility::kEndLuminosityBlockProducer) {
176  this->commit(lb);
177  }
180  }
181  }
182 
183  ProducingModuleAdaptor(const ProducingModuleAdaptor&) = delete; // stop default
184 
185  const ProducingModuleAdaptor& operator=(const ProducingModuleAdaptor&) = delete; // stop default
186 
187  // ---------- member data --------------------------------
194  };
195  }
196 }
197 
198 #endif
static void endLuminosityBlock(edm::LuminosityBlock const &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iContext)
static void beginRun(edm::Run const &iRun, edm::EventSetup const &iES, typename T::RunContext const *iRC, std::shared_ptr< typename T::RunSummaryCache > &oCache)
void setConsumer(EDConsumerBase const *iConsumer)
void doBeginRun(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc) overridefinal
static void endRun(edm::Run const &iRun, edm::EventSetup const &iES, typename T::RunContext const *iContext)
Definition: callAbilities.h:71
impl::choose_unique_ptr< typename T::GlobalCache >::type m_global
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
void doEndRun(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc) overridefinal
static void produce(edm::LuminosityBlock &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iRC)
static void produce(edm::LuminosityBlock &, edm::EventSetup const &, typename T::LuminosityBlockContext const *, typename T::LuminosityBlockSummaryCache const *)
void setupLuminosityBlock(M *iProd, LuminosityBlockIndex iIndex) overridefinal
static void prevalidate(ConfigurationDescriptions &descriptions)
static void streamEndRunSummary(B *iProd, edm::Run const &iRun, edm::EventSetup const &iES, typename T::RunSummaryCache *iCache)
const ProducingModuleAdaptor & operator=(const ProducingModuleAdaptor &)=delete
void streamEndLuminosityBlockSummary(M *iProd, edm::LuminosityBlock const &iLumi, edm::EventSetup const &iES) overridefinal
void doEndLuminosityBlock(LuminosityBlockPrincipal &lbp, EventSetup const &c, ModuleCallingContext const *mcc) overridefinal
static void beginRun(edm::Run const &iRun, edm::EventSetup const &iES, typename T::GlobalCache const *iGC, std::shared_ptr< typename T::RunCache const > &oCache)
Definition: callAbilities.h:59
void streamEndRunSummary(M *iProd, edm::Run const &iRun, edm::EventSetup const &iES) overridefinal
static void set(B *iProd, typename T::RunCache const *iCache)
Definition: callAbilities.h:67
static void beginLuminosityBlock(edm::LuminosityBlock const &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iRC, std::shared_ptr< typename T::LuminosityBlockSummaryCache > &oCache)
static void produce(edm::Run &iRun, edm::EventSetup const &iES, typename T::RunContext const *iRC)
impl::choose_shared_vec< typename T::RunSummaryCache >::type m_runSummaries
impl::choose_shared_vec< typename T::LuminosityBlockSummaryCache >::type m_lumiSummaries
static void set(B *iProd, typename T::LuminosityBlockCache const *iCache)
void setupRun(M *iProd, RunIndex iIndex) overridefinal
CallGlobalLuminosityBlockSummary< T > MyGlobalLuminosityBlockSummary
static void endJob(typename T::GlobalCache *iCache)
Definition: callAbilities.h:41
static void streamEndLuminosityBlockSummary(B *iProd, edm::LuminosityBlock const &iLumi, edm::EventSetup const &iES, typename T::LuminosityBlockSummaryCache *iCache)
CallEndLuminosityBlockProduce< T > MyEndLuminosityBlockProduce
static void globalEndRun(edm::Run const &iRun, edm::EventSetup const &iES, typename T::RunContext const *iContext, typename T::RunSummaryCache *iCache)
CallGlobalLuminosityBlock< T > MyGlobalLuminosityBlock
impl::choose_shared_vec< typename T::RunCache const >::type m_runs
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
ProducingModuleAdaptor(edm::ParameterSet const &iPSet)
CallBeginRunProduce< T > MyBeginRunProduce
CallGlobalRunSummary< T > MyGlobalRunSummary
void doBeginLuminosityBlock(LuminosityBlockPrincipal &lbp, EventSetup const &c, ModuleCallingContext const *mcc) overridefinal
static void fillDescriptions(ConfigurationDescriptions &descriptions)
static void produce(edm::Run &, edm::EventSetup const &, typename T::RunContext const *, typename T::RunSummaryCache const *)
impl::choose_shared_vec< typename T::LuminosityBlockCache const >::type m_lumis
std::vector< std::shared_ptr< T > > type
Definition: dummy_helpers.h:56
CallBeginLuminosityBlockProduce< T > MyBeginLuminosityBlockProduce
static void globalEndLuminosityBlock(edm::LuminosityBlock const &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iContext, typename T::LuminosityBlockSummaryCache *iCache)
static void beginLuminosityBlock(edm::LuminosityBlock const &Lumi, edm::EventSetup const &iES, typename T::RunContext const *iRC, std::shared_ptr< typename T::LuminosityBlockCache const > &oCache)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Run.h:50
static void set(B *iProd, typename T::GlobalCache const *iCache)
Definition: callAbilities.h:37
Definition: Run.h:43