File indexing completed on 2025-08-03 08:20:24
0001 #ifndef CDBUTILS_C
0002 #define CDBUTILS_C
0003
0004 #include <sphenixnpc/CDBUtils.h>
0005 #include <sphenixnpc/SphenixClient.h>
0006
0007 #include <phool/recoConsts.h>
0008
0009 #include <TROOT.h> // for R__LOAD_LIBRARY
0010
0011 R__LOAD_LIBRARY(libsphenixnpc.so)
0012 R__LOAD_LIBRARY(libphool.so)
0013
0014 CDBUtils *uti = nullptr;
0015
0016 CDBUtils *getCDBUtils()
0017 {
0018 return uti;
0019 }
0020
0021 void listGlobalTags()
0022 {
0023 if (!uti) uti = new CDBUtils();
0024 uti->listGlobalTags();
0025 return;
0026 }
0027
0028 void listPayloadTypes()
0029 {
0030 if (!uti) uti = new CDBUtils();
0031 uti->listPayloadTypes();
0032 return;
0033 }
0034
0035 void listPayloadIOVs(uint64_t iov)
0036 {
0037 if (!uti) uti = new CDBUtils();
0038 uti->listPayloadIOVs(iov);
0039 return;
0040 }
0041
0042 void createGlobalTag(const std::string &tagname)
0043 {
0044 if (!uti) uti = new CDBUtils();
0045 uti->createGlobalTag(tagname);
0046 return;
0047 }
0048
0049 void deleteGlobalTag(const std::string &tagname)
0050 {
0051 if (!uti) uti = new CDBUtils();
0052 uti->deleteGlobalTag(tagname);
0053 return;
0054 }
0055
0056 void lockGlobalTag(const std::string &tagname)
0057 {
0058 if (!uti) uti = new CDBUtils();
0059 uti->lockGlobalTag(tagname);
0060 return;
0061 }
0062
0063 void unlockGlobalTag(const std::string &tagname)
0064 {
0065 if (!uti) uti = new CDBUtils();
0066 uti->unlockGlobalTag(tagname);
0067 return;
0068 }
0069
0070 int setGlobalTag(const std::string &tagname)
0071 {
0072 if (!uti) uti = new CDBUtils();
0073 int iret = uti->setGlobalTag(tagname);
0074 return iret;
0075 }
0076
0077 int cloneGlobalTag(const std::string &source, const std::string &target)
0078 {
0079 if (!uti) uti = new CDBUtils();
0080 int iret = uti->cloneGlobalTag(source, target);
0081 return iret;
0082 }
0083
0084 int createPayloadType(const std::string &pt)
0085 {
0086 if (!uti) uti = new CDBUtils();
0087 int iret = uti->createPayloadType(pt);
0088 return iret;
0089 }
0090
0091 int insertPayload(const std::string &pl_type, const std::string &file_url, uint64_t iov_start)
0092 {
0093 if (!uti) uti = new CDBUtils();
0094 if (uti->isGlobalTagSet())
0095 {
0096 uti->insertPayload(pl_type, file_url, iov_start);
0097 }
0098 return 0;
0099 }
0100
0101 int insertPayload(const std::string &pl_type, const std::string &file_url, uint64_t iov_start, uint64_t iov_end)
0102 {
0103 if (!uti) uti = new CDBUtils();
0104 if (uti->isGlobalTagSet())
0105 {
0106 uti->insertPayload(pl_type, file_url, iov_start, iov_end);
0107 }
0108 return 0;
0109 }
0110
0111 std::string getCalibration(const std::string &pl_type, uint64_t iov)
0112 {
0113 if (!uti) uti = new CDBUtils();
0114 return uti->getUrl(pl_type, iov);
0115 }
0116
0117 void clearCache()
0118 {
0119 if (!uti) uti = new CDBUtils();
0120 return uti->clearCache();
0121 }
0122
0123 void Verbosity(int verb)
0124 {
0125 if (!uti) uti = new CDBUtils();
0126 return uti->Verbosity(verb);
0127 }
0128
0129 int deletePayloadIOV(const std::string &pl_type, uint64_t iov_start)
0130 {
0131 if (!uti) uti = new CDBUtils();
0132 return uti->deletePayloadIOV(pl_type, iov_start);
0133 }
0134
0135 int deletePayloadIOV(const std::string &pl_type, uint64_t iov_start, uint64_t iov_end)
0136 {
0137 if (!uti) uti = new CDBUtils();
0138 return uti->deletePayloadIOV(pl_type, iov_start, iov_end);
0139 }
0140
0141 #endif