Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:23:59

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 #include <Rtypes.h> // defines R__LOAD_LIBRARY macro
0009 #include <TString.h>
0010 
0011 R__LOAD_LIBRARY(libmbd.so)
0012 R__LOAD_LIBRARY(libmbd_io.so)
0013 
0014 
0015 void update_t0constants(const char *calib_fname, const float dz, const float dt = 0.)
0016 {
0017   TString cal_fname = calib_fname;
0018 
0019   MbdCalib *mcal = new MbdCalib();
0020   
0021   if ( cal_fname.Contains("tt_t0") )
0022   {
0023     mcal->Download_TTT0( cal_fname.Data() );
0024     mcal->Update_TTT0( dz, dt );
0025     cal_fname.ReplaceAll( "mbd_tt_t0", "new_mbd_tt_t0" );
0026     mcal->Write_TTT0( cal_fname.Data() );
0027   }
0028   else if ( cal_fname.Contains("tq_t0") )
0029   {
0030     mcal->Download_TQT0( cal_fname.Data() );
0031     mcal->Update_TQT0( dz, dt );
0032     cal_fname.ReplaceAll( "mbd_tq_t0", "new_mbd_tq_t0" );
0033     mcal->Write_TQT0( cal_fname.Data() );
0034   }
0035   else
0036   {
0037     std::cerr << "File " << calib_fname << " is not a valid t0 calibration file" << std::endl;
0038   }
0039 
0040 }
0041