|
18 | 18 | #ifndef COMMON_CORE_FWDTRACKUTILITIES_H_ |
19 | 19 | #define COMMON_CORE_FWDTRACKUTILITIES_H_ |
20 | 20 |
|
21 | | -#include <Framework/AnalysisDataModel.h> |
22 | 21 | #include <Framework/DataTypes.h> |
23 | 22 | #include <GlobalTracking/MatchGlobalFwd.h> |
24 | 23 | #include <MCHTracking/TrackExtrap.h> |
@@ -48,22 +47,33 @@ using SMatrix55 = ROOT::Math::SMatrix<double, 5, 5, ROOT::Math::MatRepSym<double |
48 | 47 | using SMatrix55Std = ROOT::Math::SMatrix<double, 5>; |
49 | 48 | using SMatrix5 = ROOT::Math::SVector<double, 5>; |
50 | 49 |
|
| 50 | +template <typename T> |
| 51 | +concept is_fwd_track = requires (T t) { |
| 52 | + { t.rAtAbsorberEnd() } -> std::same_as<float>; |
| 53 | +}; |
| 54 | + |
| 55 | +template <typename T> |
| 56 | +concept is_fwd_cov = requires (T t) |
| 57 | +{ |
| 58 | + { t.sigmaX() } -> std::same_as<float>; |
| 59 | +}; |
| 60 | + |
51 | 61 | /// Produce TrackParCovFwds for MFT and FwdTracks, w/ or w/o cov, with z shift |
52 | 62 | template <typename TFwdTrack, typename... TCovariance> |
53 | 63 | o2::track::TrackParCovFwd getTrackParCovFwdShift(TFwdTrack const& track, float zshift, TCovariance const&... covOpt) |
54 | 64 | { |
55 | 65 | double chi2 = track.chi2(); |
56 | 66 | if constexpr (sizeof...(covOpt) == 0) { |
57 | 67 | // No covariance passed |
58 | | - if constexpr (std::is_same_v<std::decay_t<TFwdTrack>, aod::FwdTracks::iterator>) { |
| 68 | + if constexpr (is_fwd_track<TFwdTrack>) { |
59 | 69 | if (track.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { |
60 | 70 | chi2 = track.chi2() * (2.f * track.nClusters() - 5.f); |
61 | 71 | } |
62 | 72 | } |
63 | 73 | } else { |
64 | 74 | // Covariance passed |
65 | 75 | using TCov = std::decay_t<decltype((covOpt, ...))>; |
66 | | - if constexpr (std::is_same_v<TCov, aod::FwdTracksCov::iterator>) { |
| 76 | + if constexpr (is_fwd_cov<TCov>) { |
67 | 77 | if (track.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { |
68 | 78 | chi2 = track.chi2() * (2.f * track.nClusters() - 5.f); |
69 | 79 | } |
|
0 commit comments