Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions Detectors/MUON/MCH/Tracking/include/MCHTracking/TrackExtrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define O2_MCH_TRACKEXTRAP_H_

#include <cstddef>
#include <optional>

#include <TMatrixD.h>

Expand Down Expand Up @@ -70,17 +71,21 @@ class TrackExtrap
/// Add branson correction resolution to parameter covariances
return extrapToVertex(trackParam, xVtx, yVtx, zVtx, errXVtx, errYVtx, true, false);
}
static bool extrapToVertexWithoutBranson(TrackParam& trackParam, double zVtx)
static bool extrapToVertexWithoutBranson(TrackParam& trackParam, double zVtx,
double xUpstream = 0., double yUpstream = 0.,
std::optional<double> zUpstream = std::nullopt)
{
/// Extrapolate track parameters to vertex, corrected for energy loss effects only
/// Add dispersion due to multiple scattering and energy loss fluctuation to parameter covariances
return extrapToVertex(trackParam, 0., 0., zVtx, 0., 0., false, true);
return extrapToVertex(trackParam, 0., 0., zVtx, 0., 0., false, true, xUpstream, yUpstream, zUpstream);
}
static bool extrapToVertexUncorrected(TrackParam& trackParam, double zVtx)
static bool extrapToVertexUncorrected(TrackParam& trackParam, double zVtx,
double xUpstream = 0., double yUpstream = 0.,
std::optional<double> zUpstream = std::nullopt)
{
/// Extrapolate track parameters to vertex without multiple scattering and energy loss corrections
/// Add dispersion due to multiple scattering to parameter covariances
return extrapToVertex(trackParam, 0., 0., zVtx, 0., 0., false, false);
return extrapToVertex(trackParam, 0., 0., zVtx, 0., 0., false, false, xUpstream, yUpstream, zUpstream);
}

static bool extrapToMID(TrackParam& trackParam);
Expand All @@ -92,7 +97,8 @@ class TrackExtrap

private:
static bool extrapToVertex(TrackParam& trackParam, double xVtx, double yVtx, double zVtx,
double errXVtx, double errYVtx, bool correctForMCS, bool correctForEnergyLoss);
double errXVtx, double errYVtx, bool correctForMCS, bool correctForEnergyLoss,
double xUpstream = 0., double yUpstream = 0., std::optional<double> zUpstream = std::nullopt);

static bool getAbsorberCorrectionParam(double trackXYZIn[3], double trackXYZOut[3], double pTotal,
double& pathLength, double& f0, double& f1, double& f2,
Expand Down
21 changes: 20 additions & 1 deletion Detectors/MUON/MCH/Tracking/src/TrackExtrap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ bool TrackExtrap::extrapToMID(TrackParam& trackParam)

//__________________________________________________________________________
bool TrackExtrap::extrapToVertex(TrackParam& trackParam, double xVtx, double yVtx, double zVtx,
double errXVtx, double errYVtx, bool correctForMCS, bool correctForEnergyLoss)
double errXVtx, double errYVtx, bool correctForMCS, bool correctForEnergyLoss,
double xUpstream, double yUpstream, std::optional<double> zUpstream)
{
/// Main method for extrapolation to the vertex:
/// Returns the track parameters and covariances resulting from the extrapolation of the current trackParam
Expand All @@ -285,6 +286,8 @@ bool TrackExtrap::extrapToVertex(TrackParam& trackParam, double xVtx, double yVt
/// if correctForMCS=false: add parameter dispersion due to MCS in parameter covariances
/// if correctForEnergyLoss=true: correct parameters for energy loss and add energy loss fluctuation to covariances
/// if correctForEnergyLoss=false: do nothing about energy loss
/// In case correctForMCS=false and the position of the track upstream the absorber is provided, it is used
/// to compute the absorber correction parameters, instead of the extrapolated track position from downstream

if (trackParam.getZ() == zVtx) {
return true; // nothing to be done if already at vertex
Expand All @@ -301,6 +304,18 @@ bool TrackExtrap::extrapToVertex(TrackParam& trackParam, double xVtx, double yVt
}
}

// check the upstream track position with respect to the absorber if provided and used (spectro z<0)
// zUpstream must be >= SAbsZBeg with 100 µm tolerance to account for numerical precision
if (!correctForMCS && zUpstream && *zUpstream < SAbsZBeg - 0.01) {
if (*zUpstream < SAbsZEnd) {
LOG(warning) << "Upstream Z (" << *zUpstream << ") downstream the front absorber (zAbsorberEnd = " << SAbsZEnd << ")";
return false;
} else {
LOG(warning) << "Upstream Z (" << *zUpstream << ") inside the front absorber (" << SAbsZBeg << ", " << SAbsZEnd << ")";
return false;
}
}

// Check the track position with respect to the vertex and the absorber (spectro z<0)
if (trackParam.getZ() > SAbsZEnd) {
if (trackParam.getZ() > zVtx) {
Expand Down Expand Up @@ -328,6 +343,10 @@ bool TrackExtrap::extrapToVertex(TrackParam& trackParam, double xVtx, double yVt
trackXYZIn[2] = SAbsZBeg;
trackXYZIn[0] = trackXYZOut[0] + (xVtx - trackXYZOut[0]) / (zVtx - trackXYZOut[2]) * (trackXYZIn[2] - trackXYZOut[2]);
trackXYZIn[1] = trackXYZOut[1] + (yVtx - trackXYZOut[1]) / (zVtx - trackXYZOut[2]) * (trackXYZIn[2] - trackXYZOut[2]);
} else if (zUpstream) { // or linear propagation to the upstream track position
trackXYZIn[2] = SAbsZBeg;
trackXYZIn[0] = trackXYZOut[0] + (xUpstream - trackXYZOut[0]) / (*zUpstream - trackXYZOut[2]) * (trackXYZIn[2] - trackXYZOut[2]);
trackXYZIn[1] = trackXYZOut[1] + (yUpstream - trackXYZOut[1]) / (*zUpstream - trackXYZOut[2]) * (trackXYZIn[2] - trackXYZOut[2]);
} else { // or standard propagation without vertex constraint
TrackParam trackParamIn(trackParam);
if (!extrapToZ(trackParamIn, SAbsZBeg)) {
Expand Down