Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef TESTCDBREAD_C
0002 #define TESTCDBREAD_C
0003 
0004 #include <ffamodules/CDBInterface.h>
0005 
0006 #include <phool/recoConsts.h>
0007 
0008 #include <TSystem.h>
0009 
0010 #include <iostream>
0011 
0012 R__LOAD_LIBRARY(libffamodules.so)
0013 R__LOAD_LIBRARY(libphool.so)
0014 
0015 void TestCDBRead()
0016 {
0017   recoConsts *rc = recoConsts::instance();
0018 // please choose a unique name, if it is your username it's easier to see who created it
0019   rc->set_StringFlag("CDB_GLOBALTAG","pinkenbu"); 
0020   rc->set_uint64Flag("TIMESTAMP",6);
0021 // 1000000 is the insert timestamp. Higher timestamps work, lower time stamps do not
0022   CDBInterface *cdb = CDBInterface::instance();
0023   std::cout << "using insert timestamp to retrieve no end time payload" << std::endl;
0024   rc->set_uint64Flag("TIMESTAMP",10);
0025   std::cout << cdb->getUrl("TestBeginValidity") << std::endl;
0026   std::cout << "using larger timestamp to retrieve no end time payload" << std::endl;
0027   rc->set_uint64Flag("TIMESTAMP",100);
0028   std::cout << cdb->getUrl("TestBeginValidity") << std::endl;
0029   std::cout << "using smaller timestamp to retrieve no end time payload" << std::endl;
0030   rc->set_uint64Flag("TIMESTAMP",1);
0031   std::cout << cdb->getUrl("TestBeginValidity") << std::endl;
0032 
0033   std::cout << "using timestamp in range to retrieve calibration with end time" << std::endl;
0034   rc->set_uint64Flag("TIMESTAMP",15);
0035   std::cout << cdb->getUrl("TestBeginEndValidity") << std::endl;
0036   std::cout << "using timestamp outside range to retrieve calibration with end time" << std::endl;
0037   rc->set_uint64Flag("TIMESTAMP",25);
0038   std::cout << cdb->getUrl("TestBeginEndValidity") << std::endl;
0039   gSystem->Exit(0);
0040   return;
0041 }
0042 
0043 #endif
0044