Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // 
0002 // update the t0 constants to correct the z-vertex
0003 // dz is the amount to move the current z-vertex
0004 // dt is the amount to move the current t0
0005 //
0006 #include <mbd/MbdCalib.h>
0007 
0008 #if defined(__CLING__)
0009 R__LOAD_LIBRARY(libmbd.so)
0010 R__LOAD_LIBRARY(libmbd_io.so)
0011 #endif
0012 
0013 
0014 void update_t0constants(const char *calib_fname, const float dz, const float dt = 0.)
0015 {
0016   TString cal_fname = calib_fname;
0017 
0018   MbdCalib *mcal = new MbdCalib();
0019   
0020   if ( cal_fname.Contains("tt_t0") )
0021   {
0022     mcal->Download_TTT0( cal_fname.Data() );
0023     mcal->Update_TTT0( dz, dt );
0024     cal_fname.ReplaceAll( "mbd_tt_t0", "new_mbd_tt_t0" );
0025     mcal->Write_TTT0( cal_fname.Data() );
0026   }
0027   else if ( cal_fname.Contains("tq_t0") )
0028   {
0029     mcal->Download_TQT0( cal_fname.Data() );
0030     mcal->Update_TQT0( dz, dt );
0031     cal_fname.ReplaceAll( "mbd_tq_t0", "new_mbd_tq_t0" );
0032     mcal->Write_TQT0( cal_fname.Data() );
0033   }
0034   else
0035   {
0036     cerr << "File " << calib_fname << " is not a valid t0 calibration file" << endl;
0037   }
0038 
0039 }
0040