CondTools
CTPPS
plugins
PPSTimingCalibrationWriter.cc
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* This is a part of TOTEM/PPS offline software.
4
* Author:
5
* Laurent Forthomme (laurent.forthomme@cern.ch)
6
*
7
****************************************************************************/
8
9
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
10
#include "
FWCore/Framework/interface/one/EDAnalyzer.h
"
11
#include "
FWCore/Framework/interface/Event.h
"
12
#include "
FWCore/Framework/interface/EventSetup.h
"
13
#include "
FWCore/Framework/interface/ESHandle.h
"
14
#include "
FWCore/Framework/interface/MakerMacros.h
"
15
16
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
17
#include "
FWCore/ServiceRegistry/interface/Service.h
"
18
19
#include "
CondCore/DBOutputService/interface/PoolDBOutputService.h
"
20
21
#include "
CondFormats/PPSObjects/interface/PPSTimingCalibration.h
"
22
#include "
CondFormats/DataRecord/interface/PPSTimingCalibrationRcd.h
"
23
24
#include <memory>
25
26
class
PPSTimingCalibrationWriter
:
public
edm::one::EDAnalyzer
<> {
27
public
:
28
explicit
PPSTimingCalibrationWriter
(
const
edm::ParameterSet
&)
29
:
tokenCalibration_
(esConsumes<PPSTimingCalibration, PPSTimingCalibrationRcd>()) {}
30
31
private
:
32
void
beginJob
()
override
{}
33
void
analyze
(
const
edm::Event
&,
const
edm::EventSetup
&)
override
;
34
void
endJob
()
override
{}
35
36
edm::ESGetToken<PPSTimingCalibration, PPSTimingCalibrationRcd>
tokenCalibration_
;
37
};
38
39
void
PPSTimingCalibrationWriter::analyze
(
const
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
40
// get timing calibration parameters
41
edm::ESHandle<PPSTimingCalibration>
hTimingCalib = iSetup.
getHandle
(
tokenCalibration_
);
42
43
// store the calibration into a DB object
44
edm::Service<cond::service::PoolDBOutputService>
poolDbService;
45
if
(poolDbService.
isAvailable
())
46
poolDbService->
writeOne
(hTimingCalib.
product
(), poolDbService->
currentTime
(),
"PPSTimingCalibrationRcd"
);
47
else
48
throw
cms::Exception
(
"PPSTimingCalibrationWriter"
) <<
"PoolDBService required."
;
49
}
50
51
DEFINE_FWK_MODULE
(
PPSTimingCalibrationWriter
);
edm::ESHandle::product
T const * product() const
Definition:
ESHandle.h:86
PPSTimingCalibrationWriter::tokenCalibration_
edm::ESGetToken< PPSTimingCalibration, PPSTimingCalibrationRcd > tokenCalibration_
Definition:
PPSTimingCalibrationWriter.cc:40
EDAnalyzer.h
ESHandle.h
PPSTimingCalibrationWriter::beginJob
void beginJob() override
Definition:
PPSTimingCalibrationWriter.cc:36
PPSTimingCalibrationWriter::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
PPSTimingCalibrationWriter.cc:38
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
edm::Service::isAvailable
bool isAvailable() const
Definition:
Service.h:40
PPSTimingCalibrationWriter::PPSTimingCalibrationWriter
PPSTimingCalibrationWriter(const edm::ParameterSet &)
Definition:
PPSTimingCalibrationWriter.cc:32
MakerMacros.h
PoolDBOutputService.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
Service.h
edm::ESHandle
Definition:
DTSurvey.h:22
edm::ParameterSet
Definition:
ParameterSet.h:47
PPSTimingCalibrationWriter::endJob
void endJob() override
Definition:
PPSTimingCalibrationWriter.cc:38
Event.h
edm::Service< cond::service::PoolDBOutputService >
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition:
EventSetup.h:155
edm::EventSetup
Definition:
EventSetup.h:58
PPSTimingCalibration.h
edm::ESGetToken< PPSTimingCalibration, PPSTimingCalibrationRcd >
Frameworkfwd.h
Exception
Definition:
hltDiff.cc:245
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition:
PoolDBOutputService.h:63
PPSTimingCalibrationRcd.h
EventSetup.h
PPSTimingCalibrationWriter
Definition:
PPSTimingCalibrationWriter.cc:25
ParameterSet.h
edm::Event
Definition:
Event.h:73
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition:
PoolDBOutputService.cc:217
Generated for CMSSW Reference Manual by
1.8.16