Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:24

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 R__LOAD_LIBRARY(libffamodules.so)
0016 R__LOAD_LIBRARY(libphool.so)
0017 
0018 void TestCDBSubsysReco()
0019 {
0020   recoConsts *rc = recoConsts::instance();
0021 // please choose a unique name, if it is your username it's easier to see who created it
0022   rc->set_StringFlag("CDB_GLOBALTAG","pinkenbu"); 
0023   rc->set_uint64Flag("TIMESTAMP",6);
0024   Fun4AllServer *se = Fun4AllServer::instance();
0025   se->Verbosity(1);
0026 
0027   CDBInterface *cdb = CDBInterface::instance();
0028   cout << "using insert timestamp to retrieve" << endl;
0029   rc->set_uint64Flag("TIMESTAMP",10);
0030   cout << cdb->getUrl("TestBeginValidity") << endl;
0031   cout << "using larger timestamp to retrieve" << endl;
0032   rc->set_uint64Flag("TIMESTAMP",100);
0033   cout << cdb->getUrl("TestBeginValidity") << endl;
0034   cout << "using smaller timestamp to retrieve" << endl;
0035   rc->set_uint64Flag("TIMESTAMP",1);
0036   cout << cdb->getUrl("TestBeginValidity") << endl;
0037 
0038   cout << "using timestamp in range to retrieve calibration" << endl;
0039   rc->set_uint64Flag("TIMESTAMP",15);
0040   cout << cdb->getUrl("TestBeginEndValidity") << endl;
0041   cout << "using timestamp outside range to retrieve calibration" << endl;
0042   rc->set_uint64Flag("TIMESTAMP",25);
0043   cout << cdb->getUrl("TestBeginEndValidity") << endl;
0044 
0045   Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE");
0046   in->Verbosity(1);
0047   se->registerInputManager(in);
0048   se->run(1);
0049   CDBInterface::instance()->Print(); // print used DB files
0050   se->End();
0051   se->Print("NODETREE");
0052   std::cout << "All done" << std::endl;
0053   delete se;
0054 
0055   gSystem->Exit(0);
0056   return;
0057 }
0058 
0059 #endif
0060