Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-07-16 08:16:47

0001 #ifndef TESTCDBFILEDUMP_C
0002 #define TESTCDBFILEDUMP_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 
0016 // if you want to use calibration outside of scdf, you need to source the sphenix_setup script
0017 // from the opensciencegrid cvmfs area
0018 // source /cvmfs/sphenix.opensciencegrid.org/alma9.2-gcc-14.2.0/opt/sphenix/core/bin/sphenix_setup.csh -n
0019 
0020 // during reading there is no check on the global tag or timestamp (runnumber). All this is set
0021 // during the writing of the calibration list file.
0022 
0023 void WriteFile(uint64_t timestamp = 82476)
0024 {
0025   recoConsts *rc = recoConsts::instance();
0026   // we need to set the cdb tag and timestamp to select the calibrations to write
0027   rc->set_StringFlag("CDB_GLOBALTAG","newcdbtag"); 
0028   rc->set_uint64Flag("TIMESTAMP",timestamp);
0029   CDBInterface *cdb = CDBInterface::instance();
0030   cdb->DumpCalibrations("calibs.list");
0031 
0032   return;
0033 }
0034 
0035 void ReadFile()
0036 {
0037   // there is no timestamp or global tag when reading - this is set when you create the dump
0038   CDBInterface *cdb = CDBInterface::instance();
0039   cdb->ReadCalibrationsFromFile("calibs.list");
0040   // print a random calibration to see if it works
0041   std::cout << cdb->getUrl("ohcal_abscalib_mip_bldg912") << std::endl;
0042   return;
0043 }
0044 
0045 #endif