@@ -209,8 +209,8 @@ void PPSAlignmentHarvester::fillDescriptions(edm::ConfigurationDescriptions& des
209209 desc.add <bool >(" overwrite_sh_x" , true );
210210 desc.add <std::string>(" text_results_path" , " ./alignment_results.txt" );
211211 desc.add <bool >(" write_sqlite_results" , false );
212- desc.add <bool >(" x_ali_rel_final_slope_fixed" , true );
213- desc.add <bool >(" y_ali_final_slope_fixed" , true );
212+ desc.add <bool >(" x_ali_rel_final_slope_fixed" , false );
213+ desc.add <bool >(" y_ali_final_slope_fixed" , false );
214214 desc.add <double >(" x_corr_min" , -1'000'000 .);
215215 desc.add <double >(" x_corr_max" , 1'000'000 .);
216216 desc.add <double >(" y_corr_min" , -1'000'000 .);
@@ -739,6 +739,7 @@ void PPSAlignmentHarvester::xAlignmentRelative(DQMStore::IBooker& iBooker,
739739 << std::fixed << std::setprecision (3 ) << " x_min = " << x_min << " , x_max = " << x_max << " \n "
740740 << " sh_x_N = " << sh_x_N << " , slope (fix) = " << slope << " , slope (fitted) = " << a;
741741
742+ // relative shift: XF - XN -> XF - XN - b = (XF - b/2) - (XN + b/2)
742743 CTPPSRPAlignmentCorrectionData rpResult_N (+b / 2 ., b_unc / 2 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 .);
743744 xAliRelResults_.setRPCorrection (sc.rp_N_ .id_ , rpResult_N);
744745 CTPPSRPAlignmentCorrectionData rpResult_F (-b / 2 ., b_unc / 2 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 .);
@@ -753,6 +754,7 @@ void PPSAlignmentHarvester::xAlignmentRelative(DQMStore::IBooker& iBooker,
753754
754755 const double b_fs = ff_sl_fix->GetParameter (0 ), b_fs_unc = ff_sl_fix->GetParError (0 );
755756
757+ // relative shift: XF - XN -> XF - XN - b_fs = (XF - b_fs/2) - (XN + b_fs/2)
756758 CTPPSRPAlignmentCorrectionData rpResult_sl_fix_N (+b_fs / 2 ., b_fs_unc / 2 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 .);
757759 xAliRelResultsSlopeFixed_.setRPCorrection (sc.rp_N_ .id_ , rpResult_sl_fix_N);
758760 CTPPSRPAlignmentCorrectionData rpResult_sl_fix_F (-b_fs / 2 ., b_fs_unc / 2 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 .);
@@ -950,15 +952,16 @@ void PPSAlignmentHarvester::yAlignment(DQMStore::IBooker& iBooker,
950952 ff->SetLineColor (2 );
951953 h_y_cen_vs_x->Fit (ff.get (), " Q" , " " , x_min, x_max);
952954
953- const double a = ff->GetParameter (1 ), a_unc = ff->GetParError (1 );
954- const double b = ff->GetParameter (0 ), b_unc = ff->GetParError (0 );
955+ const double a = ff->GetParameter (1 ), a_unc = ff->GetParError (1 ); // slope
956+ const double b = ff->GetParameter (0 ), b_unc = ff->GetParError (0 ); // intercept
955957
956958 edm::LogInfo (" PPSAlignmentHarvester" )
957959 << " [y_alignment] " << rpc.name_ << " :\n "
958960 << std::fixed << std::setprecision (3 ) << " x_min = " << x_min << " , x_max = " << x_max << " \n "
959961 << " sh_x = " << sh_x << " , slope (fix) = " << slope << " , slope (fitted) = " << a;
960962
961- CTPPSRPAlignmentCorrectionData rpResult (0 ., 0 ., b, b_unc, 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 .);
963+ // vertical shift y -> y - b
964+ CTPPSRPAlignmentCorrectionData rpResult (0 ., 0 ., -b, b_unc, 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 .);
962965 yAliResults_.setRPCorrection (rpc.id_ , rpResult);
963966
964967 // calculate the results with slope fixed
@@ -968,9 +971,9 @@ void PPSAlignmentHarvester::yAlignment(DQMStore::IBooker& iBooker,
968971 ff_sl_fix->SetLineColor (4 );
969972 h_y_cen_vs_x->Fit (ff_sl_fix.get (), " Q+" , " " , x_min, x_max);
970973
971- const double b_fs = ff_sl_fix->GetParameter (0 ), b_fs_unc = ff_sl_fix->GetParError (0 );
974+ const double b_fs = ff_sl_fix->GetParameter (0 ), b_fs_unc = ff_sl_fix->GetParError (0 ); // intercept
972975
973- CTPPSRPAlignmentCorrectionData rpResult_sl_fix (0 ., 0 ., b_fs, b_fs_unc, 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 .);
976+ CTPPSRPAlignmentCorrectionData rpResult_sl_fix (0 ., 0 ., - b_fs, b_fs_unc, 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 ., 0 .);
974977 yAliResultsSlopeFixed_.setRPCorrection (rpc.id_ , rpResult_sl_fix);
975978
976979 edm::LogInfo (" PPSAlignmentHarvester" )
@@ -987,8 +990,8 @@ void PPSAlignmentHarvester::yAlignment(DQMStore::IBooker& iBooker,
987990 auto g_results = std::make_unique<TGraph>();
988991 g_results->SetPoint (0 , sh_x, 0 .);
989992 g_results->SetPoint (1 , a, a_unc);
990- g_results->SetPoint (2 , b, b_unc);
991- g_results->SetPoint (3 , b_fs, b_fs_unc);
993+ g_results->SetPoint (2 , - b, b_unc);
994+ g_results->SetPoint (3 , - b_fs, b_fs_unc);
992995 g_results->Write (" g_results" );
993996 }
994997 }
0 commit comments