CMS 3D CMS Logo

EDAnalyzerAdaptorBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_stream_EDAnalyzerAdaptorBase_h
2 #define FWCore_Framework_stream_EDAnalyzerAdaptorBase_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : EDAnalyzerAdaptorBase
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Fri, 02 Aug 2013 18:09:15 GMT
19 //
20 
21 // system include files
22 #include <map>
23 #include <string>
24 #include <vector>
25 
26 // user include files
36 
37 // forward declarations
38 
39 namespace edm {
40  class ModuleCallingContext;
41  class ProductResolverIndexHelper;
42  class EDConsumerBase;
43  class PreallocationConfiguration;
44  class ProductResolverIndexAndSkipBit;
45  class ActivityRegistry;
46  class ProductRegistry;
47  class ThinnedAssociationsHelper;
48  class WaitingTask;
49 
50  namespace maker {
51  template <typename T>
52  class ModuleHolderT;
53  }
54 
55  namespace eventsetup {
57  }
58 
59  namespace stream {
60  class EDAnalyzerBase;
61 
63  public:
64  template <typename T>
65  friend class edm::WorkerT;
66  template <typename T>
68 
70  virtual ~EDAnalyzerAdaptorBase();
71 
72  // ---------- const member functions ---------------------
73 
74  // ---------- static member functions --------------------
75 
76  // ---------- member functions ---------------------------
78 
79  virtual bool wantsGlobalRuns() const = 0;
80  virtual bool wantsGlobalLuminosityBlocks() const = 0;
81  bool wantsStreamRuns() const { return true; }
82  bool wantsStreamLuminosityBlocks() const { return true; }
83 
84  std::string workerType() const { return "WorkerT<EDAnalyzerAdaptorBase>"; }
86 
87  protected:
88  template <typename T>
89  void createStreamModules(T iFunc) {
90  for (auto& m : m_streamModules) {
91  m = iFunc();
93  }
94  }
95 
96  //Same interface as EDConsumerBase
97  void itemsToGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
98  void itemsMayGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
99  std::vector<ProductResolverIndexAndSkipBit> const& itemsToGetFrom(BranchType) const;
100 
101  void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const&, bool iPrefetchMayGet);
103 
104  const EDConsumerBase* consumer() const;
105 
106  void modulesWhoseProductsAreConsumed(std::vector<ModuleDescription const*>& modules,
107  ProductRegistry const& preg,
108  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
109  std::string const& processName) const;
110 
112 
113  std::vector<ConsumesInfo> consumesInfo() const;
114 
115  private:
116  EDAnalyzerAdaptorBase(const EDAnalyzerAdaptorBase&) = delete; // stop default
117 
118  const EDAnalyzerAdaptorBase& operator=(const EDAnalyzerAdaptorBase&) = delete; // stop default
119 
122  virtual void preallocLumis(unsigned int) {}
123 
124  //For now this is a placeholder
125  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask,
126  ModuleCallingContext const& iModuleCallingContext,
127  Principal const& iPrincipal) const {}
128 
129  virtual void setupStreamModules() = 0;
130  virtual void doBeginJob() = 0;
131  virtual void doEndJob() = 0;
132 
133  void doBeginStream(StreamID id);
134  void doEndStream(StreamID id);
136  virtual void setupRun(EDAnalyzerBase*, RunIndex) = 0;
138  virtual void streamEndRunSummary(EDAnalyzerBase*, edm::Run const&, edm::EventSetup const&) = 0;
139 
142  EventSetupImpl const& c,
143  ModuleCallingContext const*);
147  EventSetupImpl const& c,
148  ModuleCallingContext const*);
150  edm::LuminosityBlock const&,
151  edm::EventSetup const&) = 0;
152 
153  virtual void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*) = 0;
154  virtual void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*) = 0;
155  virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp,
156  EventSetupImpl const& c,
157  ModuleCallingContext const*) = 0;
158  virtual void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp,
159  EventSetupImpl const& c,
160  ModuleCallingContext const*) = 0;
161 
162  //For now, the following are just dummy implemenations with no ability for users to override
166 
167  bool hasAcquire() const { return false; }
168  bool hasAccumulator() const { return false; }
169 
170  // ---------- member data --------------------------------
174 
175  std::vector<EDAnalyzerBase*> m_streamModules;
176  };
177  } // namespace stream
178 } // namespace edm
179 #endif
edm::stream::EDAnalyzerAdaptorBase::setupRun
virtual void setupRun(EDAnalyzerBase *, RunIndex)=0
edm::StreamID
Definition: StreamID.h:30
edm::stream::EDAnalyzerAdaptorBase::setModuleDescriptionPtr
void setModuleDescriptionPtr(EDAnalyzerBase *m)
Definition: EDAnalyzerAdaptorBase.cc:210
edm::stream::EDAnalyzerAdaptorBase::itemsToGet
void itemsToGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
Definition: EDAnalyzerAdaptorBase.cc:82
edm::eventsetup::ESRecordsToProxyIndices
Definition: ESRecordsToProxyIndices.h:35
edm::stream::EDAnalyzerAdaptorBase::preActionBeforeRunEventAsync
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
Definition: EDAnalyzerAdaptorBase.h:125
edm::stream::EDAnalyzerAdaptorBase::doBeginStream
void doBeginStream(StreamID id)
Definition: EDAnalyzerAdaptorBase.cc:147
ActivityRegistry
edm::stream::EDAnalyzerAdaptorBase::consumesInfo
std::vector< ConsumesInfo > consumesInfo() const
Definition: EDAnalyzerAdaptorBase.cc:127
edm::EventSetupImpl
Definition: EventSetupImpl.h:44
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::stream::EDAnalyzerAdaptorBase::doRespondToCloseInputFile
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDAnalyzerAdaptorBase.cc:208
edm::Run
Definition: Run.h:45
modules
Definition: ZHLTMatchFilter.cc:17
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::stream::EDAnalyzerAdaptorBase::doBeginJob
virtual void doBeginJob()=0
edm::stream::EDAnalyzerAdaptorBase::doStreamEndRun
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:164
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
ProductResolverIndex.h
edm::stream::EDAnalyzerAdaptorBase::doEvent
bool doEvent(EventPrincipal const &ep, EventSetupImpl const &c, ActivityRegistry *, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:132
edm::stream::EDAnalyzerAdaptorBase::doBeginRun
virtual void doBeginRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)=0
edm::LuminosityBlockPrincipal
Definition: LuminosityBlockPrincipal.h:31
edm::stream::EDAnalyzerAdaptorBase::doEndStream
void doEndStream(StreamID id)
Definition: EDAnalyzerAdaptorBase.cc:148
edm::stream::EDAnalyzerAdaptorBase::~EDAnalyzerAdaptorBase
virtual ~EDAnalyzerAdaptorBase()
Definition: EDAnalyzerAdaptorBase.cc:49
edm::Principal
Definition: Principal.h:57
edm::stream::EDAnalyzerAdaptorBase::streamEndLuminosityBlockSummary
virtual void streamEndLuminosityBlockSummary(EDAnalyzerBase *, edm::LuminosityBlock const &, edm::EventSetup const &)=0
edm::WorkerT
Definition: Frameworkfwd.h:54
edm::stream::EDAnalyzerAdaptorBase::doEndLuminosityBlock
virtual void doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)=0
edm::ProductResolverIndexHelper
Definition: ProductResolverIndexHelper.h:89
edm::stream::EDAnalyzerAdaptorBase::operator=
const EDAnalyzerAdaptorBase & operator=(const EDAnalyzerAdaptorBase &)=delete
edm::BranchType
BranchType
Definition: BranchType.h:11
edm::ModuleDescription
Definition: ModuleDescription.h:21
edm::ProductRegistry
Definition: ProductRegistry.h:34
ModuleDescription.h
edm::FileBlock
Definition: FileBlock.h:20
edm::EDConsumerBase
Definition: EDConsumerBase.h:62
edm::EventPrincipal
Definition: EventPrincipal.h:46
edm::LuminosityBlockIndex
Definition: LuminosityBlockIndex.h:33
WaitingTask
edm::stream::EDAnalyzerAdaptorBase::modulesWhoseProductsAreConsumed
void modulesWhoseProductsAreConsumed(std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
Definition: EDAnalyzerAdaptorBase.cc:112
edm::stream::EDAnalyzerAdaptorBase::createStreamModules
void createStreamModules(T iFunc)
Definition: EDAnalyzerAdaptorBase.h:89
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
edm::ActivityRegistry
Definition: ActivityRegistry.h:132
edm::stream::EDAnalyzerAdaptorBase::setupStreamModules
virtual void setupStreamModules()=0
edm::stream::EDAnalyzerAdaptorBase::doRegisterThinnedAssociations
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: EDAnalyzerAdaptorBase.h:165
edm::maker::ModuleHolderT
Definition: EDAnalyzer.h:26
edm::stream::EDAnalyzerAdaptorBase::workerType
std::string workerType() const
Definition: EDAnalyzerAdaptorBase.h:84
RunIndex.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::stream::EDAnalyzerAdaptorBase::wantsGlobalLuminosityBlocks
virtual bool wantsGlobalLuminosityBlocks() const =0
edm::stream::EDAnalyzerAdaptorBase::streamEndRunSummary
virtual void streamEndRunSummary(EDAnalyzerBase *, edm::Run const &, edm::EventSetup const &)=0
edm::stream::EDAnalyzerAdaptorBase::registerProductsAndCallbacks
void registerProductsAndCallbacks(EDAnalyzerAdaptorBase const *, ProductRegistry *reg)
Definition: EDAnalyzerAdaptorBase.cc:76
edm::stream::EDAnalyzerAdaptorBase::hasAcquire
bool hasAcquire() const
Definition: EDAnalyzerAdaptorBase.h:167
edm::ThinnedAssociationsHelper
Definition: ThinnedAssociationsHelper.h:35
edm::stream::EDAnalyzerAdaptorBase::doRespondToOpenInputFile
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDAnalyzerAdaptorBase.cc:207
edm::stream::EDAnalyzerAdaptorBase::wantsStreamRuns
bool wantsStreamRuns() const
Definition: EDAnalyzerAdaptorBase.h:81
edm::stream::EDAnalyzerAdaptorBase::doStreamBeginLuminosityBlock
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:177
ESRecordsToProxyIndices
edm::stream::EDAnalyzerAdaptorBase::updateLookup
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
Definition: EDAnalyzerAdaptorBase.cc:96
edm::stream::EDAnalyzerAdaptorBase::hasAccumulator
bool hasAccumulator() const
Definition: EDAnalyzerAdaptorBase.h:168
BranchType.h
edm::stream::EDAnalyzerAdaptorBase
Definition: EDAnalyzerAdaptorBase.h:62
edm::stream::EDAnalyzerAdaptorBase::setModuleDescription
void setModuleDescription(ModuleDescription const &md)
Definition: EDAnalyzerAdaptorBase.h:172
edm::stream::EDAnalyzerAdaptorBase::doEndJob
virtual void doEndJob()=0
edm::stream::EDAnalyzerAdaptorBase::EDAnalyzerAdaptorBase
EDAnalyzerAdaptorBase()
Definition: EDAnalyzerAdaptorBase.cc:42
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::stream::EDAnalyzerAdaptorBase::doStreamBeginRun
void doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:150
edm::stream::EDAnalyzerAdaptorBase::doPreallocate
void doPreallocate(PreallocationConfiguration const &)
Definition: EDAnalyzerAdaptorBase.cc:70
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
edm::stream::EDAnalyzerAdaptorBase::m_streamModules
std::vector< EDAnalyzerBase * > m_streamModules
Definition: EDAnalyzerAdaptorBase.h:175
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
edm::stream::EDAnalyzerAdaptorBase::doBeginLuminosityBlock
virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)=0
edm::stream::EDAnalyzerAdaptorBase::doStreamEndLuminosityBlock
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:192
edm::WaitingTask
Definition: WaitingTask.h:36
edm::stream::EDAnalyzerBase
Definition: EDAnalyzerBase.h:35
Frameworkfwd.h
T
long double T
Definition: Basic3DVectorLD.h:48
edm::stream::EDAnalyzerAdaptorBase::preallocLumis
virtual void preallocLumis(unsigned int)
Definition: EDAnalyzerAdaptorBase.h:122
ParameterSetfwd.h
edm::RunIndex
Definition: RunIndex.h:32
LuminosityBlockIndex.h
edm::stream::EDAnalyzerAdaptorBase::itemsMayGet
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
Definition: EDAnalyzerAdaptorBase.cc:86
edm::RunPrincipal
Definition: RunPrincipal.h:34
edm::stream::EDAnalyzerAdaptorBase::itemsToGetFrom
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom(BranchType) const
Definition: EDAnalyzerAdaptorBase.cc:91
edm::stream::EDAnalyzerAdaptorBase::setupLuminosityBlock
virtual void setupLuminosityBlock(EDAnalyzerBase *, LuminosityBlockIndex)=0
ConsumesInfo.h
edm::stream::EDAnalyzerAdaptorBase::convertCurrentProcessAlias
void convertCurrentProcessAlias(std::string const &processName)
Definition: EDAnalyzerAdaptorBase.cc:121
StreamID.h
edm::stream::EDAnalyzerAdaptorBase::consumer
const EDConsumerBase * consumer() const
Definition: EDAnalyzerAdaptorBase.cc:110
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::stream::EDAnalyzerAdaptorBase::doEndRun
virtual void doEndRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)=0
edm::stream::EDAnalyzerAdaptorBase::moduleDescription
const ModuleDescription & moduleDescription() const
Definition: EDAnalyzerAdaptorBase.h:77
benchmark_cfg.fb
fb
Definition: benchmark_cfg.py:14
edm::stream::EDAnalyzerAdaptorBase::moduleDescription_
ModuleDescription moduleDescription_
Definition: EDAnalyzerAdaptorBase.h:173
EDAnalyzerBase
edm::stream::EDAnalyzerAdaptorBase::wantsGlobalRuns
virtual bool wantsGlobalRuns() const =0
edm::stream::EDAnalyzerAdaptorBase::wantsStreamLuminosityBlocks
bool wantsStreamLuminosityBlocks() const
Definition: EDAnalyzerAdaptorBase.h:82
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29