CMS 3D CMS Logo

EDAnalyzerBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Framework
4 // Class : global::EDAnalyzerBase
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Chris Jones
10 // Created: Thu, 02 May 2013 21:56:04 GMT
11 //
12 
13 // system include files
14 
15 // user include files
24 
27 
29 
32 
33 //
34 // constants, enums and typedefs
35 //
36 namespace edm {
37  namespace global {
38  //
39  // static data member definitions
40  //
41 
42  //
43  // constructors and destructor
44  //
45  EDAnalyzerBase::EDAnalyzerBase() : moduleDescription_() {}
46 
48 
50  EventSetupImpl const& ci,
51  ActivityRegistry* act,
52  ModuleCallingContext const* mcc) {
53  Event e(ep, moduleDescription_, mcc);
54  e.setConsumer(this);
55  EventSignalsSentry sentry(act, mcc);
56  const EventSetup c{ci, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event)};
57  this->analyze(e.streamID(), e, c);
58  return true;
59  }
60 
62  preallocStreams(iPrealloc.numberOfStreams());
64  preallocate(iPrealloc);
65  }
66 
68 
69  void EDAnalyzerBase::doEndJob() { this->endJob(); }
70 
72  Run r(rp, moduleDescription_, mcc, false);
73  r.setConsumer(this);
74  Run const& cnstR = r;
75  const EventSetup c{ci, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun)};
76  this->doBeginRun_(cnstR, c);
77  this->doBeginRunSummary_(cnstR, c);
78  }
79 
81  Run r(rp, moduleDescription_, mcc, true);
82  r.setConsumer(this);
83  Run const& cnstR = r;
84  const EventSetup c{ci, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun)};
85  this->doEndRunSummary_(r, c);
86  this->doEndRun_(cnstR, c);
87  }
88 
90  EventSetupImpl const& ci,
91  ModuleCallingContext const* mcc) {
92  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
93  lb.setConsumer(this);
94  LuminosityBlock const& cnstLb = lb;
95  const EventSetup c{ci,
96  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
98  this->doBeginLuminosityBlock_(cnstLb, c);
99  this->doBeginLuminosityBlockSummary_(cnstLb, c);
100  }
101 
103  EventSetupImpl const& ci,
104  ModuleCallingContext const* mcc) {
105  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
106  lb.setConsumer(this);
107  LuminosityBlock const& cnstLb = lb;
108  const EventSetup c{ci,
109  static_cast<unsigned int>(Transition::EndLuminosityBlock),
111  this->doEndLuminosityBlockSummary_(cnstLb, c);
112  this->doEndLuminosityBlock_(cnstLb, c);
113  }
114 
118  RunPrincipal const& rp,
119  EventSetupImpl const& ci,
120  ModuleCallingContext const* mcc) {
121  Run r(rp, moduleDescription_, mcc, false);
122  r.setConsumer(this);
123  const EventSetup c{ci, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun)};
124  this->doStreamBeginRun_(id, r, c);
125  }
127  RunPrincipal const& rp,
128  EventSetupImpl const& ci,
129  ModuleCallingContext const* mcc) {
130  Run r(rp, moduleDescription_, mcc, true);
131  r.setConsumer(this);
132  const EventSetup c{ci, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun)};
133  this->doStreamEndRun_(id, r, c);
134  this->doStreamEndRunSummary_(id, r, c);
135  }
137  LuminosityBlockPrincipal const& lbp,
138  EventSetupImpl const& ci,
139  ModuleCallingContext const* mcc) {
140  LuminosityBlock lb(lbp, moduleDescription_, mcc, false);
141  lb.setConsumer(this);
142  const EventSetup c{ci,
143  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
145  this->doStreamBeginLuminosityBlock_(id, lb, c);
146  }
147 
149  LuminosityBlockPrincipal const& lbp,
150  EventSetupImpl const& ci,
151  ModuleCallingContext const* mcc) {
152  LuminosityBlock lb(lbp, moduleDescription_, mcc, true);
153  lb.setConsumer(this);
154  const EventSetup c{ci,
155  static_cast<unsigned int>(Transition::EndLuminosityBlock),
157  this->doStreamEndLuminosityBlock_(id, lb, c);
158  this->doStreamEndLuminosityBlockSummary_(id, lb, c);
159  }
160 
162  //respondToOpenInputFile(fb);
163  }
164 
166  //respondToCloseInputFile(fb);
167  }
168 
169  void EDAnalyzerBase::preallocStreams(unsigned int) {}
170  void EDAnalyzerBase::preallocLumis(unsigned int) {}
175  void EDAnalyzerBase::doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) {}
180  LuminosityBlock const& lbp,
181  EventSetup const& c) {}
182 
183  void EDAnalyzerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
184  void EDAnalyzerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
187 
192 
195  desc.setUnknown();
196  descriptions.addDefault(desc);
197  }
198 
200 
204 
206  regService->watchProductAdditions(callWhenNewProductsRegistered_);
207  }
208  }
209  static const std::string kBaseType("EDAnalyzer");
210 
212 
213  } // namespace global
214 } // namespace edm
static const std::string kBaseType("EDAnalyzer")
virtual void doStreamBeginRun_(StreamID id, Run const &rp, EventSetup const &c)
void setConsumer(EDConsumerBase const *iConsumer)
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
void doRespondToCloseInputFile(FileBlock const &fb)
static const std::string & baseType()
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
void doEndRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Event.cc:37
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
virtual void preallocLumis(unsigned int)
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
virtual void doEndRun_(Run const &rp, EventSetup const &c)
void addDefault(ParameterSetDescription const &psetDescription)
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
ModuleDescription moduleDescription_
void edmodule_mightGet_config(ConfigurationDescriptions &iDesc)
virtual void preallocate(PreallocationConfiguration const &)
void registerProductsAndCallbacks(EDAnalyzerBase *module, ProductRegistry *reg)
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
void callForEachBranch(T const &iFunc)
void doEndStream(StreamID id)
void doPreallocate(PreallocationConfiguration const &)
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
void doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
virtual void doEndStream_(StreamID id)
static void prevalidate(ConfigurationDescriptions &descriptions)
virtual void preallocStreams(unsigned int)
void doBeginRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
HLT enums.
void doRespondToOpenInputFile(FileBlock const &fb)
StreamID streamID() const
Definition: Event.h:95
void doBeginStream(StreamID id)
void doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
virtual void analyze(StreamID, Event const &, EventSetup const &) const =0
void setConsumer(EDConsumerBase const *iConsumer)
Definition: Run.h:51
bool doEvent(EventPrincipal const &ep, EventSetupImpl const &c, ActivityRegistry *, ModuleCallingContext const *)
virtual void doBeginStream_(StreamID id)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: Run.h:45
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const