CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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>
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 protected:
53 private:
54 };
55 #endif
Base exception class for the object to relational access.
Definition: Exception.h:11
virtual ~DTCalibDBUtils()
Destructor.
Hash writeOne(const T *payloadPtr, Time_t time, const std::string &recordName)
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:40
char const * what() const noexceptoverride
Definition: Exception.cc:103
DTCalibDBUtils()
Constructor.
tuple cout
Definition: gather_cfg.py:144
long double T
static void writeToDB(std::string record, T *payload)