CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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<ProductHolderIndexAndSkipBit>& 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<ProductHolderIndexAndSkipBit>& iIndices) const {
93  assert(not m_streamModules.empty());
94  m_streamModules[0]->itemsMayGet(iType,iIndices);
95 }
96 
97 std::vector<edm::ProductHolderIndexAndSkipBit> const&
99  assert(not m_streamModules.empty());
100  return m_streamModules[0]->itemsToGetFromEvent();
101 }
102 
103 void
105  ProductHolderIndexHelper const& iHelper) {
106  for(auto mod: m_streamModules) {
107  mod->updateLookup(iType,iHelper);
108  }
109 }
110 
111 const edm::EDConsumerBase*
113  return m_streamModules[0];
114 }
115 
116 void
118  std::string const& iModuleLabel,
119  bool iPrint,
120  std::vector<char const*>& oModuleLabels) const {
121  assert(not m_streamModules.empty());
122  return m_streamModules[0]->modulesDependentUpon(iProcessName, iModuleLabel, iPrint, oModuleLabels);
123 }
124 
125 void
127  ProductRegistry const& preg,
128  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
129  std::string const& processName) const {
130  assert(not m_streamModules.empty());
131  return m_streamModules[0]->modulesWhoseProductsAreConsumed(modules, preg, labelsToDesc, processName);
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);
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);
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);
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);
214  lb.setConsumer(mod);
215  mod->endLuminosityBlock(lb, c);
217 
218 }
219 
220 void
222 void
224 void
226 {
227  for(auto mod: m_streamModules) {
228  mod->preForkReleaseResources();
229  }
230 }
231 void
232 EDAnalyzerAdaptorBase::doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
233 {
234  for(auto mod: m_streamModules) {
235  mod->postForkReacquireResources(iChildIndex,iNumberOfChildren);
236  }
237 }
238 
239 void
242 }
void registerProductsAndCallbacks(EDAnalyzerAdaptorBase const *, ProductRegistry *reg)
void setConsumer(EDConsumerBase const *iConsumer)
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 itemsMayGet(BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
void doPreallocate(PreallocationConfiguration const &)
assert(m_qm.get())
LuminosityBlockIndex index() const
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Event.cc:37
std::vector< ConsumesInfo > consumesInfo() const
virtual void setupLuminosityBlock(EDAnalyzerBase *, LuminosityBlockIndex)=0
BranchType
Definition: BranchType.h:11
void updateLookup(BranchType iBranchType, ProductHolderIndexHelper const &)
void doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
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
void modulesDependentUpon(std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
preg
Definition: Schedule.cc:374
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Run.h:50
std::vector< ProductHolderIndexAndSkipBit > const & itemsToGetFromEvent() const
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: Run.h:43
void itemsToGet(BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
void setModuleDescriptionPtr(EDAnalyzerBase *m)