File indexing completed on 2025-08-03 08:20:22
0001
0002 #include <mbd/MbdCalib.h>
0003 #include <mbd/MbdGeomV1.h>
0004 #include <mbd/MbdDefs.h>
0005
0006 #include <filesystem>
0007
0008
0009 #if defined(__CLING__)
0010 R__LOAD_LIBRARY(libmbd.so)
0011 #endif
0012
0013
0014 const int NPOINTS = 16000;
0015 const int MINADC = 0;
0016 const int MAXADC = 15999;
0017
0018 void addt0(const char *calfile1 = "results/0/mbd_tt_t0.calib",
0019 const char *calfile2 = "results/0/pass1_mbd_tt_t0.calib")
0020 {
0021 MbdGeom *mbdgeom = new MbdGeomV1();
0022
0023 MbdCalib *mcal1 = new MbdCalib();
0024 mcal1->Download_TTT0( calfile1 );
0025
0026 MbdCalib *mcal2 = new MbdCalib();
0027 mcal2->Download_TTT0( calfile2 );
0028
0029
0030 TString tqcalfile1 = calfile1;
0031 tqcalfile1.ReplaceAll("tt_t0","tq_t0");
0032 MbdCalib *mcaltq1 = new MbdCalib();
0033 mcaltq1->Download_TQT0( tqcalfile1.Data() );
0034
0035 TString tqcalfile2 = calfile2;
0036 tqcalfile2.ReplaceAll("tt_t0","tq_t0");
0037 MbdCalib *mcaltq2 = new MbdCalib();
0038 mcaltq2->Download_TQT0( tqcalfile2.Data() );
0039
0040
0041 for (int ipmtch=0; ipmtch<MbdDefs::MBD_N_PMT; ipmtch++)
0042 {
0043 float ttt01 = mcal1->get_tt0( ipmtch );
0044 float ttt02 = mcal2->get_tt0( ipmtch );
0045 float new_ttt0 = ttt01 + ttt02;
0046
0047 mcal1->set_tt0( ipmtch, new_ttt0 );
0048
0049 float tqt01 = mcaltq1->get_tq0( ipmtch );
0050 float tqt02 = mcaltq2->get_tq0( ipmtch );
0051 float new_tqt0 = tqt01 + tqt02;
0052
0053 mcaltq1->set_tq0( ipmtch, new_tqt0 );
0054 }
0055
0056
0057 const std::string dir = std::filesystem::path{ calfile1 }.parent_path().string();
0058 const std::string& ttt0_fname = dir + "/add_mbd_tt_t0.calib";
0059 cout << ttt0_fname << endl;
0060 mcal1->Write_TTT0( ttt0_fname );
0061
0062 const std::string& tqt0_fname = dir + "/add_mbd_tq_t0.calib";
0063 cout << tqt0_fname << endl;
0064 mcaltq1->Write_TQT0( tqt0_fname );
0065
0066 }
0067