1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
// -*- C++ -*-
//
// Package: FWCore/Framework
// Class : one::EDAnalyzerBase
//
// Implementation:
// [Notes on implementation]
//
// Original Author: Chris Jones
// Created: Thu, 02 May 2013 21:56:04 GMT
//
// system include files
// user include files
#include "FWCore/Framework/interface/one/EDAnalyzerBase.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
#include "FWCore/Framework/interface/ProcessBlock.h"
#include "FWCore/Framework/interface/Run.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/src/edmodule_mightGet_config.h"
#include "FWCore/Framework/src/EventSignalsSentry.h"
#include "FWCore/Framework/interface/PreallocationConfiguration.h"
#include "FWCore/Framework/interface/TransitionInfoTypes.h"
#include "FWCore/Framework/interface/SignallingProductRegistryFiller.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/ServiceRegistry/interface/ESParentContext.h"
//
// constants, enums and typedefs
//
namespace edm {
namespace one {
//
// static data member definitions
//
//
// constructors and destructor
//
EDAnalyzerBase::EDAnalyzerBase() : moduleDescription_() {}
EDAnalyzerBase::~EDAnalyzerBase() {}
void EDAnalyzerBase::callWhenNewProductsRegistered(std::function<void(ProductDescription const&)> const& func) {
callWhenNewProductsRegistered_ = func;
}
bool EDAnalyzerBase::doEvent(EventTransitionInfo const& info,
ActivityRegistry* act,
ModuleCallingContext const* mcc) {
EventSignalsSentry sentry(act, mcc);
Event e(info, moduleDescription_, mcc);
e.setConsumer(this);
e.setSharedResourcesAcquirer(&resourcesAcquirer_);
ESParentContext parentC(mcc);
const EventSetup c{
info, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), parentC};
this->analyze(e, c);
return true;
}
SharedResourcesAcquirer EDAnalyzerBase::createAcquirer() {
return SharedResourcesAcquirer{
std::vector<std::shared_ptr<SerialTaskQueue>>(1, std::make_shared<SerialTaskQueue>())};
}
SerialTaskQueue* EDAnalyzerBase::globalRunsQueue() { return nullptr; }
SerialTaskQueue* EDAnalyzerBase::globalLuminosityBlocksQueue() { return nullptr; };
void EDAnalyzerBase::doBeginJob() {
resourcesAcquirer_ = createAcquirer();
this->beginJob();
}
void EDAnalyzerBase::doEndJob() { this->endJob(); }
void EDAnalyzerBase::doPreallocate(PreallocationConfiguration const& iPrealloc) {
preallocRuns(iPrealloc.numberOfRuns());
preallocLumis(iPrealloc.numberOfLuminosityBlocks());
}
void EDAnalyzerBase::preallocRuns(unsigned int) {}
void EDAnalyzerBase::preallocLumis(unsigned int) {}
void EDAnalyzerBase::doBeginProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) {
ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
processBlock.setConsumer(this);
ProcessBlock const& constProcessBlock = processBlock;
this->doBeginProcessBlock_(constProcessBlock);
}
void EDAnalyzerBase::doAccessInputProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) {
ProcessBlock processBlock(pbp, moduleDescription_, mcc, false);
processBlock.setConsumer(this);
ProcessBlock const& constProcessBlock = processBlock;
this->doAccessInputProcessBlock_(constProcessBlock);
}
void EDAnalyzerBase::doEndProcessBlock(ProcessBlockPrincipal const& pbp, ModuleCallingContext const* mcc) {
ProcessBlock processBlock(pbp, moduleDescription_, mcc, true);
processBlock.setConsumer(this);
ProcessBlock const& constProcessBlock = processBlock;
this->doEndProcessBlock_(constProcessBlock);
}
void EDAnalyzerBase::doBeginRun(RunTransitionInfo const& info, ModuleCallingContext const* mcc) {
Run r(info, moduleDescription_, mcc, false);
r.setConsumer(this);
Run const& cnstR = r;
ESParentContext parentC(mcc);
const EventSetup c{
info, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC};
this->doBeginRun_(cnstR, c);
}
void EDAnalyzerBase::doEndRun(RunTransitionInfo const& info, ModuleCallingContext const* mcc) {
Run r(info, moduleDescription_, mcc, true);
r.setConsumer(this);
Run const& cnstR = r;
ESParentContext parentC(mcc);
const EventSetup c{
info, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC};
this->doEndRun_(cnstR, c);
}
void EDAnalyzerBase::doBeginLuminosityBlock(LumiTransitionInfo const& info, ModuleCallingContext const* mcc) {
LuminosityBlock lb(info, moduleDescription_, mcc, false);
lb.setConsumer(this);
LuminosityBlock const& cnstLb = lb;
ESParentContext parentC(mcc);
const EventSetup c{info,
static_cast<unsigned int>(Transition::BeginLuminosityBlock),
esGetTokenIndices(Transition::BeginLuminosityBlock),
parentC};
this->doBeginLuminosityBlock_(cnstLb, c);
}
void EDAnalyzerBase::doEndLuminosityBlock(LumiTransitionInfo const& info, ModuleCallingContext const* mcc) {
LuminosityBlock lb(info, moduleDescription_, mcc, true);
lb.setConsumer(this);
LuminosityBlock const& cnstLb = lb;
ESParentContext parentC(mcc);
const EventSetup c{info,
static_cast<unsigned int>(Transition::EndLuminosityBlock),
esGetTokenIndices(Transition::EndLuminosityBlock),
parentC};
this->doEndLuminosityBlock_(cnstLb, c);
}
void EDAnalyzerBase::doBeginProcessBlock_(ProcessBlock const&) {}
void EDAnalyzerBase::doAccessInputProcessBlock_(ProcessBlock const&) {}
void EDAnalyzerBase::doEndProcessBlock_(ProcessBlock const&) {}
void EDAnalyzerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
void EDAnalyzerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
void EDAnalyzerBase::doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c) {}
void EDAnalyzerBase::doEndLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c) {}
void EDAnalyzerBase::clearInputProcessBlockCaches() {}
void EDAnalyzerBase::fillDescriptions(ConfigurationDescriptions& descriptions) {
ParameterSetDescription desc;
desc.setUnknown();
descriptions.addDefault(desc);
}
void EDAnalyzerBase::prevalidate(ConfigurationDescriptions& iConfig) { edmodule_mightGet_config(iConfig); }
static const std::string kBaseType("EDAnalyzer");
const std::string& EDAnalyzerBase::baseType() { return kBaseType; }
void EDAnalyzerBase::registerProductsAndCallbacks(EDAnalyzerBase const*, SignallingProductRegistryFiller* reg) {
if (callWhenNewProductsRegistered_) {
reg->callForEachBranch(callWhenNewProductsRegistered_);
reg->watchProductAdditions(callWhenNewProductsRegistered_);
}
}
} // namespace one
} // namespace edm
|