Skip to content

Commit b847cc5

Browse files
committed
Fix y alignment
1 parent 9a7cd3a commit b847cc5

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

CalibPPS/AlignmentGlobal/plugins/PPSAlignmentHarvester.cc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)