Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // This example runs the CDBInterface like in the real reconstruction
0002 // once the CDBInterface instance is created it registers itself with the 
0003 // Fun4AllServer and creates (or adds to) the CdbUrl Node which contains a 
0004 // record of the files and timestamps which were used
0005 #ifndef TESTCDBREAD_C
0006 #define TESTCDBREAD_C
0007 
0008 #include <ffamodules/CDBInterface.h>
0009 
0010 #include <fun4all/Fun4AllServer.h>
0011 #include <fun4all/Fun4AllDummyInputManager.h>
0012 
0013 #include <phool/recoConsts.h>
0014 
0015 #include <Rtypes.h>
0016 #include <TSystem.h>
0017 
0018 R__LOAD_LIBRARY(libffamodules.so)
0019 R__LOAD_LIBRARY(libphool.so)
0020 
0021 void TestCDBSubsysReco()
0022 {
0023   recoConsts *rc = recoConsts::instance();
0024 // please choose a unique name, if it is your username it's easier to see who created it
0025   rc->set_StringFlag("CDB_GLOBALTAG","pinkenbu"); 
0026   rc->set_uint64Flag("TIMESTAMP",6);
0027   Fun4AllServer *se = Fun4AllServer::instance();
0028   se->Verbosity(1);
0029 
0030   CDBInterface *cdb = CDBInterface::instance();
0031   std::cout << "using insert timestamp to retrieve" << std::endl;
0032   rc->set_uint64Flag("TIMESTAMP",10);
0033   std::cout << cdb->getUrl("TestBeginValidity") << std::endl;
0034   std::cout << "using larger timestamp to retrieve" << std::endl;
0035   rc->set_uint64Flag("TIMESTAMP",100);
0036   std::cout << cdb->getUrl("TestBeginValidity") << std::endl;
0037   std::cout << "using smaller timestamp to retrieve" << std::endl;
0038   rc->set_uint64Flag("TIMESTAMP",1);
0039   std::cout << cdb->getUrl("TestBeginValidity") << std::endl;
0040 
0041   std::cout << "using timestamp in range to retrieve calibration" << std::endl;
0042   rc->set_uint64Flag("TIMESTAMP",15);
0043   std::cout << cdb->getUrl("TestBeginEndValidity") << std::endl;
0044   std::cout << "using timestamp outside range to retrieve calibration" << std::endl;
0045   rc->set_uint64Flag("TIMESTAMP",25);
0046   std::cout << cdb->getUrl("TestBeginEndValidity") << std::endl;
0047 
0048   Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE");
0049   in->Verbosity(1);
0050   se->registerInputManager(in);
0051   se->run(1);
0052   CDBInterface::instance()->Print(); // print used DB files
0053   se->End();
0054   se->Print("NODETREE");
0055   std::cout << "All done" << std::endl;
0056   delete se;
0057 
0058   gSystem->Exit(0);
0059   return;
0060 }
0061 
0062 #endif
0063