-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
DoodadESProducer.cc
95 lines (73 loc) · 2.12 KB
/
DoodadESProducer.cc
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
// -*- C++ -*-
//
// Package: DoodadESProducer
// Class: DoodadESProducer
//
/**\class DoodadESProducer DoodadESProducer.h test/DoodadESProducer/interface/DoodadESProducer.h
Description: <one line class summary>
Implementation:
<Notes on implementation>
*/
//
// Original Author: Chris Jones
// Created: Fri Jun 24 14:33:04 EDT 2005
//
//
// user include files
#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/ModuleFactory.h"
#include "Doodad.h"
#include "GadgetRcd.h"
// system include files
#include <memory>
#include <stdexcept>
//
// class decleration
//
namespace edmtest {
class DoodadESProducer : public edm::ESProducer {
public:
DoodadESProducer(edm::ParameterSet const&);
~DoodadESProducer() override;
typedef std::unique_ptr<Doodad> ReturnType;
ReturnType produce(GadgetRcd const&);
private:
// ----------member data ---------------------------
bool exceptionInformation_;
};
//
// constants, enums and typedefs
//
//
// static data member definitions
//
// constructors and destructor
//
DoodadESProducer::DoodadESProducer(edm::ParameterSet const& iConfig)
: exceptionInformation_(iConfig.getUntrackedParameter<bool>("throwException", false)) {
//the following line is needed to tell the framework what
// data is being produced
setWhatProduced(this);
//now do what ever other initialization is needed
}
DoodadESProducer::~DoodadESProducer() {
// do anything here that needs to be done at desctruction time
// (e.g. close files, deallocate resources etc.)
}
//
// member functions
//
// ------------ method called to produce the data ------------
DoodadESProducer::ReturnType DoodadESProducer::produce(GadgetRcd const& /*iRecord*/) {
if (exceptionInformation_) {
throw std::runtime_error("test exception catching");
}
using namespace edmtest;
auto pDoodad = std::make_unique<Doodad>();
pDoodad->a = 1;
return pDoodad;
}
} // namespace edmtest
using namespace edmtest;
//define this as a plug-in
DEFINE_FWK_EVENTSETUP_MODULE(DoodadESProducer);