File indexing completed on 2025-08-06 08:15:48
0001
0002 void calTowerCalib()
0003 {
0004 const double energy_in[16] = {0.00763174, 0.00692298, 0.00637355, 0.0059323, 0.00762296, 0.00691832, 0.00636611, 0.0059203, 0.00762873, 0.00693594, 0.00637791, 0.00592433, 0.00762898, 0.00691679, 0.00636373, 0.00592433};
0005 const double adc_in[16] = {2972.61, 2856.43, 2658.19, 2376.10, 3283.39, 2632.81, 2775.77, 2491.68, 2994.11, 3385.70, 3258.01, 2638.31, 3479.97, 3081.41, 2768.36, 2626.77};
0006 const double gain_factor_in = 32.0;
0007 const double samplefrac_in = 0.09267;
0008
0009 const double energy_out[16] = {0.00668176, 0.00678014, 0.00687082, 0.00706854, 0.00668973, 0.00678279, 0.00684794, 0.00705448, 0.00668976, 0.0068013, 0.00685931, 0.00704985, 0.0066926, 0.00678282, 0.00684403, 0.00704143};
0010
0011 const double adc_out[16] = {276.9, 290.0, 280.7, 272.1, 309.5, 304.8, 318.5, 289.6, 289.9, 324.2, 297.9, 294.6, 292.7, 310.5, 302.3, 298.5};
0012 const double adc_amp[16] = {2.505, 5.330, 5.330, 6.965, 2.505, 5.330, 5.330, 6.965, 2.505, 5.330, 5.330, 6.965, 2.505, 5.330, 5.330, 6.965};
0013 const double gain_factor_out = 16.0;
0014 const double samplefrac_out = 0.02862;
0015
0016 double towercalib_lg_in[16];
0017 double towercalib_hg_in[16];
0018 double towercalib_lg_out[16];
0019 double towercalib_hg_out[16];
0020 for(int i_tower = 0; i_tower < 16; ++i_tower)
0021 {
0022 towercalib_lg_in[i_tower] = gain_factor_in*energy_in[i_tower]/(adc_in[i_tower]*samplefrac_in);
0023 towercalib_hg_in[i_tower] = energy_in[i_tower]/(adc_in[i_tower]*samplefrac_in);
0024
0025 towercalib_lg_out[i_tower] = gain_factor_out*energy_out[i_tower]/(adc_amp[i_tower]*adc_out[i_tower]*samplefrac_out);
0026 towercalib_hg_out[i_tower] = energy_out[i_tower]/(adc_amp[i_tower]*adc_out[i_tower]*samplefrac_out);
0027
0028
0029
0030 cout << "i_tower = " << i_tower << ", towercalib_lg_in = " << towercalib_lg_in[i_tower] << ", towercalib_lg_out = " << towercalib_lg_out[i_tower] << endl;
0031 cout << "i_tower = " << i_tower << ", towercalib_hg_in = " << towercalib_hg_in[i_tower] << ", towercalib_hg_out = " << towercalib_hg_out[i_tower] << endl;
0032 cout << endl;
0033 }
0034
0035
0036 int hbdchanIHC[4][4] = { { 4, 8, 12, 16},
0037 { 3, 7, 11, 15},
0038 { 2, 6, 10, 14},
0039 { 1, 5, 9, 13}};
0040
0041 string output_hcalin = "calib_hcalin_hg.txt";
0042 ofstream File_OutPut_hcalin(output_hcalin.c_str());
0043 for(int i_col = 0; i_col < 4; ++i_col)
0044 {
0045 for(int i_row = 0; i_row < 4; ++i_row)
0046 {
0047 int i_tower = hbdchanIHC[i_row][i_col]-1;
0048 cout << "i_col = " << i_col << ", i_row = " << i_row << ", i_tower = " << i_tower << ", towercalib_hg_in = " << towercalib_hg_in[i_tower] << endl;
0049
0050 File_OutPut_hcalin << i_col << " " << i_row << " " << towercalib_hg_in[i_tower] << endl;
0051 }
0052 }
0053 File_OutPut_hcalin.close();
0054
0055 string output_hcalout = "calib_hcalout_hg.txt";
0056 ofstream File_OutPut_hcalout(output_hcalout.c_str());
0057 for(int i_col = 0; i_col < 4; ++i_col)
0058 {
0059 for(int i_row = 0; i_row < 4; ++i_row)
0060 {
0061 int i_tower = hbdchanIHC[i_row][i_col]-1;
0062 cout << "i_col = " << i_col << ", i_row = " << i_row << ", i_tower = " << i_tower << ", towercalib_hg_out = " << towercalib_hg_out[i_tower] << endl;
0063
0064 File_OutPut_hcalout << i_col << " " << i_row << " " << towercalib_hg_out[i_tower] << endl;
0065 }
0066 }
0067 File_OutPut_hcalout.close();
0068 }