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