Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:21:00

0001 #include <GlobalVariables.C>
0002 #include <cdbobjects/CDBTTree.h>  // for CDBTTree
0003 #include <ffamodules/CDBInterface.h>
0004 
0005 R__LOAD_LIBRARY(libcdbobjects)
0006 
0007 
0008 void createLocalEMCalCalibFile(const string fname,int runNumber){
0009 
0010     string default_time_independent_calib = "cemc_pi0_twrSlope_v1_default";
0011     string  m_calibName = "cemc_pi0_twrSlope_v1";
0012 
0013     string calibdir = CDBInterface::instance()->getUrl(m_calibName);
0014     string filePath;
0015 
0016     if (!calibdir.empty())
0017     {
0018       filePath = calibdir;
0019       //cdbttree = new CDBTTree(calibdir);
0020     }
0021     else
0022     {
0023       calibdir = CDBInterface::instance()->getUrl(default_time_independent_calib);
0024 
0025       if (calibdir.empty())
0026       {
0027         std::cout << "No EMCal Calibration NOT even a default" << std::endl;
0028         exit(1);
0029       }
0030       filePath = calibdir;
0031       //cdbttree = new CDBTTree(calibdir);
0032       std::cout << "No specific file for " << m_calibName << " found, using default calib " << default_time_independent_calib << std::endl;
0033     }
0034 
0035     TFile* f_cdb = new TFile(filePath.c_str());
0036     f_cdb->Cp(fname.c_str()); 
0037 
0038     delete  f_cdb;
0039 }