JetMETCorrections
Modules
plugins
JetResolutionDBWriter.cc
Go to the documentation of this file.
1
// Author: Sébastien Brochet
2
3
#include <memory>
4
#include <string>
5
#include <fstream>
6
#include <iostream>
7
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
8
#include "
FWCore/Framework/interface/EDAnalyzer.h
"
9
#include "
FWCore/Framework/interface/Event.h
"
10
#include "
FWCore/Framework/interface/MakerMacros.h
"
11
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
12
#include "
FWCore/ServiceRegistry/interface/Service.h
"
13
#include "
FWCore/Utilities/interface/EDMException.h
"
14
#include "
CondCore/DBOutputService/interface/PoolDBOutputService.h
"
15
#include "
CondFormats/JetMETObjects/interface/JetResolutionObject.h
"
16
17
class
JetResolutionDBWriter
:
public
edm::EDAnalyzer
{
18
public
:
19
JetResolutionDBWriter
(
const
edm::ParameterSet
&);
20
void
beginJob
()
override
;
21
void
analyze
(
const
edm::Event
&,
const
edm::EventSetup
&)
override
{}
22
void
endJob
()
override
{}
23
~JetResolutionDBWriter
()
override
{}
24
25
private
:
26
std::string
m_record
;
27
std::string
m_path
;
28
};
29
30
// Constructor
31
JetResolutionDBWriter::JetResolutionDBWriter
(
const
edm::ParameterSet
& pSet) {
32
m_record
= pSet.
getUntrackedParameter
<
std::string
>(
"record"
);
33
m_path
= pSet.
getUntrackedParameter
<
edm::FileInPath
>(
"file"
).
fullPath
();
34
}
35
36
// Begin Job
37
void
JetResolutionDBWriter::beginJob
() {
38
std::cout
<<
"Loading data from '"
<<
m_path
<<
"'"
<< std::endl;
39
40
JME::JetResolutionObject
* jerObject =
new
JME::JetResolutionObject
(
m_path
);
41
42
std::cout
<<
"Opening PoolDBOutputService"
<< std::endl;
43
44
// now write it into the DB
45
edm::Service<cond::service::PoolDBOutputService>
s
;
46
if
(
s
.isAvailable()) {
47
std::cout
<<
"Setting up payload record "
<<
m_record
<< std::endl;
48
cond::Time_t
sinceTime =
s
->isNewTagRequest(
m_record
) ?
s
->beginOfTime() :
s
->currentTime();
49
s
->writeOne<
JME::JetResolutionObject
>(jerObject, sinceTime,
m_record
);
50
51
std::cout
<<
"Object saved into the database with the record: "
<<
m_record
<< std::endl;
52
}
53
}
54
55
DEFINE_FWK_MODULE
(
JetResolutionDBWriter
);
JetResolutionObject.h
JetResolutionDBWriter::m_path
std::string m_path
Definition:
JetResolutionDBWriter.cc:27
JME::JetResolutionObject
Definition:
JetResolutionObject.h:116
contentValuesFiles.fullPath
fullPath
Definition:
contentValuesFiles.py:64
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
edm::EDAnalyzer
Definition:
EDAnalyzer.h:28
JetResolutionDBWriter
Definition:
JetResolutionDBWriter.cc:17
EDMException.h
edm::FileInPath
Definition:
FileInPath.h:61
MakerMacros.h
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
PoolDBOutputService.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
Service.h
edm::ParameterSet
Definition:
ParameterSet.h:47
JetResolutionDBWriter::m_record
std::string m_record
Definition:
JetResolutionDBWriter.cc:26
Event.h
cond::Time_t
unsigned long long Time_t
Definition:
Time.h:14
JetResolutionDBWriter::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
JetResolutionDBWriter.cc:21
edm::Service< cond::service::PoolDBOutputService >
edm::EventSetup
Definition:
EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
JetResolutionDBWriter::~JetResolutionDBWriter
~JetResolutionDBWriter() override
Definition:
JetResolutionDBWriter.cc:23
Frameworkfwd.h
JetResolutionDBWriter::endJob
void endJob() override
Definition:
JetResolutionDBWriter.cc:22
ParameterSet.h
JetResolutionDBWriter::beginJob
void beginJob() override
Definition:
JetResolutionDBWriter.cc:37
JetResolutionDBWriter::JetResolutionDBWriter
JetResolutionDBWriter(const edm::ParameterSet &)
Definition:
JetResolutionDBWriter.cc:31
edm::Event
Definition:
Event.h:73
Generated for CMSSW Reference Manual by
1.8.16