EgammaAnalysis
ElectronTools
plugins
GBRForestGetterFromDB.cc
Go to the documentation of this file.
1
#ifndef CalibratedElectronProducer_h
2
#define CalibratedElectronProducer_h
3
4
#include <iostream>
5
#include <string>
6
7
#include "
DataFormats/Common/interface/Handle.h
"
8
#include "
FWCore/Framework/interface/one/EDAnalyzer.h
"
9
#include "
FWCore/Framework/interface/Event.h
"
10
#include "
FWCore/Framework/interface/EventSetup.h
"
11
#include "
FWCore/Framework/interface/ESHandle.h
"
12
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
13
14
#include "
CondFormats/DataRecord/interface/GBRWrapperRcd.h
"
15
#include "
CondFormats/EgammaObjects/interface/GBRForest.h
"
16
#include <TFile.h>
17
18
class
GBRForestGetterFromDB
:
public
edm::one::EDAnalyzer
<> {
19
public
:
20
explicit
GBRForestGetterFromDB
(
const
edm::ParameterSet
&);
21
~GBRForestGetterFromDB
()
override
;
22
void
analyze
(
const
edm::Event
&,
const
edm::EventSetup
&)
override
;
23
24
private
:
25
std::string
theGBRForestName
;
26
std::string
theOutputFileName
;
27
std::string
theOutputObjectName
;
28
edm::ESHandle<GBRForest>
theGBRForestHandle
;
29
};
30
31
GBRForestGetterFromDB::GBRForestGetterFromDB
(
const
edm::ParameterSet
&conf)
32
: theGBRForestName(conf.getParameter<
std
::
string
>(
"grbForestName"
)),
33
theOutputFileName(conf.getUntrackedParameter<
std
::
string
>(
"outputFileName"
)),
34
theOutputObjectName(conf.getUntrackedParameter<
std
::
string
>(
35
"outputObjectName"
, theGBRForestName.
empty
() ?
"GBRForest"
: theGBRForestName)) {}
36
37
GBRForestGetterFromDB::~GBRForestGetterFromDB
() {}
38
39
void
GBRForestGetterFromDB::analyze
(
const
edm::Event
&
iEvent
,
const
edm::EventSetup
&iSetup) {
40
iSetup.
get
<
GBRWrapperRcd
>().
get
(
theGBRForestName
,
theGBRForestHandle
);
41
TFile *fOut = TFile::Open(
theOutputFileName
.c_str(),
"RECREATE"
);
42
fOut->WriteObject(
theGBRForestHandle
.
product
(),
theOutputObjectName
.c_str());
43
fOut->Close();
44
std::cout
<<
"Wrote output to "
<<
theOutputFileName
<< std::endl;
45
}
46
47
#include "
FWCore/Framework/interface/MakerMacros.h
"
48
DEFINE_FWK_MODULE
(
GBRForestGetterFromDB
);
49
50
#endif
edm::ESHandle::product
T const * product() const
Definition:
ESHandle.h:86
Handle.h
EDAnalyzer.h
ESHandle.h
GBRWrapperRcd.h
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
GBRForestGetterFromDB
Definition:
GBRForestGetterFromDB.cc:18
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
GBRForest.h
MakerMacros.h
GBRForestGetterFromDB::theGBRForestHandle
edm::ESHandle< GBRForest > theGBRForestHandle
Definition:
GBRForestGetterFromDB.cc:28
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
GBRForestGetterFromDB::theGBRForestName
std::string theGBRForestName
Definition:
GBRForestGetterFromDB.cc:25
edm::ESHandle< GBRForest >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
GBRForestGetterFromDB::theOutputFileName
std::string theOutputFileName
Definition:
GBRForestGetterFromDB.cc:26
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
GBRForestGetterFromDB::theOutputObjectName
std::string theOutputObjectName
Definition:
GBRForestGetterFromDB.cc:27
iEvent
int iEvent
Definition:
GenABIO.cc:224
GBRForestGetterFromDB::~GBRForestGetterFromDB
~GBRForestGetterFromDB() override
Definition:
GBRForestGetterFromDB.cc:37
edm::EventSetup
Definition:
EventSetup.h:57
get
#define get
GBRForestGetterFromDB::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
GBRForestGetterFromDB.cc:39
std
Definition:
JetResolutionObject.h:76
GBRForestGetterFromDB::GBRForestGetterFromDB
GBRForestGetterFromDB(const edm::ParameterSet &)
Definition:
GBRForestGetterFromDB.cc:31
relativeConstraints.empty
bool empty
Definition:
relativeConstraints.py:46
GBRWrapperRcd
Definition:
GBRWrapperRcd.h:24
EventSetup.h
ParameterSet.h
edm::Event
Definition:
Event.h:73
Generated for CMSSW Reference Manual by
1.8.16