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 ( )

Constructor.

virtual DTCalibDBUtils::~DTCalibDBUtils ( )
virtual

Destructor.

Member Function Documentation

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.

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, record, cms::Exception::what(), and cond::service::PoolDBOutputService::writeOne().

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

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 
51  }
Base exception class for the object to relational access.
Definition: Exception.h:11
JetCorrectorParameters::Record record
Definition: classes.h:7
char const * what() const override
Definition: Exception.cc:141
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:46
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
long double T