CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions
DTCalibDBUtils Class Reference

#include <DTCalibDBUtils.h>

Public Member Functions

 DTCalibDBUtils ()
 Constructor. More...
 
virtual ~DTCalibDBUtils ()
 Destructor. More...
 

Static Public Member Functions

template<typename T >
static void writeToDB (std::string record, T *payload)
 

Detailed Description

Simple interface to PoolDBOutputService to write objects to DB.

Author
G. Cerminara - INFN Torino

Definition at line 15 of file DTCalibDBUtils.h.

Constructor & Destructor Documentation

◆ DTCalibDBUtils()

DTCalibDBUtils::DTCalibDBUtils ( )

Constructor.

◆ ~DTCalibDBUtils()

virtual DTCalibDBUtils::~DTCalibDBUtils ( )
virtual

Destructor.

Member Function Documentation

◆ writeToDB()

template<typename T >
static void DTCalibDBUtils::writeToDB ( std::string  record,
T payload 
)
inlinestatic

Write the payload to the DB using PoolDBOutputService. New payload are created in the DB, existing payload are appended.

Definition at line 28 of file DTCalibDBUtils.h.

28  {
29  // Write the ttrig object to DB
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  }

References cond::service::PoolDBOutputService::beginOfTime(), gather_cfg::cout, cond::service::PoolDBOutputService::currentTime(), cppFunctionSkipper::exception, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), jets_cff::payload, GlobalPosition_Frontier_DevDB_cff::record, cms::Exception::what(), and cond::service::PoolDBOutputService::writeOne().

Referenced by DTLocalTriggerSynchTest::dqmEndJob(), DTTPGParamsWriter::endJob(), DTTTrigOffsetCalibration::endJob(), DTT0CalibrationRMS::endJob(), DTTTrigWriter::endJob(), DTTPDeadWriter::endJob(), DTTTrigCalibration::endJob(), and DTT0Calibration::endJob().

cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
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
jets_cff.payload
payload
Definition: jets_cff.py:32
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
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:63
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:128
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:217