CalibMuon
DTCalibration
interface
DTCalibDBUtils.h
Go to the documentation of this file.
1
#ifndef CalibMuonDTCalibDBUtils_H
2
#define CalibMuonDTCalibDBUtils_H
3
10
#include <iostream>
11
#include <string>
12
#include "
FWCore/ServiceRegistry/interface/Service.h
"
13
#include "
CondCore/DBOutputService/interface/PoolDBOutputService.h
"
14
15
class
DTCalibDBUtils
{
16
public
:
18
DTCalibDBUtils
();
19
21
virtual
~DTCalibDBUtils
();
22
23
// Operations
24
27
template
<
typename
T>
28
static
void
writeToDB
(
std::string
record
,
T
*
payload
) {
29
// Write the ttrig object to DB
30
edm::Service<cond::service::PoolDBOutputService>
dbOutputSvc;
31
if
(dbOutputSvc.
isAvailable
()) {
32
try
{
33
if
(dbOutputSvc->
isNewTagRequest
(
record
)) {
34
//create mode
35
dbOutputSvc->
writeOne
<
T
>(
payload
, dbOutputSvc->
beginOfTime
(),
record
);
36
}
else
{
37
//append mode. Note: correct PoolDBESSource must be loaded
38
dbOutputSvc->
writeOne
<
T
>(
payload
, dbOutputSvc->
currentTime
(),
record
);
39
}
40
}
catch
(
const
cond::Exception
& er) {
41
std::cout
<< er.
what
() << std::endl;
42
}
catch
(
const
std::exception
& er) {
43
std::cout
<<
"[DTCalibDBUtils] caught std::exception "
<< er.what() << std::endl;
44
}
catch
(...) {
45
std::cout
<<
"[DTCalibDBUtils] Funny error"
<< std::endl;
46
}
47
}
else
{
48
std::cout
<<
"Service PoolDBOutputService is unavailable"
<< std::endl;
49
}
50
}
51
52
protected
:
53
private
:
54
};
55
#endif
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition:
PoolDBOutputService.cc:187
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
GlobalPosition_Frontier_DevDB_cff.record
record
Definition:
GlobalPosition_Frontier_DevDB_cff.py:10
cms::Exception::what
char const * what() const noexcept override
Definition:
Exception.cc:103
edm::Service::isAvailable
bool isAvailable() const
Definition:
Service.h:40
PoolDBOutputService.h
Service.h
jets_cff.payload
payload
Definition:
jets_cff.py:34
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
DTCalibDBUtils::DTCalibDBUtils
DTCalibDBUtils()
Constructor.
cppFunctionSkipper.exception
exception
Definition:
cppFunctionSkipper.py:10
DTCalibDBUtils
Definition:
DTCalibDBUtils.h:15
edm::Service< cond::service::PoolDBOutputService >
cond::persistency::Exception
Base exception class for the object to relational access.
Definition:
Exception.h:11
T
long double T
Definition:
Basic3DVectorLD.h:48
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition:
PoolDBOutputService.h:57
DTCalibDBUtils::~DTCalibDBUtils
virtual ~DTCalibDBUtils()
Destructor.
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition:
PoolDBOutputService.cc:100
DTCalibDBUtils::writeToDB
static void writeToDB(std::string record, T *payload)
Definition:
DTCalibDBUtils.h:28
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition:
PoolDBOutputService.cc:189
Generated for CMSSW Reference Manual by
1.8.16