From e4cf46e6ccc0073338e1a45e6c99823116a0d792 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller Date: Sun, 28 Sep 2025 16:25:51 +0200 Subject: [PATCH 1/4] Add an overload for Pandora for the member function propagateToLayer This overload is used by Pandora for propagating tracks without fitting. There exists another overload that takes an EDM4hep hit and we could pass the last hit that was added to the track to it. However, that doesn't work because that overload will try to get the TKalTrackSite (track measurement) that is only built after fitting, which Pandora does not need since it uses the refitted tracks (for CLD). --- k4Reco/GaudiTrkUtils/include/GaudiDDKalTestTrack.h | 3 +++ k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/k4Reco/GaudiTrkUtils/include/GaudiDDKalTestTrack.h b/k4Reco/GaudiTrkUtils/include/GaudiDDKalTestTrack.h index fe6c2521..784dcebc 100644 --- a/k4Reco/GaudiTrkUtils/include/GaudiDDKalTestTrack.h +++ b/k4Reco/GaudiTrkUtils/include/GaudiDDKalTestTrack.h @@ -143,6 +143,9 @@ class GaudiDDKalTestTrack { int propagate(const edm4hep::Vector3d& point, const TKalTrackSite& site, edm4hep::TrackState& ts, double& chi2, int& ndf, const DDVMeasLayer* ml = nullptr); + // Used by Pandora to propagate the refitted tracks + int propagateToLayer(int layerID, edm4hep::TrackState& ts, double& chi2, int& ndf, int& detElementID, int mode); + /** propagate the fit at the measurement site associated with the given hit, to numbered sensitive layer, * returning TrackState, chi2, ndf and integer ID of sensitive detector element via reference */ diff --git a/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp b/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp index 98e0d306..b5497795 100644 --- a/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp +++ b/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp @@ -728,6 +728,13 @@ int GaudiDDKalTestTrack::propagate(const edm4hep::Vector3d& point, const TKalTra return 0; } +int GaudiDDKalTestTrack::propagateToLayer(int layerID, edm4hep::TrackState& ts, + double& chi2, int& ndf, int& detElementID, int mode) { + const TKalTrackSite& site = *(dynamic_cast(m_kaltrack->Last())) ; + + return this->propagateToLayer(layerID, site, ts, chi2, ndf, detElementID, mode); +} + int GaudiDDKalTestTrack::propagateToLayer(int layerID, const edm4hep::TrackerHit* trkhit, edm4hep::TrackState& ts, double& chi2, int& ndf, int& detElementID, int mode) { TKalTrackSite* site = nullptr; From b5e4ceb54edb3aceb07ea7f02b7c1e741f6415bf Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller Date: Tue, 30 Sep 2025 09:02:55 +0200 Subject: [PATCH 2/4] clang-format --- k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp b/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp index b5497795..d8467e66 100644 --- a/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp +++ b/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp @@ -728,9 +728,9 @@ int GaudiDDKalTestTrack::propagate(const edm4hep::Vector3d& point, const TKalTra return 0; } -int GaudiDDKalTestTrack::propagateToLayer(int layerID, edm4hep::TrackState& ts, - double& chi2, int& ndf, int& detElementID, int mode) { - const TKalTrackSite& site = *(dynamic_cast(m_kaltrack->Last())) ; +int GaudiDDKalTestTrack::propagateToLayer(int layerID, edm4hep::TrackState& ts, double& chi2, int& ndf, + int& detElementID, int mode) { + const TKalTrackSite& site = *(dynamic_cast(m_kaltrack->Last())); return this->propagateToLayer(layerID, site, ts, chi2, ndf, detElementID, mode); } From abbdf1a5044f50fd8a34ae7b46e7741cbfc137a5 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller Date: Tue, 30 Sep 2025 10:05:31 +0200 Subject: [PATCH 3/4] Use static_cast instead of dynamic_cast --- k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp b/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp index d8467e66..17bed68c 100644 --- a/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp +++ b/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp @@ -730,7 +730,7 @@ int GaudiDDKalTestTrack::propagate(const edm4hep::Vector3d& point, const TKalTra int GaudiDDKalTestTrack::propagateToLayer(int layerID, edm4hep::TrackState& ts, double& chi2, int& ndf, int& detElementID, int mode) { - const TKalTrackSite& site = *(dynamic_cast(m_kaltrack->Last())); + const TKalTrackSite& site = *static_cast(m_kaltrack->Last()); return this->propagateToLayer(layerID, site, ts, chi2, ndf, detElementID, mode); } From 0afe94b7f6ad4d127f5a40ba97c2d982b5c2b813 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Tue, 30 Sep 2025 21:12:02 +0200 Subject: [PATCH 4/4] Use auto Co-authored-by: Thomas Madlener --- k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp b/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp index 17bed68c..46389ac1 100644 --- a/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp +++ b/k4Reco/GaudiTrkUtils/src/GaudiDDKalTestTrack.cpp @@ -730,7 +730,7 @@ int GaudiDDKalTestTrack::propagate(const edm4hep::Vector3d& point, const TKalTra int GaudiDDKalTestTrack::propagateToLayer(int layerID, edm4hep::TrackState& ts, double& chi2, int& ndf, int& detElementID, int mode) { - const TKalTrackSite& site = *static_cast(m_kaltrack->Last()); + const auto& site = *static_cast(m_kaltrack->Last()); return this->propagateToLayer(layerID, site, ts, chi2, ndf, detElementID, mode); }