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