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 
30 
31 using namespace edm::stream;
32 //
33 // constants, enums and typedefs
34 //
35 
36 //
37 // static data member definitions
38 //
39 
40 //
41 // constructors and destructor
42 //
44 
45 // EDAnalyzerAdaptorBase::EDAnalyzerAdaptorBase(const EDAnalyzerAdaptorBase& rhs)
46 // {
47 // // do actual copying here;
48 // }
49 
51  for (auto m : m_streamModules) {
52  delete m;
53  }
54 }
55 
56 //
57 // assignment operators
58 //
59 // const EDAnalyzerAdaptorBase& EDAnalyzerAdaptorBase::operator=(const EDAnalyzerAdaptorBase& rhs)
60 // {
61 // //An exception safe implementation is
62 // EDAnalyzerAdaptorBase temp(rhs);
63 // swap(rhs);
64 //
65 // return *this;
66 // }
67 
68 //
69 // member functions
70 //
72  m_streamModules.resize(iPrealloc.numberOfStreams(), static_cast<stream::EDAnalyzerBase*>(nullptr));
75 }
76 
78  for (auto mod : m_streamModules) {
79  mod->registerProductsAndCallbacks(mod, reg);
80  }
81 }
82 
83 void EDAnalyzerAdaptorBase::itemsToGet(BranchType iType, std::vector<ProductResolverIndexAndSkipBit>& iIndices) const {
84  assert(not m_streamModules.empty());
85  m_streamModules[0]->itemsToGet(iType, iIndices);
86 }
87 void EDAnalyzerAdaptorBase::itemsMayGet(BranchType iType, std::vector<ProductResolverIndexAndSkipBit>& iIndices) const {
88  assert(not m_streamModules.empty());
89  m_streamModules[0]->itemsMayGet(iType, iIndices);
90 }
91 
92 std::vector<edm::ProductResolverIndexAndSkipBit> const& EDAnalyzerAdaptorBase::itemsToGetFrom(BranchType iType) const {
93  assert(not m_streamModules.empty());
94  return m_streamModules[0]->itemsToGetFrom(iType);
95 }
96 
97 std::vector<edm::ESProxyIndex> const& EDAnalyzerAdaptorBase::esGetTokenIndicesVector(edm::Transition iTrans) const {
98  assert(not m_streamModules.empty());
99  return m_streamModules[0]->esGetTokenIndicesVector(iTrans);
100 }
101 
102 std::vector<edm::ESRecordIndex> const& EDAnalyzerAdaptorBase::esGetTokenRecordIndicesVector(
103  edm::Transition iTrans) const {
104  assert(not m_streamModules.empty());
105  return m_streamModules[0]->esGetTokenRecordIndicesVector(iTrans);
106 }
107 
109  ProductResolverIndexHelper const& iHelper,
110  bool iPrefetchMayGet) {
111  for (auto mod : m_streamModules) {
112  mod->updateLookup(iType, iHelper, iPrefetchMayGet);
113  }
114 }
115 
117  for (auto mod : m_streamModules) {
118  mod->updateLookup(iPI);
119  }
120 }
121 
123 
125  std::vector<ModuleDescription const*>& modules,
126  ProductRegistry const& preg,
127  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
128  std::string const& processName) const {
129  assert(not m_streamModules.empty());
130  return m_streamModules[0]->modulesWhoseProductsAreConsumed(modules, preg, labelsToDesc, processName);
131 }
132 
134  for (auto mod : m_streamModules) {
135  mod->convertCurrentProcessAlias(processName);
136  }
137 }
138 
139 std::vector<edm::ConsumesInfo> EDAnalyzerAdaptorBase::consumesInfo() const {
140  assert(not m_streamModules.empty());
141  return m_streamModules[0]->consumesInfo();
142 }
143 
145  ActivityRegistry* act,
146  ModuleCallingContext const* mcc) {
147  EventPrincipal const& ep = info.principal();
148  assert(ep.streamID() < m_streamModules.size());
149  auto mod = m_streamModules[ep.streamID()];
150  Event e(ep, moduleDescription_, mcc);
151  e.setConsumer(mod);
152  const EventSetup c{
153  info, static_cast<unsigned int>(Transition::Event), mod->esGetTokenIndices(Transition::Event), false};
154  EventSignalsSentry sentry(act, mcc);
155  mod->analyze(e, c);
156  return true;
157 }
158 
161 
163  RunTransitionInfo const& info,
164  ModuleCallingContext const* mcc) {
165  RunPrincipal const& rp = info.principal();
166  auto mod = m_streamModules[id];
167  setupRun(mod, rp.index());
168 
169  Run r(rp, moduleDescription_, mcc, false);
170  const EventSetup c{
171  info, static_cast<unsigned int>(Transition::BeginRun), mod->esGetTokenIndices(Transition::BeginRun), false};
172  r.setConsumer(mod);
173  mod->beginRun(r, c);
174 }
175 
177  RunTransitionInfo const& info,
178  ModuleCallingContext const* mcc) {
179  auto mod = m_streamModules[id];
180  Run r(info, moduleDescription_, mcc, true);
181  r.setConsumer(mod);
182  const EventSetup c{
183  info, static_cast<unsigned int>(Transition::EndRun), mod->esGetTokenIndices(Transition::EndRun), false};
184  mod->endRun(r, c);
186 }
187 
189  LumiTransitionInfo const& info,
190  ModuleCallingContext const* mcc) {
191  LuminosityBlockPrincipal const& lbp = info.principal();
192  auto mod = m_streamModules[id];
194 
195  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
196  lb.setConsumer(mod);
197  const EventSetup c{info,
198  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
199  mod->esGetTokenIndices(Transition::BeginLuminosityBlock),
200  false};
201  mod->beginLuminosityBlock(lb, c);
202 }
204  LumiTransitionInfo const& info,
205  ModuleCallingContext const* mcc) {
206  auto mod = m_streamModules[id];
207  LuminosityBlock lb(info, moduleDescription_, mcc, true);
208  lb.setConsumer(mod);
209  const EventSetup c{info,
210  static_cast<unsigned int>(Transition::EndLuminosityBlock),
211  mod->esGetTokenIndices(Transition::EndLuminosityBlock),
212  false};
213  mod->endLuminosityBlock(lb, c);
215 }
216 
219 
221  m->setModuleDescriptionPtr(&moduleDescription_);
222 }
edm::stream::EDAnalyzerAdaptorBase::setupRun
virtual void setupRun(EDAnalyzerBase *, RunIndex)=0
edm::EventTransitionInfo
Definition: TransitionInfoTypes.h:26
edm::StreamID
Definition: StreamID.h:30
edm::stream::EDAnalyzerAdaptorBase::setModuleDescriptionPtr
void setModuleDescriptionPtr(EDAnalyzerBase *m)
Definition: EDAnalyzerAdaptorBase.cc:220
edm::stream::EDAnalyzerAdaptorBase::itemsToGet
void itemsToGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
Definition: EDAnalyzerAdaptorBase.cc:83
edm::eventsetup::ESRecordsToProxyIndices
Definition: ESRecordsToProxyIndices.h:35
edm::stream::EDAnalyzerAdaptorBase::doBeginStream
void doBeginStream(StreamID id)
Definition: EDAnalyzerAdaptorBase.cc:159
edm::stream::EDAnalyzerAdaptorBase::consumesInfo
std::vector< ConsumesInfo > consumesInfo() const
Definition: EDAnalyzerAdaptorBase.cc:139
edm::LumiTransitionInfo
Definition: TransitionInfoTypes.h:42
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::stream::EDAnalyzerAdaptorBase::doRespondToCloseInputFile
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDAnalyzerAdaptorBase.cc:218
edm::Run
Definition: Run.h:45
modules
Definition: ZHLTMatchFilter.cc:17
LuminosityBlock.h
edm::Transition::Event
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
edm::LuminosityBlockPrincipal
Definition: LuminosityBlockPrincipal.h:31
edm::stream::EDAnalyzerAdaptorBase::doEndStream
void doEndStream(StreamID id)
Definition: EDAnalyzerAdaptorBase.cc:160
edm::stream::EDAnalyzerAdaptorBase::~EDAnalyzerAdaptorBase
virtual ~EDAnalyzerAdaptorBase()
Definition: EDAnalyzerAdaptorBase.cc:50
cms::cuda::assert
assert(be >=bs)
edm::stream::EDAnalyzerAdaptorBase::streamEndLuminosityBlockSummary
virtual void streamEndLuminosityBlockSummary(EDAnalyzerBase *, edm::LuminosityBlock const &, edm::EventSetup const &)=0
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
PreallocationConfiguration.h
edm::ProductResolverIndexHelper
Definition: ProductResolverIndexHelper.h:89
edm::RunTransitionInfo
Definition: TransitionInfoTypes.h:64
edm::stream::EDAnalyzerAdaptorBase::doStreamEndLuminosityBlock
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:203
EventSignalsSentry.h
edm::BranchType
BranchType
Definition: BranchType.h:11
edm::ProductRegistry
Definition: ProductRegistry.h:37
edm::FileBlock
Definition: FileBlock.h:20
edm::PreallocationConfiguration::numberOfLuminosityBlocks
unsigned int numberOfLuminosityBlocks() const
Definition: PreallocationConfiguration.h:36
edm::EDConsumerBase
Definition: EDConsumerBase.h:70
edm::EventPrincipal
Definition: EventPrincipal.h:46
edm::stream::EDAnalyzerAdaptorBase::doStreamBeginLuminosityBlock
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:188
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:124
EventPrincipal.h
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
edm::ActivityRegistry
Definition: ActivityRegistry.h:133
Run.h
edm::stream::EDAnalyzerAdaptorBase::setupStreamModules
virtual void setupStreamModules()=0
EDAnalyzerAdaptorBase.h
edm::stream::EDAnalyzerAdaptorBase::doStreamEndRun
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:176
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:77
edm::Transition
Transition
Definition: Transition.h:12
edm::stream::EDAnalyzerAdaptorBase::doRespondToOpenInputFile
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDAnalyzerAdaptorBase.cc:217
Event.h
edm::LuminosityBlock::setConsumer
void setConsumer(EDConsumerBase const *iConsumer)
Definition: LuminosityBlock.cc:33
RunPrincipal.h
edm::stream::EDAnalyzerAdaptorBase::updateLookup
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
Definition: EDAnalyzerAdaptorBase.cc:108
edm::stream::EDAnalyzerAdaptorBase
Definition: EDAnalyzerAdaptorBase.h:63
edm::stream::EDAnalyzerAdaptorBase::EDAnalyzerAdaptorBase
EDAnalyzerAdaptorBase()
Definition: EDAnalyzerAdaptorBase.cc:43
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
LuminosityBlockPrincipal.h
edm::stream::EDAnalyzerAdaptorBase::doPreallocate
void doPreallocate(PreallocationConfiguration const &)
Definition: EDAnalyzerAdaptorBase.cc:71
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::stream::EDAnalyzerAdaptorBase::doStreamBeginRun
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:162
edm::stream::EDAnalyzerAdaptorBase::m_streamModules
std::vector< EDAnalyzerBase * > m_streamModules
Definition: EDAnalyzerAdaptorBase.h:171
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
edm::EventSignalsSentry
Definition: EventSignalsSentry.h:29
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:126
EventSetup.h
edm::stream
Definition: DQMEDAnalyzer.h:13
edm::stream::EDAnalyzerAdaptorBase::esGetTokenRecordIndicesVector
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector(edm::Transition iTrans) const
Definition: EDAnalyzerAdaptorBase.cc:102
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:87
EDAnalyzerBase.h
TransitionInfoTypes.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:92
edm::stream::EDAnalyzerAdaptorBase::doEvent
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
Definition: EDAnalyzerAdaptorBase.cc:144
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:133
edm::stream::EDAnalyzerAdaptorBase::consumer
const EDConsumerBase * consumer() const
Definition: EDAnalyzerAdaptorBase.cc:122
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::stream::EDAnalyzerAdaptorBase::moduleDescription_
ModuleDescription moduleDescription_
Definition: EDAnalyzerAdaptorBase.h:169
edm::stream::EDAnalyzerAdaptorBase::esGetTokenIndicesVector
std::vector< ESProxyIndex > const & esGetTokenIndicesVector(edm::Transition iTrans) const
Definition: EDAnalyzerAdaptorBase.cc:97
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29