CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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.

Date:
2007/01/22 17:08:15
Revision:
1.2
Author
G. Cerminara - INFN Torino

Definition at line 16 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 29 of file DTCalibDBUtils.h.

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

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

29  {
30  // Write the ttrig object to DB
32  if(dbOutputSvc.isAvailable()){
33  try{
34  if(dbOutputSvc->isNewTagRequest(record)){
35  //create mode
36  dbOutputSvc->writeOne<T>(payload, dbOutputSvc->beginOfTime(),record);
37  }else{
38  //append mode. Note: correct PoolDBESSource must be loaded
39  dbOutputSvc->writeOne<T>(payload, dbOutputSvc->currentTime(),record);
40  }
41  }catch(const cond::Exception& er){
42  std::cout << er.what() << std::endl;
43  }catch(const std::exception& er){
44  std::cout << "[DTCalibDBUtils] caught std::exception " << er.what() << std::endl;
45  }catch(...){
46  std::cout << "[DTCalibDBUtils] Funny error" << std::endl;
47  }
48  }else{
49  std::cout << "Service PoolDBOutputService is unavailable" << std::endl;
50  }
51 
52  }
virtual char const * what() const
Definition: Exception.cc:97
JetCorrectorParameters::Record record
Definition: classes.h:11
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:47
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
tuple cout
Definition: gather_cfg.py:41