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 
10 #include <iostream>
11 #include <string>
14 
16 public:
19 
21  virtual ~DTCalibDBUtils();
22 
23  // Operations
24 
27  template<typename T>
28  static void writeToDB(std::string record, T* payload) {
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  }
52 
53 
54 protected:
55 
56 private:
57 
58 };
59 #endif
60 
virtual char const * what() const
Definition: Exception.cc:141
Base exception class for the object to relational access.
Definition: Exception.h:11
JetCorrectorParameters::Record record
Definition: classes.h:7
virtual ~DTCalibDBUtils()
Destructor.
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)
DTCalibDBUtils()
Constructor.
tuple cout
Definition: gather_cfg.py:145
long double T
static void writeToDB(std::string record, T *payload)