Go to the documentation of this file.00001 #ifndef CalibMuonDTCalibDBUtils_H
00002 #define CalibMuonDTCalibDBUtils_H
00003
00012 #include <string>
00013 #include "FWCore/ServiceRegistry/interface/Service.h"
00014 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
00015
00016 class DTCalibDBUtils {
00017 public:
00019 DTCalibDBUtils();
00020
00022 virtual ~DTCalibDBUtils();
00023
00024
00025
00028 template<typename T>
00029 static void writeToDB(std::string record, T* payload) {
00030
00031 edm::Service<cond::service::PoolDBOutputService> dbOutputSvc;
00032 if(dbOutputSvc.isAvailable()){
00033 try{
00034 if(dbOutputSvc->isNewTagRequest(record)){
00035
00036 dbOutputSvc->writeOne<T>(payload, dbOutputSvc->beginOfTime(),record);
00037 }else{
00038
00039 dbOutputSvc->writeOne<T>(payload, dbOutputSvc->currentTime(),record);
00040 }
00041 }catch(const cond::Exception& er){
00042 std::cout << er.what() << std::endl;
00043 }catch(const std::exception& er){
00044 std::cout << "[DTCalibDBUtils] caught std::exception " << er.what() << std::endl;
00045 }catch(...){
00046 std::cout << "[DTCalibDBUtils] Funny error" << std::endl;
00047 }
00048 }else{
00049 std::cout << "Service PoolDBOutputService is unavailable" << std::endl;
00050 }
00051
00052 }
00053
00054
00055 protected:
00056
00057 private:
00058
00059 };
00060 #endif
00061