Skip to content

Commit e703781

Browse files
committed
Make sure TOF residuals evaluated in the nominal sector frame
1 parent 53ab9cd commit e703781

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

Detectors/TPC/calibration/SpacePoints/src/TrackInterpolation.cxx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,13 @@ void TrackInterpolation::interpolateTrack(int iSeed)
512512
LOG(debug) << "Failed to rotate into TOF cluster sector frame";
513513
return;
514514
}
515-
float clTOFX = clTOF.getX();
516-
std::array<float, 2> clTOFYZ{clTOF.getY(), clTOF.getZ()};
515+
float clTOFxyz[3] = {clTOF.getX(), clTOF.getY(), clTOF.getZ()};
516+
if (!clTOF.isInNominalSector()) {
517+
o2::tof::Geo::alignedToNominalSector(clTOFxyz, clTOFSec); // go from the aligned to nominal sector frame
518+
}
519+
std::array<float, 2> clTOFYZ{clTOFxyz[1], clTOFxyz[2]};
517520
std::array<float, 3> clTOFCov{mParams->sigYZ2TOF, 0.f, mParams->sigYZ2TOF}; // assume no correlation between y and z and equal cluster error sigma^2 = (3cm)^2 / 12
518-
if (!propagator->PropagateToXBxByBz(trkWork, clTOFX, mParams->maxSnp, mParams->maxStep, mMatCorr)) {
521+
if (!propagator->PropagateToXBxByBz(trkWork, clTOFxyz[0], mParams->maxSnp, mParams->maxStep, mMatCorr)) {
519522
LOG(debug) << "Failed final propagation to TOF radius";
520523
return;
521524
}
@@ -676,20 +679,24 @@ void TrackInterpolation::interpolateTrack(int iSeed)
676679
// do we have TOF residual to add?
677680
while (gidTable[GTrackID::TOF].isIndexSet() && !stopPropagation) {
678681
const auto& clTOF = mRecoCont->getTOFClusters()[gidTable[GTrackID::TOF]];
682+
float clTOFxyz[3] = {clTOF.getX(), clTOF.getY(), clTOF.getZ()};
683+
if (!clTOF.isInNominalSector()) {
684+
o2::tof::Geo::alignedToNominalSector(clTOFxyz, clTOF.getCount()); // go from the aligned to nominal sector frame
685+
}
679686
const float clTOFAlpha = o2::math_utils::sector2Angle(clTOF.getCount());
680687
if (trkWork.getAlpha() != clTOFAlpha && !trkWork.rotate(clTOFAlpha)) {
681688
LOG(debug) << "Failed to rotate into TOF cluster sector frame";
682689
stopPropagation = true;
683690
break;
684691
}
685-
if (!propagator->PropagateToXBxByBz(trkWork, clTOF.getX(), mParams->maxSnp, mParams->maxStep, mMatCorr)) {
692+
if (!propagator->PropagateToXBxByBz(trkWork, clTOFxyz[0], mParams->maxSnp, mParams->maxStep, mMatCorr)) {
686693
LOG(debug) << "Failed final propagation to TOF radius";
687694
break;
688695
}
689696

690697
float tgPhi = trkWork.getSnp() / std::sqrt((1.f - trkWork.getSnp()) * (1.f + trkWork.getSnp()));
691-
auto dy = clTOF.getY() - trkWork.getY();
692-
auto dz = clTOF.getZ() - trkWork.getZ();
698+
auto dy = clTOFxyz[1] - trkWork.getY();
699+
auto dz = clTOFxyz[2] - trkWork.getZ();
693700
if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWork.getY()) < param::MaxY) && (std::abs(trkWork.getZ()) < param::MaxZ) && (std::abs(tgPhi) < param::MaxTgSlp)) {
694701
mClRes.emplace_back(dy, dz, tgPhi, trkWork.getY(), trkWork.getZ(), 170, clTOF.getCount(), clTOF.getPadInSector());
695702
trackData.nExtDetResid++;
@@ -929,19 +936,23 @@ void TrackInterpolation::extrapolateTrack(int iSeed)
929936
while (gidTableFull[GTrackID::TOF].isIndexSet() && !stopPropagation) {
930937
const auto& clTOF = mRecoCont->getTOFClusters()[gidTableFull[GTrackID::TOF]];
931938
const float clTOFAlpha = o2::math_utils::sector2Angle(clTOF.getCount());
939+
float clTOFxyz[3] = {clTOF.getX(), clTOF.getY(), clTOF.getZ()};
940+
if (!clTOF.isInNominalSector()) {
941+
o2::tof::Geo::alignedToNominalSector(clTOFxyz, clTOF.getCount()); // go from the aligned to nominal sector frame
942+
}
932943
if (trkWork.getAlpha() != clTOFAlpha && !trkWork.rotate(clTOFAlpha)) {
933944
LOG(debug) << "Failed to rotate into TOF cluster sector frame";
934945
stopPropagation = true;
935946
break;
936947
}
937-
if (!propagator->PropagateToXBxByBz(trkWork, clTOF.getX(), mParams->maxSnp, mParams->maxStep, mMatCorr)) {
948+
if (!propagator->PropagateToXBxByBz(trkWork, clTOFxyz[0], mParams->maxSnp, mParams->maxStep, mMatCorr)) {
938949
LOG(debug) << "Failed final propagation to TOF radius";
939950
break;
940951
}
941952

942953
float tgPhi = trkWork.getSnp() / std::sqrt((1.f - trkWork.getSnp()) * (1.f + trkWork.getSnp()));
943-
auto dy = clTOF.getY() - trkWork.getY();
944-
auto dz = clTOF.getZ() - trkWork.getZ();
954+
auto dy = clTOFxyz[1] - trkWork.getY();
955+
auto dz = clTOFxyz[2] - trkWork.getZ();
945956
if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWork.getY()) < param::MaxY) && (std::abs(trkWork.getZ()) < param::MaxZ) && (std::abs(tgPhi) < param::MaxTgSlp)) {
946957
mClRes.emplace_back(dy, dz, tgPhi, trkWork.getY(), trkWork.getZ(), 170, clTOF.getCount(), clTOF.getPadInSector());
947958
trackData.clAvailTOF = 1;

0 commit comments

Comments
 (0)