CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions

DTCalibDBUtils Class Reference

#include <DTCalibDBUtils.h>

List of all members.

Public Member Functions

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

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:
2008/03/06 14:41:12
Revision:
1.3
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 
) [inline, static]

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 gather_cfg::cout, exception, edm::Service< T >::isAvailable(), record, and cms::Exception::what().

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

                                                      {
    // Write the ttrig object to DB
    edm::Service<cond::service::PoolDBOutputService> dbOutputSvc;
      if(dbOutputSvc.isAvailable()){
        try{
          if(dbOutputSvc->isNewTagRequest(record)){
            //create mode
            dbOutputSvc->writeOne<T>(payload, dbOutputSvc->beginOfTime(),record);
          }else{
            //append mode. Note: correct PoolDBESSource must be loaded
            dbOutputSvc->writeOne<T>(payload, dbOutputSvc->currentTime(),record);
          }
        }catch(const cond::Exception& er){
          std::cout << er.what() << std::endl;
        }catch(const std::exception& er){
          std::cout << "[DTCalibDBUtils] caught std::exception " << er.what() << std::endl;
        }catch(...){
          std::cout << "[DTCalibDBUtils] Funny error" << std::endl;
        }
      }else{
        std::cout << "Service PoolDBOutputService is unavailable" << std::endl;
      }
    
  }