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