Skip to content
Open
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
13 changes: 10 additions & 3 deletions Common/Core/fwdtrackUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
{ t.sigmaX() } -> std::same_as<float>;
};

/// Produce TrackParCovFwds for MFT and FwdTracks, w/ or w/o cov, with z shift
/// Produce TrackParCovFwds for MFT and FwdTracks, w/ or w/o cov, with x, y and z shifts
template <typename TFwdTrack, typename... TCovariance>
o2::track::TrackParCovFwd getTrackParCovFwdShift(TFwdTrack const& track, float zshift, TCovariance const&... covOpt)
o2::track::TrackParCovFwd getTrackParCovFwd3DShift(TFwdTrack const& track, float xshift, float yshift, float zshift, TCovariance const&... covOpt)
{
double chi2 = track.chi2();
if constexpr (sizeof...(covOpt) == 0) {
Expand All @@ -82,7 +82,7 @@
}
}

SMatrix5 tpars(track.x(), track.y(), track.phi(), track.tgl(), track.signed1Pt());
SMatrix5 tpars(track.x() + xshift, track.y() + yshift, track.phi(), track.tgl(), track.signed1Pt());

SMatrix55 tcovs;
if constexpr (sizeof...(covOpt) == 1) {
Expand All @@ -101,6 +101,13 @@
return o2::track::TrackParCovFwd(track.z() + zshift, tpars, tcovs, chi2);
}

/// Produce TrackParCovFwds for MFT and FwdTracks, w/ or w/o cov, with z shift
template <typename TFwdTrack, typename... TCovariance>
o2::track::TrackParCovFwd getTrackParCovFwdShift(TFwdTrack const& track, float zshift, TCovariance const&... covOpt)
{
return getTrackParCovFwd3DShift(track, 0.f, 0.f, zshift, covOpt...);
}

inline o2::track::TrackParCovFwd getTrackParCovFwdShiftManual(
const double x, const double y, const double phi, const double tgl, const double signed1Pt,
const double cXX,
Expand Down Expand Up @@ -181,7 +188,7 @@
o2::dataformats::GlobalFwdTrack propmuon;
o2::globaltracking::MatchGlobalFwd mMatching;

if (trackType > 2) { // MCH-MID or MCH standalone

Check failure on line 191 in Common/Core/fwdtrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
o2::dataformats::GlobalFwdTrack track;
track.setParameters(fwdtrack.getParameters());
track.setZ(fwdtrack.getZ());
Expand All @@ -202,7 +209,7 @@
propmuon.setParameters(proptrack.getParameters());
propmuon.setZ(proptrack.getZ());
propmuon.setCovariances(proptrack.getCovariances());
} else if (trackType < 2) { // MFT-MCH-MID

Check failure on line 212 in Common/Core/fwdtrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
// const double centerMFT[3] = {0, 0, -61.4};
// o2::field::MagneticField* field = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
// auto Bz = field->getBz(centerMFT); // Get field at centre of MFT in kG.
Expand Down Expand Up @@ -281,7 +288,7 @@

auto trk = inputTrk; // mutable copy

if (std::abs(bz) < 1e-12) {

Check failure on line 291 in Common/Core/fwdtrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
trk.propagateToZlinear(collision.posZ());
} else {
trk.propagateToZhelix(collision.posZ(), bz);
Expand All @@ -292,7 +299,7 @@
float phi = trk.getPhi();
float tgl = trk.getTanl();

if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(phi) || !std::isfinite(tgl) || std::abs(tgl) < 1e-8) {

Check failure on line 302 in Common/Core/fwdtrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return -1.f;
}

Expand Down Expand Up @@ -325,7 +332,7 @@

float chi2 = (sYY * dx * dx - 2.0 * sXY * dx * dy + sXX * dy * dy) / det;

if (!std::isfinite(chi2) || chi2 < -1e-8) {

Check failure on line 335 in Common/Core/fwdtrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return -1.f;
}

Expand All @@ -343,7 +350,7 @@

o2::track::TrackParCovFwd trk = getTrackParCovFwdShift(fwdtrack, zShift, fwdtrack);

if (std::abs(bz) < 1e-12) {

Check failure on line 353 in Common/Core/fwdtrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
trk.propagateToZlinear(collision.posZ());
} else {
trk.propagateToZhelix(collision.posZ(), bz);
Expand All @@ -354,7 +361,7 @@
float phi = trk.getPhi();
float tgl = trk.getTanl();

if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(phi) || !std::isfinite(tgl) || std::abs(tgl) < 1e-8) {

Check failure on line 364 in Common/Core/fwdtrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return -1.f;
}

Expand Down Expand Up @@ -387,7 +394,7 @@

float chi2 = (sYY * dx * dx - 2.0 * sXY * dx * dy + sXX * dy * dy) / det;

if (!std::isfinite(chi2) || chi2 < -1e-8) {

Check failure on line 397 in Common/Core/fwdtrackUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return -1.f;
}

Expand Down
Loading