CMS 3D CMS Logo

EDAnalyzerAdaptorBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Framework
4 // Class : edm::stream::EDAnalyzerAdaptorBase
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Chris Jones
10 // Created: Fri, 02 Aug 2013 21:43:44 GMT
11 //
12 
13 // system include files
14 #include <cassert>
15 
16 // user include files
26 
29 
30 using namespace edm::stream;
31 //
32 // constants, enums and typedefs
33 //
34 
35 //
36 // static data member definitions
37 //
38 
39 //
40 // constructors and destructor
41 //
43 
44 // EDAnalyzerAdaptorBase::EDAnalyzerAdaptorBase(const EDAnalyzerAdaptorBase& rhs)
45 // {
46 // // do actual copying here;
47 // }
48 
50  for (auto m : m_streamModules) {
51  delete m;
52  }
53 }
54 
55 //
56 // assignment operators
57 //
58 // const EDAnalyzerAdaptorBase& EDAnalyzerAdaptorBase::operator=(const EDAnalyzerAdaptorBase& rhs)
59 // {
60 // //An exception safe implementation is
61 // EDAnalyzerAdaptorBase temp(rhs);
62 // swap(rhs);
63 //
64 // return *this;
65 // }
66 
67 //
68 // member functions
69 //
71  m_streamModules.resize(iPrealloc.numberOfStreams(), static_cast<stream::EDAnalyzerBase*>(nullptr));
74 }
75 
77  for (auto mod : m_streamModules) {
78  mod->registerProductsAndCallbacks(mod, reg);
79  }
80 }
81 
82 void EDAnalyzerAdaptorBase::itemsToGet(BranchType iType, std::vector<ProductResolverIndexAndSkipBit>& iIndices) const {
83  assert(not m_streamModules.empty());
84  m_streamModules[0]->itemsToGet(iType, iIndices);
85 }
86 void EDAnalyzerAdaptorBase::itemsMayGet(BranchType iType, std::vector<ProductResolverIndexAndSkipBit>& iIndices) const {
87  assert(not m_streamModules.empty());
88  m_streamModules[0]->itemsMayGet(iType, iIndices);
89 }
90 
91 std::vector<edm::ProductResolverIndexAndSkipBit> const& EDAnalyzerAdaptorBase::itemsToGetFrom(BranchType iType) const {
92  assert(not m_streamModules.empty());
93  return m_streamModules[0]->itemsToGetFrom(iType);
94 }
95 
97  ProductResolverIndexHelper const& iHelper,
98  bool iPrefetchMayGet) {
99  for (auto mod : m_streamModules) {
100  mod->updateLookup(iType, iHelper, iPrefetchMayGet);
101  }
102 }
103 
105  for (auto mod : m_streamModules) {
106  mod->updateLookup(iPI);
107  }
108 }
109 
111 
113  std::vector<ModuleDescription const*>& modules,
114  ProductRegistry const& preg,
115  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
116  std::string const& processName) const {
117  assert(not m_streamModules.empty());
118  return m_streamModules[0]->modulesWhoseProductsAreConsumed(modules, preg, labelsToDesc, processName);
119 }
120 
122  for (auto mod : m_streamModules) {
123  mod->convertCurrentProcessAlias(processName);
124  }
125 }
126 
127 std::vector<edm::ConsumesInfo> EDAnalyzerAdaptorBase::consumesInfo() const {
128  assert(not m_streamModules.empty());
129  return m_streamModules[0]->consumesInfo();
130 }
131 
133  EventSetupImpl const& ci,
134  ActivityRegistry* act,
135  ModuleCallingContext const* mcc) {
136  assert(ep.streamID() < m_streamModules.size());
137  auto mod = m_streamModules[ep.streamID()];
138  Event e(ep, moduleDescription_, mcc);
139  e.setConsumer(mod);
140  const EventSetup c{
141  ci, static_cast<unsigned int>(Transition::Event), mod->esGetTokenIndices(Transition::Event), false};
142  EventSignalsSentry sentry(act, mcc);
143  mod->analyze(e, c);
144  return true;
145 }
146 
149 
151  RunPrincipal const& rp,
152  EventSetupImpl const& ci,
153  ModuleCallingContext const* mcc) {
154  auto mod = m_streamModules[id];
155  setupRun(mod, rp.index());
156 
157  Run r(rp, moduleDescription_, mcc, false);
158  const EventSetup c{
159  ci, static_cast<unsigned int>(Transition::BeginRun), mod->esGetTokenIndices(Transition::BeginRun), false};
160  r.setConsumer(mod);
161  mod->beginRun(r, c);
162 }
163 
165  RunPrincipal const& rp,
166  EventSetupImpl const& ci,
167  ModuleCallingContext const* mcc) {
168  auto mod = m_streamModules[id];
169  Run r(rp, moduleDescription_, mcc, true);
170  r.setConsumer(mod);
171  const EventSetup c{
172  ci, static_cast<unsigned int>(Transition::EndRun), mod->esGetTokenIndices(Transition::EndRun), false};
173  mod->endRun(r, c);
175 }
176 
178  LuminosityBlockPrincipal const& lbp,
179  EventSetupImpl const& ci,
180  ModuleCallingContext const* mcc) {
181  auto mod = m_streamModules[id];
183 
184  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
185  lb.setConsumer(mod);
186  const EventSetup c{ci,
187  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
188  mod->esGetTokenIndices(Transition::BeginLuminosityBlock),
189  false};
190  mod->beginLuminosityBlock(lb, c);
191 }
193  LuminosityBlockPrincipal const& lbp,
194  EventSetupImpl const& ci,
195  ModuleCallingContext const* mcc) {
196  auto mod = m_streamModules[id];
197  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
198  lb.setConsumer(mod);
199  const EventSetup c{ci,
200  static_cast<unsigned int>(Transition::EndLuminosityBlock),
201  mod->esGetTokenIndices(Transition::EndLuminosityBlock),
202  false};
203  mod->endLuminosityBlock(lb, c);
205 }
206 
209 
211  m->setModuleDescriptionPtr(&moduleDescription_);
212 }
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::doBeginStream
void doBeginStream(StreamID id)
Definition: EDAnalyzerAdaptorBase.cc:147
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
LuminosityBlock.h
edm::Transition::Event
edm::stream::EDAnalyzerAdaptorBase::doStreamEndRun
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:164
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
edm::stream::EDAnalyzerAdaptorBase::doEvent
bool doEvent(EventPrincipal const &ep, EventSetupImpl const &c, ActivityRegistry *, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:132
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
cms::cuda::assert
assert(be >=bs)
edm::stream::EDAnalyzerAdaptorBase::streamEndLuminosityBlockSummary
virtual void streamEndLuminosityBlockSummary(EDAnalyzerBase *, edm::LuminosityBlock const &, edm::EventSetup const &)=0
PreallocationConfiguration.h
edm::ProductResolverIndexHelper
Definition: ProductResolverIndexHelper.h:89
EventSignalsSentry.h
edm::BranchType
BranchType
Definition: BranchType.h:11
edm::ProductRegistry
Definition: ProductRegistry.h:34
edm::FileBlock
Definition: FileBlock.h:20
edm::PreallocationConfiguration::numberOfLuminosityBlocks
unsigned int numberOfLuminosityBlocks() const
Definition: PreallocationConfiguration.h:36
edm::EDConsumerBase
Definition: EDConsumerBase.h:62
edm::EventPrincipal
Definition: EventPrincipal.h:46
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
EventPrincipal.h
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
edm::ActivityRegistry
Definition: ActivityRegistry.h:132
Run.h
edm::stream::EDAnalyzerAdaptorBase::setupStreamModules
virtual void setupStreamModules()=0
EDAnalyzerAdaptorBase.h
edm::Transition::BeginLuminosityBlock
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::RunPrincipal::index
RunIndex index() const
Definition: RunPrincipal.h:57
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::doRespondToOpenInputFile
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDAnalyzerAdaptorBase.cc:207
Event.h
edm::LuminosityBlock::setConsumer
void setConsumer(EDConsumerBase const *iConsumer)
Definition: LuminosityBlock.cc:26
RunPrincipal.h
edm::stream::EDAnalyzerAdaptorBase::doStreamBeginLuminosityBlock
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:177
edm::stream::EDAnalyzerAdaptorBase::updateLookup
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
Definition: EDAnalyzerAdaptorBase.cc:96
edm::stream::EDAnalyzerAdaptorBase
Definition: EDAnalyzerAdaptorBase.h:62
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
LuminosityBlockPrincipal.h
edm::stream::EDAnalyzerAdaptorBase::doPreallocate
void doPreallocate(PreallocationConfiguration const &)
Definition: EDAnalyzerAdaptorBase.cc:70
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::stream::EDAnalyzerAdaptorBase::m_streamModules
std::vector< EDAnalyzerBase * > m_streamModules
Definition: EDAnalyzerAdaptorBase.h:175
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
edm::EventSignalsSentry
Definition: EventSignalsSentry.h:29
edm::stream::EDAnalyzerAdaptorBase::doStreamEndLuminosityBlock
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:192
edm::Transition::EndLuminosityBlock
edm::stream::EDAnalyzerBase
Definition: EDAnalyzerBase.h:35
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
edm::Transition::BeginRun
edm::stream::EDAnalyzerAdaptorBase::preallocLumis
virtual void preallocLumis(unsigned int)
Definition: EDAnalyzerAdaptorBase.h:122
EventSetup.h
edm::stream
Definition: DQMEDAnalyzer.h:13
edm::PreallocationConfiguration::numberOfStreams
unsigned int numberOfStreams() const
Definition: PreallocationConfiguration.h:35
edm::stream::EDAnalyzerAdaptorBase::itemsMayGet
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
Definition: EDAnalyzerAdaptorBase.cc:86
EDAnalyzerBase.h
edm::LuminosityBlockPrincipal::index
LuminosityBlockIndex index() const
Definition: LuminosityBlockPrincipal.h:51
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
edm::Event
Definition: Event.h:73
edm::Transition::EndRun
edm::stream::EDAnalyzerAdaptorBase::convertCurrentProcessAlias
void convertCurrentProcessAlias(std::string const &processName)
Definition: EDAnalyzerAdaptorBase.cc:121
edm::stream::EDAnalyzerAdaptorBase::consumer
const EDConsumerBase * consumer() const
Definition: EDAnalyzerAdaptorBase.cc:110
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::stream::EDAnalyzerAdaptorBase::moduleDescription_
ModuleDescription moduleDescription_
Definition: EDAnalyzerAdaptorBase.h:173
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29