src
CondTools
JetMET
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/one/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::one::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
const
JME::JetResolutionObject
jerObject(
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
->writeOneIOV(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
);
JetResolutionDBWriter::JetResolutionDBWriter
JetResolutionDBWriter(const edm::ParameterSet &)
Definition:
JetResolutionDBWriter.cc:31
JetResolutionDBWriter::beginJob
void beginJob() override
Definition:
JetResolutionDBWriter.cc:37
edm::Service< cond::service::PoolDBOutputService >
JetResolutionObject.h
Event.h
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
JetResolutionDBWriter::m_path
std::string m_path
Definition:
JetResolutionDBWriter.cc:27
Frameworkfwd.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
JetResolutionDBWriter::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
JetResolutionDBWriter.cc:21
ParameterSet.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
JetResolutionDBWriter
Definition:
JetResolutionDBWriter.cc:17
cond::Time_t
unsigned long long Time_t
Definition:
Time.h:14
JetResolutionDBWriter::m_record
std::string m_record
Definition:
JetResolutionDBWriter.cc:26
PoolDBOutputService.h
EDMException.h
Service.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::EventSetup
Definition:
EventSetup.h:56
JetResolutionDBWriter::~JetResolutionDBWriter
~JetResolutionDBWriter() override
Definition:
JetResolutionDBWriter.cc:23
edm::FileInPath
Definition:
FileInPath.h:61
JME::JetResolutionObject
Definition:
JetResolutionObject.h:117
JetResolutionDBWriter::endJob
void endJob() override
Definition:
JetResolutionDBWriter.cc:22
EDAnalyzer.h
edm::ParameterSet
Definition:
ParameterSet.h:48
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
edm::Event
Definition:
Event.h:73
MakerMacros.h
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
contentValuesFiles.fullPath
fullPath
Definition:
contentValuesFiles.py:64
Generated for CMSSW Reference Manual by
1.8.14