Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:24:02

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 <Rtypes.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)
0024   {
0025     uti = new CDBUtils();
0026   }
0027   uti->listGlobalTags();
0028   return;
0029 }
0030 
0031 void listPayloadTypes()
0032 {
0033   if (!uti)
0034   {
0035     uti = new CDBUtils();
0036   }
0037   uti->listPayloadTypes();
0038   return;
0039 }
0040 
0041 void listPayloadIOVs(uint64_t iov)
0042 {
0043   if (!uti)
0044   {
0045     uti = new CDBUtils();
0046   }
0047   uti->listPayloadIOVs(iov);
0048   return;
0049 }
0050 
0051 void createGlobalTag(const std::string &tagname)
0052 {
0053   if (!uti)
0054   {
0055     uti = new CDBUtils();
0056   }
0057   uti->createGlobalTag(tagname);
0058   return;
0059 }
0060 
0061 void deleteGlobalTag(const std::string &tagname)
0062 {
0063   if (!uti)
0064   {
0065     uti = new CDBUtils();
0066   }
0067   uti->deleteGlobalTag(tagname);
0068   return;
0069 }
0070 
0071 void lockGlobalTag(const std::string &tagname)
0072 {
0073   if (!uti)
0074   {
0075     uti = new CDBUtils();
0076   }
0077   uti->lockGlobalTag(tagname);
0078   return;
0079 }
0080 
0081 void unlockGlobalTag(const std::string &tagname)
0082 {
0083   if (!uti)
0084   {
0085     uti = new CDBUtils();
0086   }
0087   uti->unlockGlobalTag(tagname);
0088   return;
0089 }
0090 
0091 int setGlobalTag(const std::string &tagname)
0092 {
0093   if (!uti)
0094   {
0095     uti = new CDBUtils();
0096   }
0097   int iret = uti->setGlobalTag(tagname);
0098   return iret;
0099 }
0100 
0101 int cloneGlobalTag(const std::string &source, const std::string &target)
0102 {
0103   if (!uti)
0104   {
0105     uti = new CDBUtils();
0106   }
0107   int iret = uti->cloneGlobalTag(source, target);
0108   return iret;
0109 }
0110 
0111 int createPayloadType(const std::string &pt)
0112 {
0113   if (!uti)
0114   {
0115     uti = new CDBUtils();
0116   }
0117   int iret = uti->createPayloadType(pt);
0118   return iret;
0119 }
0120 
0121 int insertPayload(const std::string &pl_type, const std::string &file_url, uint64_t iov_start)
0122 {
0123   if (!uti)
0124   {
0125     uti = new CDBUtils();
0126   }
0127   if (uti->isGlobalTagSet())
0128   {
0129     uti->insertPayload(pl_type, file_url, iov_start);
0130   }
0131   return 0;
0132 }
0133 
0134 int insertPayload(const std::string &pl_type, const std::string &file_url, uint64_t iov_start, uint64_t iov_end)
0135 {
0136   if (!uti)
0137   {
0138     uti = new CDBUtils();
0139   }
0140   if (uti->isGlobalTagSet())
0141   {
0142     uti->insertPayload(pl_type, file_url, iov_start, iov_end);
0143   }
0144   return 0;
0145 }
0146 
0147 std::string getCalibration(const std::string &pl_type, uint64_t iov)
0148 {
0149   if (!uti)
0150   {
0151     uti = new CDBUtils();
0152   }
0153   return uti->getUrl(pl_type, iov);
0154 }
0155 
0156 void clearCache()
0157 {
0158   if (!uti)
0159   {
0160     uti = new CDBUtils();
0161   }
0162   uti->clearCache();
0163 }
0164 
0165 void Verbosity(int verb)
0166 {
0167   if (!uti)
0168   {
0169     uti = new CDBUtils();
0170   }
0171   uti->Verbosity(verb);
0172 }
0173 
0174 int deletePayloadIOV(const std::string &pl_type, uint64_t iov_start)
0175 {
0176   if (!uti)
0177   {
0178     uti = new CDBUtils();
0179   }
0180   return uti->deletePayloadIOV(pl_type, iov_start);
0181 }
0182 
0183 int deletePayloadIOV(const std::string &pl_type, uint64_t iov_start, uint64_t iov_end)
0184 {
0185   if (!uti)
0186   {
0187     uti = new CDBUtils();
0188   }
0189   return uti->deletePayloadIOV(pl_type, iov_start, iov_end);
0190 }
0191 
0192 #endif