CMS 3D CMS Logo

EDAnalyzerAdaptor.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_stream_EDAnalyzerAdaptor_h
2 #define FWCore_Framework_stream_EDAnalyzerAdaptor_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : EDAnalyzerAdaptor
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
34 
35 // forward declarations
36 
37 namespace edm {
38  namespace stream {
39 
40  template <typename ABase, typename ModType>
41  struct BaseToAdaptor;
42 
43  template <typename T>
45  template <typename ModType>
48  };
49 
50  template <typename T>
52  public:
53  EDAnalyzerAdaptor(edm::ParameterSet const& iPSet) : m_pset(&iPSet) {
54  m_runs.resize(1);
55  m_lumis.resize(1);
56  m_runSummaries.resize(1);
57  m_lumiSummaries.resize(1);
58  typename T::GlobalCache const* dummy = nullptr;
59  m_global = impl::makeGlobal<T>(iPSet, dummy);
60  }
61  ~EDAnalyzerAdaptor() override {}
62 
63  static void fillDescriptions(ConfigurationDescriptions& descriptions) { T::fillDescriptions(descriptions); }
64  static void prevalidate(ConfigurationDescriptions& descriptions) { T::prevalidate(descriptions); }
65 
69  }
70 
71  private:
77 
78  void setupStreamModules() final {
79  this->createStreamModules([this]() -> EDAnalyzerBase* {
80  auto tmp = impl::makeStreamModule<T>(*m_pset, m_global.get());
81  MyGlobal::set(tmp, m_global.get());
82  return tmp;
83  });
84  m_pset = nullptr;
85  }
86 
87  void preallocLumis(unsigned int iNLumis) final {
88  m_lumis.resize(iNLumis);
89  m_lumiSummaries.resize(iNLumis);
90  }
91 
92  void doBeginJob() final { MyGlobal::beginJob(m_global.get()); }
93  void doEndJob() final { MyGlobal::endJob(m_global.get()); }
94  void setupRun(EDAnalyzerBase* iProd, RunIndex iIndex) final { MyGlobalRun::set(iProd, m_runs[iIndex].get()); }
95  void streamEndRunSummary(EDAnalyzerBase* iProd, edm::Run const& iRun, edm::EventSetup const& iES) final {
96  auto s = m_runSummaries[iRun.index()].get();
97  std::lock_guard<decltype(m_runSummaryLock)> guard(m_runSummaryLock);
98  MyGlobalRunSummary::streamEndRunSummary(iProd, iRun, iES, s);
99  }
100 
102  MyGlobalLuminosityBlock::set(iProd, m_lumis[iIndex].get());
103  }
106  edm::EventSetup const& iES) final {
107  auto s = m_lumiSummaries[iLumi.index()].get();
108  std::lock_guard<decltype(m_lumiSummaryLock)> guard(m_lumiSummaryLock);
110  }
111 
112  void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) final {
114  Run r(rp, moduleDescription(), mcc, false);
115  r.setConsumer(consumer());
116  Run const& cnstR = r;
117  RunIndex ri = rp.index();
118  const EventSetup c{ci,
119  static_cast<unsigned int>(Transition::BeginRun),
121  false};
122  MyGlobalRun::beginRun(cnstR, c, m_global.get(), m_runs[ri]);
123  typename T::RunContext rc(m_runs[ri].get(), m_global.get());
125  }
126  }
127  void doEndRun(RunPrincipal const& rp, EventSetupImpl const& ci, ModuleCallingContext const* mcc) final {
129  Run r(rp, moduleDescription(), mcc, true);
130  r.setConsumer(consumer());
131 
132  RunIndex ri = rp.index();
133  typename T::RunContext rc(m_runs[ri].get(), m_global.get());
134  const EventSetup c{ci,
135  static_cast<unsigned int>(Transition::EndRun),
137  false};
139  MyGlobalRun::endRun(r, c, &rc);
140  }
141  }
142 
144  EventSetupImpl const& ci,
145  ModuleCallingContext const* mcc) final {
147  LuminosityBlock lb(lbp, moduleDescription(), mcc, false);
148  lb.setConsumer(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());
153  const EventSetup c{ci,
154  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
156  false};
158  typename T::LuminosityBlockContext lc(m_lumis[li].get(), m_runs[ri].get(), m_global.get());
160  }
161  }
163  EventSetupImpl const& ci,
164  ModuleCallingContext const* mcc) final {
166  LuminosityBlock lb(lbp, moduleDescription(), mcc, true);
167  lb.setConsumer(consumer());
168 
169  LuminosityBlockIndex li = lbp.index();
170  RunIndex ri = lbp.runPrincipal().index();
171  typename T::LuminosityBlockContext lc(m_lumis[li].get(), m_runs[ri].get(), m_global.get());
172  const EventSetup c{ci,
173  static_cast<unsigned int>(Transition::EndLuminosityBlock),
175  false};
178  }
179  }
180 
181  EDAnalyzerAdaptor(const EDAnalyzerAdaptor&) = delete; // stop default
182 
183  const EDAnalyzerAdaptor& operator=(const EDAnalyzerAdaptor&) = delete; // stop default
184 
185  // ---------- member data --------------------------------
194  };
195  } // namespace stream
196 
197  template <>
200 
201  public:
202  template <typename ModType>
203  static std::unique_ptr<Base> makeModule(ParameterSet const& pset) {
204  typedef typename stream::BaseToAdaptor<Base, ModType>::Type Adaptor;
205  auto module = std::make_unique<Adaptor>(pset);
206  return std::unique_ptr<Base>(module.release());
207  }
208  };
209 
210 } // namespace edm
211 
212 #endif
edm::stream::CallGlobalImpl::endJob
static void endJob(typename T::GlobalCache *iCache)
Definition: callAbilities.h:54
edm::stream::CallGlobalLuminosityBlockImpl
Definition: callAbilities.h:144
edm::stream::EDAnalyzerAdaptor::streamEndRunSummary
void streamEndRunSummary(EDAnalyzerBase *iProd, edm::Run const &iRun, edm::EventSetup const &iES) final
Definition: EDAnalyzerAdaptor.h:95
edm::stream::EDAnalyzerAdaptor::MyGlobalLuminosityBlockSummary
CallGlobalLuminosityBlockSummary< T > MyGlobalLuminosityBlockSummary
Definition: EDAnalyzerAdaptor.h:76
edm::stream::EDAnalyzerAdaptor::m_lumiSummaryLock
impl::choose_mutex< typename T::LuminosityBlockSummaryCache >::type m_lumiSummaryLock
Definition: EDAnalyzerAdaptor.h:192
edm::EventSetupImpl
Definition: EventSetupImpl.h:44
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::stream::CallGlobalLuminosityBlockSummaryImpl
Definition: callAbilities.h:182
edm::Run
Definition: Run.h:45
LuminosityBlock.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::stream::CallGlobalRunSummaryImpl::streamEndRunSummary
static void streamEndRunSummary(B *iProd, edm::Run const &iRun, edm::EventSetup const &iES, typename T::RunSummaryCache *iCache)
Definition: callAbilities.h:109
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
edm::stream::CallGlobalLuminosityBlockImpl::beginLuminosityBlock
static void beginLuminosityBlock(edm::LuminosityBlock const &Lumi, edm::EventSetup const &iES, typename T::RunContext const *iRC, std::shared_ptr< typename T::LuminosityBlockCache const > &oCache)
Definition: callAbilities.h:145
edm::MakeModuleHelper< edm::stream::EDAnalyzerAdaptorBase >::makeModule
static std::unique_ptr< Base > makeModule(ParameterSet const &pset)
Definition: EDAnalyzerAdaptor.h:203
edm::stream::CallGlobalRunSummaryImpl
Definition: callAbilities.h:101
edm::stream::BaseToAdaptor< EDAnalyzerAdaptorBase, ModType >::Type
EDAnalyzerAdaptor< ModType > Type
Definition: EDAnalyzerAdaptor.h:47
edm::LuminosityBlockPrincipal
Definition: LuminosityBlockPrincipal.h:31
edm::stream::impl::choose_shared_vec::type
std::vector< std::shared_ptr< T > > type
Definition: dummy_helpers.h:64
edm::stream::CallGlobalImpl::set
static void set(B *iProd, typename T::GlobalCache const *iCache)
Definition: callAbilities.h:46
edm::stream::CallGlobalRunImpl::set
static void set(B *iProd, typename T::RunCache const *iCache)
Definition: callAbilities.h:78
edm::stream::EDAnalyzerAdaptor::doEndJob
void doEndJob() final
Definition: EDAnalyzerAdaptor.h:93
callAbilities.h
edm::stream::CallGlobalLuminosityBlockImpl::endLuminosityBlock
static void endLuminosityBlock(edm::LuminosityBlock const &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iContext)
Definition: callAbilities.h:157
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
watchdog.const
const
Definition: watchdog.py:83
edm::stream::EDAnalyzerAdaptor::m_global
impl::choose_unique_ptr< typename T::GlobalCache >::type m_global
Definition: EDAnalyzerAdaptor.h:186
edm::stream::EDAnalyzerAdaptor::MyGlobalRunSummary
CallGlobalRunSummary< T > MyGlobalRunSummary
Definition: EDAnalyzerAdaptor.h:74
makeGlobal.h
edm::stream::CallGlobalRunImpl::endRun
static void endRun(edm::Run const &iRun, edm::EventSetup const &iES, typename T::RunContext const *iContext)
Definition: callAbilities.h:82
edm::stream::EDAnalyzerAdaptor::doBeginJob
void doBeginJob() final
Definition: EDAnalyzerAdaptor.h:92
edm::stream::EDAnalyzerAdaptor::wantsGlobalLuminosityBlocks
bool wantsGlobalLuminosityBlocks() const final
Definition: EDAnalyzerAdaptor.h:67
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::stream::EDAnalyzerAdaptor::MyGlobalLuminosityBlock
CallGlobalLuminosityBlock< T > MyGlobalLuminosityBlock
Definition: EDAnalyzerAdaptor.h:75
edm::stream::CallGlobalImpl::beginJob
static void beginJob(typename T::GlobalCache *iCache)
Definition: callAbilities.h:49
edm::LuminosityBlockIndex
Definition: LuminosityBlockIndex.h:33
edm::stream::CallGlobalLuminosityBlockSummaryImpl::globalEndLuminosityBlock
static void globalEndLuminosityBlock(edm::LuminosityBlock const &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iContext, typename T::LuminosityBlockSummaryCache *iCache)
Definition: callAbilities.h:197
edm::stream::EDAnalyzerAdaptor::MyGlobalRun
CallGlobalRun< T > MyGlobalRun
Definition: EDAnalyzerAdaptor.h:73
edm::stream::EDAnalyzerAdaptorBase::createStreamModules
void createStreamModules(T iFunc)
Definition: EDAnalyzerAdaptorBase.h:89
edm::stream::EDAnalyzerAdaptor
Definition: EDAnalyzerAdaptor.h:44
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::stream::EDAnalyzerAdaptor::m_lumis
impl::choose_shared_vec< typename T::LuminosityBlockCache const >::type m_lumis
Definition: EDAnalyzerAdaptor.h:188
Run.h
EDAnalyzerAdaptorBase.h
edm::stream::EDAnalyzerAdaptor::doBeginRun
void doBeginRun(RunPrincipal const &rp, EventSetupImpl const &ci, ModuleCallingContext const *mcc) final
Definition: EDAnalyzerAdaptor.h:112
edm::Transition::BeginLuminosityBlock
edm::MakeModuleHelper
Definition: MakeModuleHelper.h:30
edm::stream::CallGlobalImpl
Definition: callAbilities.h:44
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::stream::CallGlobalRunSummaryImpl::beginRun
static void beginRun(edm::Run const &iRun, edm::EventSetup const &iES, typename T::RunContext const *iRC, std::shared_ptr< typename T::RunSummaryCache > &oCache)
Definition: callAbilities.h:102
es_hardcode_cfi.iLumi
iLumi
Definition: es_hardcode_cfi.py:206
edm::stream::EDAnalyzerAdaptor::EDAnalyzerAdaptor
EDAnalyzerAdaptor(edm::ParameterSet const &iPSet)
Definition: EDAnalyzerAdaptor.h:53
edm::ParameterSet
Definition: ParameterSet.h:36
edm::stream::EDAnalyzerAdaptor::m_pset
ParameterSet const * m_pset
Definition: EDAnalyzerAdaptor.h:193
edm::LuminosityBlock::setConsumer
void setConsumer(EDConsumerBase const *iConsumer)
Definition: LuminosityBlock.cc:26
edm::stream::EDAnalyzerAdaptor::m_runSummaries
impl::choose_shared_vec< typename T::RunSummaryCache >::type m_runSummaries
Definition: EDAnalyzerAdaptor.h:189
edm::module::AbilityBits::kRunSummaryCache
Definition: moduleAbilityEnums.h:55
RunPrincipal.h
edm::get
T const & get(Event const &event, InputTag const &tag) noexcept(false)
Definition: Event.h:669
edm::stream::EDAnalyzerAdaptor::m_runSummaryLock
impl::choose_mutex< typename T::RunSummaryCache >::type m_runSummaryLock
Definition: EDAnalyzerAdaptor.h:190
MakeModuleHelper.h
edm::stream::EDAnalyzerAdaptor::~EDAnalyzerAdaptor
~EDAnalyzerAdaptor() override
Definition: EDAnalyzerAdaptor.h:61
edm::stream::CallGlobalRunSummaryImpl::globalEndRun
static void globalEndRun(edm::Run const &iRun, edm::EventSetup const &iES, typename T::RunContext const *iContext, typename T::RunSummaryCache *iCache)
Definition: callAbilities.h:116
edm::stream::BaseToAdaptor
Definition: EDAnalyzerAdaptor.h:41
edm::stream::EDAnalyzerAdaptorBase
Definition: EDAnalyzerAdaptorBase.h:62
edm::EventSetup
Definition: EventSetup.h:57
edm::stream::EDAnalyzerAdaptor::doEndRun
void doEndRun(RunPrincipal const &rp, EventSetupImpl const &ci, ModuleCallingContext const *mcc) final
Definition: EDAnalyzerAdaptor.h:127
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::stream::impl::choose_unique_ptr::type
std::unique_ptr< T > type
Definition: dummy_helpers.h:50
module
Definition: vlib.h:198
LuminosityBlockPrincipal.h
edm::stream::EDAnalyzerAdaptor::m_runs
impl::choose_shared_vec< typename T::RunCache const >::type m_runs
Definition: EDAnalyzerAdaptor.h:187
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::stream::EDAnalyzerAdaptor::prevalidate
static void prevalidate(ConfigurationDescriptions &descriptions)
Definition: EDAnalyzerAdaptor.h:64
edm::stream::EDAnalyzerAdaptor::setupLuminosityBlock
void setupLuminosityBlock(EDAnalyzerBase *iProd, LuminosityBlockIndex iIndex) final
Definition: EDAnalyzerAdaptor.h:101
edm::Transition::EndLuminosityBlock
edm::stream::CallGlobalLuminosityBlockImpl::set
static void set(B *iProd, typename T::LuminosityBlockCache const *iCache)
Definition: callAbilities.h:153
edm::module::AbilityBits::kRunCache
Definition: moduleAbilityEnums.h:53
edm::stream::EDAnalyzerBase
Definition: EDAnalyzerBase.h:35
edm::EDConsumerBase::esGetTokenIndices
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
Definition: EDConsumerBase.h:110
edm::stream::CallGlobalRunImpl::beginRun
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:70
edm::Transition::BeginRun
edm::stream::EDAnalyzerAdaptor::operator=
const EDAnalyzerAdaptor & operator=(const EDAnalyzerAdaptor &)=delete
edm::module::AbilityBits::kLuminosityBlockSummaryCache
Definition: moduleAbilityEnums.h:56
edm::stream::EDAnalyzerAdaptor::doBeginLuminosityBlock
void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &ci, ModuleCallingContext const *mcc) final
Definition: EDAnalyzerAdaptor.h:143
edm::stream::EDAnalyzerAdaptor::streamEndLuminosityBlockSummary
void streamEndLuminosityBlockSummary(EDAnalyzerBase *iProd, edm::LuminosityBlock const &iLumi, edm::EventSetup const &iES) final
Definition: EDAnalyzerAdaptor.h:104
edm::module::AbilityBits::kLuminosityBlockCache
Definition: moduleAbilityEnums.h:54
EventSetup.h
or
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::stream::EDAnalyzerAdaptor::preallocLumis
void preallocLumis(unsigned int iNLumis) final
Definition: EDAnalyzerAdaptor.h:87
edm::RunIndex
Definition: RunIndex.h:32
edm::stream::EDAnalyzerAdaptor::MyGlobal
CallGlobal< T > MyGlobal
Definition: EDAnalyzerAdaptor.h:72
edm::stream::EDAnalyzerAdaptor::m_lumiSummaries
impl::choose_shared_vec< typename T::LuminosityBlockSummaryCache >::type m_lumiSummaries
Definition: EDAnalyzerAdaptor.h:191
dummy_helpers.h
dummy
Definition: DummySelector.h:38
edm::stream::EDAnalyzerAdaptor::doEndLuminosityBlock
void doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &ci, ModuleCallingContext const *mcc) final
Definition: EDAnalyzerAdaptor.h:162
edm::RunPrincipal
Definition: RunPrincipal.h:34
edm::stream::CallGlobalLuminosityBlockSummaryImpl::streamEndLuminosityBlockSummary
static void streamEndLuminosityBlockSummary(B *iProd, edm::LuminosityBlock const &iLumi, edm::EventSetup const &iES, typename T::LuminosityBlockSummaryCache *iCache)
Definition: callAbilities.h:190
edm::stream::CallGlobalLuminosityBlockSummaryImpl::beginLuminosityBlock
static void beginLuminosityBlock(edm::LuminosityBlock const &Lumi, edm::EventSetup const &iES, typename T::LuminosityBlockContext const *iRC, std::shared_ptr< typename T::LuminosityBlockSummaryCache > &oCache)
Definition: callAbilities.h:183
edm::stream::impl::choose_mutex::type
std::mutex type
Definition: dummy_helpers.h:76
edm::stream::EDAnalyzerAdaptor::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDAnalyzerAdaptor.h:63
edm::Transition::EndRun
edm::stream::EDAnalyzerAdaptor::setupStreamModules
void setupStreamModules() final
Definition: EDAnalyzerAdaptor.h:78
edm::stream::EDAnalyzerAdaptorBase::consumer
const EDConsumerBase * consumer() const
Definition: EDAnalyzerAdaptorBase.cc:110
edm::MakeModuleHelper< edm::stream::EDAnalyzerAdaptorBase >::Base
edm::stream::EDAnalyzerAdaptorBase Base
Definition: EDAnalyzerAdaptor.h:199
edm::stream::EDAnalyzerAdaptor::setupRun
void setupRun(EDAnalyzerBase *iProd, RunIndex iIndex) final
Definition: EDAnalyzerAdaptor.h:94
edm::stream::EDAnalyzerAdaptorBase::moduleDescription
const ModuleDescription & moduleDescription() const
Definition: EDAnalyzerAdaptorBase.h:77
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::stream::EDAnalyzerAdaptor::wantsGlobalRuns
bool wantsGlobalRuns() const final
Definition: EDAnalyzerAdaptor.h:66
edm::stream::CallGlobalRunImpl
Definition: callAbilities.h:69
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29