test
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::vector<const char*>& oModuleLabels) const {
119  assert(not m_streamModules.empty());
120  return m_streamModules[0]->modulesDependentUpon(iProcessName, oModuleLabels);
121 }
122 
123 void
125  ProductRegistry const& preg,
126  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
127  std::string const& processName) const {
128  assert(not m_streamModules.empty());
129  return m_streamModules[0]->modulesWhoseProductsAreConsumed(modules, preg, labelsToDesc, processName);
130 }
131 
132 std::vector<edm::ConsumesInfo>
134  assert(not m_streamModules.empty());
135  return m_streamModules[0]->consumesInfo();
136 }
137 
138 bool
140  ActivityRegistry* act,
141  ModuleCallingContext const* mcc) {
142  assert(ep.streamID()<m_streamModules.size());
143  auto mod = m_streamModules[ep.streamID()];
144  Event e(ep, moduleDescription_, mcc);
145  e.setConsumer(mod);
146  EventSignalsSentry sentry(act,mcc);
147  mod->analyze(e, c);
148  return true;
149 }
150 void
152 
153 }
154 
155 void
157  m_streamModules[id]->beginStream(id);
158 }
159 void
161  m_streamModules[id]->endStream();
162 }
163 
164 void
166  RunPrincipal& rp,
167  EventSetup const& c,
168  ModuleCallingContext const* mcc)
169 {
170  auto mod = m_streamModules[id];
171  setupRun(mod, rp.index());
172 
173  Run r(rp, moduleDescription_, mcc);
174  r.setConsumer(mod);
175  mod->beginRun(r, c);
176 
177 }
178 
179 void
181  RunPrincipal& rp,
182  EventSetup const& c,
183  ModuleCallingContext const* mcc)
184 {
185  auto mod = m_streamModules[id];
186  Run r(rp, moduleDescription_, mcc);
187  r.setConsumer(mod);
188  mod->endRun(r, c);
190 }
191 
192 void
195  EventSetup const& c,
196  ModuleCallingContext const* mcc) {
197  auto mod = m_streamModules[id];
199 
200  LuminosityBlock lb(lbp, moduleDescription_, mcc);
201  lb.setConsumer(mod);
202  mod->beginLuminosityBlock(lb, c);
203 }
204 void
207  EventSetup const& c,
208  ModuleCallingContext const* mcc)
209 {
210  auto mod = m_streamModules[id];
211  LuminosityBlock lb(lbp, moduleDescription_, mcc);
212  lb.setConsumer(mod);
213  mod->endLuminosityBlock(lb, c);
215 
216 }
217 
218 void
220 void
222 void
224 {
225  for(auto mod: m_streamModules) {
226  mod->preForkReleaseResources();
227  }
228 }
229 void
230 EDAnalyzerAdaptorBase::doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
231 {
232  for(auto mod: m_streamModules) {
233  mod->postForkReacquireResources(iChildIndex,iNumberOfChildren);
234  }
235 }
236 
237 void
240 }
void registerProductsAndCallbacks(EDAnalyzerAdaptorBase const *, ProductRegistry *reg)
void setConsumer(EDConsumerBase const *iConsumer)
void doRespondToCloseInputFile(FileBlock const &fb)
std::vector< EDAnalyzerBase * > m_streamModules
void doStreamEndRun(StreamID id, RunPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
const EDConsumerBase * consumer() const
void itemsMayGet(BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
void doPreallocate(PreallocationConfiguration const &)
assert(m_qm.get())
void modulesDependentUpon(const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
LuminosityBlockIndex index() const
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Event.cc:37
std::vector< ConsumesInfo > consumesInfo() const
bool doEvent(EventPrincipal &ep, EventSetup const &c, ActivityRegistry *, ModuleCallingContext const *)
virtual void setupLuminosityBlock(EDAnalyzerBase *, LuminosityBlockIndex)=0
BranchType
Definition: BranchType.h:11
void updateLookup(BranchType iBranchType, ProductHolderIndexHelper const &)
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
void doStreamBeginRun(StreamID id, RunPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
StreamID streamID() 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
preg
Definition: Schedule.cc:369
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)