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 
15 // user include files
24 
26 
27 using namespace edm::stream;
28 //
29 // constants, enums and typedefs
30 //
31 
32 //
33 // static data member definitions
34 //
35 
36 //
37 // constructors and destructor
38 //
40 {
41 }
42 
43 // EDAnalyzerAdaptorBase::EDAnalyzerAdaptorBase(const EDAnalyzerAdaptorBase& rhs)
44 // {
45 // // do actual copying here;
46 // }
47 
49 {
50  for(auto m: m_streamModules) {
51  delete m;
52  }
53 }
54 
55 //
56 // assignment operators
57 //
58 // const EDAnalyzerAdaptorBase& EDAnalyzerAdaptorBase::operator=(const EDAnalyzerAdaptorBase& rhs)
59 // {
60 // //An exception safe implementation is
61 // EDAnalyzerAdaptorBase temp(rhs);
62 // swap(rhs);
63 //
64 // return *this;
65 // }
66 
67 //
68 // member functions
69 //
70 void
72  m_streamModules.resize(iPrealloc.numberOfStreams(),
73  static_cast<stream::EDAnalyzerBase*>(nullptr));
75 }
76 
77 void
79  for(auto mod : m_streamModules) {
80  mod->registerProductsAndCallbacks(mod, reg);
81  }
82 }
83 
84 void
85 EDAnalyzerAdaptorBase::itemsToGet(BranchType iType, std::vector<ProductHolderIndexAndSkipBit>& iIndices) const {
86  assert(not m_streamModules.empty());
87  m_streamModules[0]->itemsToGet(iType,iIndices);
88 }
89 void
90 EDAnalyzerAdaptorBase::itemsMayGet(BranchType iType, std::vector<ProductHolderIndexAndSkipBit>& iIndices) const {
91  assert(not m_streamModules.empty());
92  m_streamModules[0]->itemsMayGet(iType,iIndices);
93 }
94 
95 std::vector<edm::ProductHolderIndexAndSkipBit> const&
97  assert(not m_streamModules.empty());
98  return m_streamModules[0]->itemsToGetFromEvent();
99 }
100 
101 void
103  ProductHolderIndexHelper const& iHelper) {
104  for(auto mod: m_streamModules) {
105  mod->updateLookup(iType,iHelper);
106  }
107 }
108 
109 const edm::EDConsumerBase*
111  return m_streamModules[0];
112 }
113 
114 
115 bool
117  ModuleCallingContext const* mcc) {
118  assert(ep.streamID()<m_streamModules.size());
119  auto mod = m_streamModules[ep.streamID()];
120  Event e(ep, moduleDescription_, mcc);
121  e.setConsumer(mod);
122  mod->analyze(e, c);
123  return true;
124 }
125 void
127 
128 }
129 
130 void
132  m_streamModules[id]->beginStream(id);
133 }
134 void
136  m_streamModules[id]->endStream();
137 }
138 
139 void
141  RunPrincipal& rp,
142  EventSetup const& c,
143  ModuleCallingContext const* mcc)
144 {
145  auto mod = m_streamModules[id];
146  setupRun(mod, rp.index());
147 
148  Run r(rp, moduleDescription_, mcc);
149  r.setConsumer(mod);
150  mod->beginRun(r, c);
151 
152 }
153 
154 void
156  RunPrincipal& rp,
157  EventSetup const& c,
158  ModuleCallingContext const* mcc)
159 {
160  auto mod = m_streamModules[id];
161  Run r(rp, moduleDescription_, mcc);
162  r.setConsumer(mod);
163  mod->endRun(r, c);
165 }
166 
167 void
170  EventSetup const& c,
171  ModuleCallingContext const* mcc) {
172  auto mod = m_streamModules[id];
174 
175  LuminosityBlock lb(lbp, moduleDescription_, mcc);
176  lb.setConsumer(mod);
177  mod->beginLuminosityBlock(lb, c);
178 }
179 void
182  EventSetup const& c,
183  ModuleCallingContext const* mcc)
184 {
185  auto mod = m_streamModules[id];
186  LuminosityBlock lb(lbp, moduleDescription_, mcc);
187  lb.setConsumer(mod);
188  mod->endLuminosityBlock(lb, c);
190 
191 }
192 
193 void
195 void
197 void
199 void
200 EDAnalyzerAdaptorBase::doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren){}
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 &)
bool doEvent(EventPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
LuminosityBlockIndex index() const
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Event.cc:40
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
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:48
std::vector< ProductHolderIndexAndSkipBit > const & itemsToGetFromEvent() const
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: Run.h:41
void itemsToGet(BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const