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
25 
28 
29 using namespace edm::stream;
30 //
31 // constants, enums and typedefs
32 //
33 
34 //
35 // static data member definitions
36 //
37 
38 //
39 // constructors and destructor
40 //
42 {
43 }
44 
45 // EDAnalyzerAdaptorBase::EDAnalyzerAdaptorBase(const EDAnalyzerAdaptorBase& rhs)
46 // {
47 // // do actual copying here;
48 // }
49 
51 {
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 //
72 void
74  m_streamModules.resize(iPrealloc.numberOfStreams(),
75  static_cast<stream::EDAnalyzerBase*>(nullptr));
78 }
79 
80 void
82  for(auto mod : m_streamModules) {
83  mod->registerProductsAndCallbacks(mod, reg);
84  }
85 }
86 
87 void
88 EDAnalyzerAdaptorBase::itemsToGet(BranchType iType, std::vector<ProductResolverIndexAndSkipBit>& iIndices) const {
89  assert(not m_streamModules.empty());
90  m_streamModules[0]->itemsToGet(iType,iIndices);
91 }
92 void
93 EDAnalyzerAdaptorBase::itemsMayGet(BranchType iType, std::vector<ProductResolverIndexAndSkipBit>& iIndices) const {
94  assert(not m_streamModules.empty());
95  m_streamModules[0]->itemsMayGet(iType,iIndices);
96 }
97 
98 std::vector<edm::ProductResolverIndexAndSkipBit> const&
100  assert(not m_streamModules.empty());
101  return m_streamModules[0]->itemsToGetFrom(iType);
102 }
103 
104 void
106  ProductResolverIndexHelper const& iHelper,
107  bool iPrefetchMayGet) {
108  for(auto mod: m_streamModules) {
109  mod->updateLookup(iType,iHelper,iPrefetchMayGet);
110  }
111 }
112 
113 const edm::EDConsumerBase*
115  return m_streamModules[0];
116 }
117 
118 void
120  ProductRegistry const& preg,
121  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
122  std::string const& processName) const {
123  assert(not m_streamModules.empty());
124  return m_streamModules[0]->modulesWhoseProductsAreConsumed(modules, preg, labelsToDesc, processName);
125 }
126 
127 void
129  for(auto mod: m_streamModules) {
130  mod->convertCurrentProcessAlias(processName);
131  }
132 }
133 
134 std::vector<edm::ConsumesInfo>
136  assert(not m_streamModules.empty());
137  return m_streamModules[0]->consumesInfo();
138 }
139 
140 bool
142  ActivityRegistry* act,
143  ModuleCallingContext const* mcc) {
144  assert(ep.streamID()<m_streamModules.size());
145  auto mod = m_streamModules[ep.streamID()];
146  Event e(ep, moduleDescription_, mcc);
147  e.setConsumer(mod);
148  EventSignalsSentry sentry(act,mcc);
149  mod->analyze(e, c);
150  return true;
151 }
152 void
154 
155 }
156 
157 void
159  m_streamModules[id]->beginStream(id);
160 }
161 void
163  m_streamModules[id]->endStream();
164 }
165 
166 void
168  RunPrincipal const& rp,
169  EventSetup const& c,
170  ModuleCallingContext const* mcc)
171 {
172  auto mod = m_streamModules[id];
173  setupRun(mod, rp.index());
174 
175  Run r(rp, moduleDescription_, mcc, false);
176  r.setConsumer(mod);
177  mod->beginRun(r, c);
178 
179 }
180 
181 void
183  RunPrincipal const& rp,
184  EventSetup const& c,
185  ModuleCallingContext const* mcc)
186 {
187  auto mod = m_streamModules[id];
188  Run r(rp, moduleDescription_, mcc, true);
189  r.setConsumer(mod);
190  mod->endRun(r, c);
192 }
193 
194 void
196  LuminosityBlockPrincipal const& lbp,
197  EventSetup const& c,
198  ModuleCallingContext const* mcc) {
199  auto mod = m_streamModules[id];
201 
202  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
203  lb.setConsumer(mod);
204  mod->beginLuminosityBlock(lb, c);
205 }
206 void
208  LuminosityBlockPrincipal const& lbp,
209  EventSetup const& c,
210  ModuleCallingContext const* mcc)
211 {
212  auto mod = m_streamModules[id];
213  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
214  lb.setConsumer(mod);
215  mod->endLuminosityBlock(lb, c);
217 
218 }
219 
220 void
222 void
224 
225 void
228 }
void itemsToGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
void registerProductsAndCallbacks(EDAnalyzerAdaptorBase const *, ProductRegistry *reg)
void setConsumer(EDConsumerBase const *iConsumer)
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom(BranchType) const
void doRespondToCloseInputFile(FileBlock const &fb)
bool doEvent(EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *, ModuleCallingContext const *)
std::vector< EDAnalyzerBase * > m_streamModules
const EDConsumerBase * consumer() const
void doPreallocate(PreallocationConfiguration const &)
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
LuminosityBlockIndex index() const
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Event.cc:42
std::vector< ConsumesInfo > consumesInfo() const
virtual void setupLuminosityBlock(EDAnalyzerBase *, LuminosityBlockIndex)=0
BranchType
Definition: BranchType.h:11
void doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
void convertCurrentProcessAlias(std::string const &processName)
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
StreamID streamID() const
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
virtual void streamEndLuminosityBlockSummary(EDAnalyzerBase *, edm::LuminosityBlock const &, edm::EventSetup const &)=0
virtual void setupRun(EDAnalyzerBase *, RunIndex)=0
void modulesWhoseProductsAreConsumed(std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
void setModuleDescriptionPtr(ModuleDescription const *iDesc)
RunIndex index() const
Definition: RunPrincipal.h:57
virtual void preallocLumis(unsigned int)
virtual void streamEndRunSummary(EDAnalyzerBase *, edm::Run const &, edm::EventSetup const &)=0
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Run.h:51
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: Run.h:44
void setModuleDescriptionPtr(EDAnalyzerBase *m)
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const