CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTCalibDBUtils.h
Go to the documentation of this file.
1 #ifndef CalibMuonDTCalibDBUtils_H
2 #define CalibMuonDTCalibDBUtils_H
3 
12 #include <string>
15 
17 public:
20 
22  virtual ~DTCalibDBUtils();
23 
24  // Operations
25 
28  template<typename T>
29  static void writeToDB(std::string record, T* payload) {
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  }
53 
54 
55 protected:
56 
57 private:
58 
59 };
60 #endif
61 
virtual char const * what() const
Definition: Exception.cc:141
JetCorrectorParameters::Record record
Definition: classes.h:11
virtual ~DTCalibDBUtils()
Destructor.
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)
DTCalibDBUtils()
Constructor.
tuple cout
Definition: gather_cfg.py:121
long double T
static void writeToDB(std::string record, T *payload)