CMS 3D CMS Logo

DoodadEDLooper.cc
Go to the documentation of this file.
9 
10 #include "Doodad.h"
11 #include "GadgetRcd.h"
12 
13 namespace edmtest {
15  public:
16  DoodadEDLooper(edm::ParameterSet const& iPSet) : token_(esConsumes<edm::Transition::BeginRun>()) {}
17  ~DoodadEDLooper() override = default;
18 
19  void startingNewLoop(unsigned int) override {}
20 
21  void beginOfJob(edm::EventSetup const& iSetup) override {
22  auto& doodad = iSetup.getData(token_);
23  if (doodad.a != 1) {
24  throw cms::Exception("TestFailure") << "beginOfJob: got " << doodad.a << " while expected 1";
25  }
26  }
27 
28  void beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) override {
29  auto& doodad = iSetup.getData(token_);
30  if (doodad.a != 1) {
31  throw cms::Exception("TestFailure") << "beginRun: got " << doodad.a << " while expected 1";
32  }
33  }
34 
35  Status duringLoop(edm::Event const& iEvent, edm::EventSetup const& iSetup) override { return kContinue; }
36 
37  Status endOfLoop(edm::EventSetup const&, unsigned int iCount) override { return iCount == 2 ? kStop : kContinue; }
38 
39  private:
41  };
42 } // namespace edmtest
43 
44 using namespace edmtest;
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void startingNewLoop(unsigned int) override
#define DEFINE_FWK_LOOPER(type)
Status duringLoop(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
int iEvent
Definition: GenABIO.cc:224
edm::ESGetToken< Doodad, GadgetRcd > token_
~DoodadEDLooper() override=default
Transition
Definition: Transition.h:12
Status endOfLoop(edm::EventSetup const &, unsigned int iCount) override
void beginRun(edm::Run const &iRun, edm::EventSetup const &iSetup) override
Called after all event modules have processed the begin of a Run.
HLT enums.
DoodadEDLooper(edm::ParameterSet const &iPSet)
void beginOfJob(edm::EventSetup const &iSetup) override
Definition: Run.h:45