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));
77 }
78 
79 void
81  for(auto mod : m_streamModules) {
82  mod->registerProductsAndCallbacks(mod, reg);
83  }
84 }
85 
86 void
87 EDAnalyzerAdaptorBase::itemsToGet(BranchType iType, std::vector<ProductResolverIndexAndSkipBit>& iIndices) const {
88  assert(not m_streamModules.empty());
89  m_streamModules[0]->itemsToGet(iType,iIndices);
90 }
91 void
92 EDAnalyzerAdaptorBase::itemsMayGet(BranchType iType, std::vector<ProductResolverIndexAndSkipBit>& iIndices) const {
93  assert(not m_streamModules.empty());
94  m_streamModules[0]->itemsMayGet(iType,iIndices);
95 }
96 
97 std::vector<edm::ProductResolverIndexAndSkipBit> const&
99  assert(not m_streamModules.empty());
100  return m_streamModules[0]->itemsToGetFrom(iType);
101 }
102 
103 void
105  ProductResolverIndexHelper const& iHelper,
106  bool iPrefetchMayGet) {
107  for(auto mod: m_streamModules) {
108  mod->updateLookup(iType,iHelper,iPrefetchMayGet);
109  }
110 }
111 
112 const edm::EDConsumerBase*
114  return m_streamModules[0];
115 }
116 
117 void
119  ProductRegistry const& preg,
120  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
121  std::string const& processName) const {
122  assert(not m_streamModules.empty());
123  return m_streamModules[0]->modulesWhoseProductsAreConsumed(modules, preg, labelsToDesc, processName);
124 }
125 
126 void
128  for(auto mod: m_streamModules) {
129  mod->convertCurrentProcessAlias(processName);
130  }
131 }
132 
133 std::vector<edm::ConsumesInfo>
135  assert(not m_streamModules.empty());
136  return m_streamModules[0]->consumesInfo();
137 }
138 
139 bool
141  ActivityRegistry* act,
142  ModuleCallingContext const* mcc) {
143  assert(ep.streamID()<m_streamModules.size());
144  auto mod = m_streamModules[ep.streamID()];
145  Event e(ep, moduleDescription_, mcc);
146  e.setConsumer(mod);
147  EventSignalsSentry sentry(act,mcc);
148  mod->analyze(e, c);
149  return true;
150 }
151 void
153 
154 }
155 
156 void
158  m_streamModules[id]->beginStream(id);
159 }
160 void
162  m_streamModules[id]->endStream();
163 }
164 
165 void
167  RunPrincipal const& rp,
168  EventSetup const& c,
169  ModuleCallingContext const* mcc)
170 {
171  auto mod = m_streamModules[id];
172  setupRun(mod, rp.index());
173 
174  Run r(rp, moduleDescription_, mcc);
175  r.setConsumer(mod);
176  mod->beginRun(r, c);
177 
178 }
179 
180 void
182  RunPrincipal const& rp,
183  EventSetup const& c,
184  ModuleCallingContext const* mcc)
185 {
186  auto mod = m_streamModules[id];
187  Run r(rp, moduleDescription_, mcc);
188  r.setConsumer(mod);
189  mod->endRun(r, c);
191 }
192 
193 void
195  LuminosityBlockPrincipal const& lbp,
196  EventSetup const& c,
197  ModuleCallingContext const* mcc) {
198  auto mod = m_streamModules[id];
200 
201  LuminosityBlock lb(lbp, moduleDescription_, mcc);
202  lb.setConsumer(mod);
203  mod->beginLuminosityBlock(lb, c);
204 }
205 void
207  LuminosityBlockPrincipal const& lbp,
208  EventSetup const& c,
209  ModuleCallingContext const* mcc)
210 {
211  auto mod = m_streamModules[id];
212  LuminosityBlock lb(lbp, moduleDescription_, mcc);
213  lb.setConsumer(mod);
214  mod->endLuminosityBlock(lb, c);
216 
217 }
218 
219 void
221 void
223 
224 void
227 }
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:38
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:53
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:49
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: Run.h:42
void setModuleDescriptionPtr(EDAnalyzerBase *m)
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const