From 9397d38fac63749b6cd32f355b1d164161bfe5a0 Mon Sep 17 00:00:00 2001 From: Jeetendra Gupta Date: Wed, 7 Feb 2024 00:39:10 -0600 Subject: [PATCH 01/12] improvement in charge calculation in trackseeding --- src/algorithms/tracking/TrackSeeding.cc | 32 ++++++++++--------------- src/algorithms/tracking/TrackSeeding.h | 2 +- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index d9c068608e..7a879e9401 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -4,6 +4,7 @@ #include "TrackSeeding.h" +#include "TVector2.h" #include #include #include @@ -187,16 +188,13 @@ std::unique_ptr eicrecon::TrackSeeding::make auto slopeZ0 = lineFit(rzHitPositions); const auto xypos = findPCA(RX0Y0); + + auto xpos = xypos.first; + auto ypos = xypos.second; //Determine charge - std::vector> xyrelPos; - - for ( const auto& spptr : seed.sp() ) - { - xyrelPos.emplace_back(spptr->x()-xypos.first, spptr->y()-xypos.second); - } - int charge = determineCharge(xyrelPos); + int charge = determineCharge(xyHitPositions,X0,Y0,xpos,ypos); float theta = atan(1./std::get<0>(slopeZ0)); // normalize to 0 eicrecon::TrackSeeding::make float qOverP = charge / p; //Calculate phi at xypos - auto xpos = xypos.first; - auto ypos = xypos.second; - auto vxpos = -1.*charge*(ypos-Y0); auto vypos = charge*(xpos-X0); @@ -276,19 +271,18 @@ std::pair eicrecon::TrackSeeding::findPCA(std::tuple>& positions) const +int eicrecon::TrackSeeding::determineCharge(std::vector>& positions, float X0, float Y0, float xpos, float ypos) const { // determine the charge by the bend angle of the first two hits int charge = 1; const auto& firstpos = positions.at(0); - const auto& secondpos = positions.at(1); - - const auto firstphi = atan2(firstpos.second, firstpos.first); - const auto secondphi = atan2(secondpos.second, secondpos.first); - auto dphi = secondphi - firstphi; - if(dphi > M_PI) dphi -= 2.*M_PI; - if(dphi < -M_PI) dphi += 2*M_PI; - if(dphi < 0) charge = -1; + + TVector2 radial_vector( (X0-xpos), (Y0-ypos) ); + TVector2 first_hit_vector(firstpos.first-xpos,firstpos.second-ypos); + + auto del_phi = first_hit_vector.DeltaPhi(radial_vector); + + if (del_phi>0) charge = -1; return charge; } diff --git a/src/algorithms/tracking/TrackSeeding.h b/src/algorithms/tracking/TrackSeeding.h index 165c4b01b7..fa1ccb1c91 100644 --- a/src/algorithms/tracking/TrackSeeding.h +++ b/src/algorithms/tracking/TrackSeeding.h @@ -44,7 +44,7 @@ namespace eicrecon { Acts::SeedFinderOptions m_seedFinderOptions; Acts::SeedFinderOrthogonalConfig m_seedFinderConfig; - int determineCharge(std::vector>& positions) const; + int determineCharge(std::vector>& positions,float X0, float Y0, float xpos, float ypos) const; std::pair findPCA(std::tuple& circleParams) const; std::vector getSpacePoints(const edm4eic::TrackerHitCollection& trk_hits); std::unique_ptr makeTrackParams(SeedContainer& seeds); From d505f8c6d73c1d3221b43de05e34a32d058cf253 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 06:47:23 +0000 Subject: [PATCH 02/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/algorithms/tracking/TrackSeeding.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index 7a879e9401..fde57fea2b 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -188,7 +188,7 @@ std::unique_ptr eicrecon::TrackSeeding::make auto slopeZ0 = lineFit(rzHitPositions); const auto xypos = findPCA(RX0Y0); - + auto xpos = xypos.first; auto ypos = xypos.second; From 61fa9886052a40ce8298bed556327a6f828c2ba9 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Wed, 7 Feb 2024 12:19:15 -0500 Subject: [PATCH 03/12] whitespace fixes --- src/algorithms/tracking/TrackSeeding.cc | 4 ++-- src/algorithms/tracking/TrackSeeding.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index fde57fea2b..7345232389 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -194,7 +194,7 @@ std::unique_ptr eicrecon::TrackSeeding::make //Determine charge - int charge = determineCharge(xyHitPositions,X0,Y0,xpos,ypos); + int charge = determineCharge(xyHitPositions, X0, Y0, xpos, ypos); float theta = atan(1./std::get<0>(slopeZ0)); // normalize to 0>& auto del_phi = first_hit_vector.DeltaPhi(radial_vector); - if (del_phi>0) charge = -1; + if (del_phi > 0) charge = -1; return charge; } diff --git a/src/algorithms/tracking/TrackSeeding.h b/src/algorithms/tracking/TrackSeeding.h index fa1ccb1c91..6a9b9e42b6 100644 --- a/src/algorithms/tracking/TrackSeeding.h +++ b/src/algorithms/tracking/TrackSeeding.h @@ -44,7 +44,7 @@ namespace eicrecon { Acts::SeedFinderOptions m_seedFinderOptions; Acts::SeedFinderOrthogonalConfig m_seedFinderConfig; - int determineCharge(std::vector>& positions,float X0, float Y0, float xpos, float ypos) const; + int determineCharge(std::vector>& positions, float X0, float Y0, float xpos, float ypos) const; std::pair findPCA(std::tuple& circleParams) const; std::vector getSpacePoints(const edm4eic::TrackerHitCollection& trk_hits); std::unique_ptr makeTrackParams(SeedContainer& seeds); From d4a9e440357c5f535cd95a0fc5f47abd5cc9ccf0 Mon Sep 17 00:00:00 2001 From: Jeetendra Gupta Date: Sat, 10 Feb 2024 06:09:19 -0600 Subject: [PATCH 04/12] updates on charge calculation in trackseeding --- src/algorithms/tracking/TrackSeeding.cc | 26 ++++++++++++++++++------- src/algorithms/tracking/TrackSeeding.h | 2 +- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index 7345232389..ffd7221a62 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -4,7 +4,6 @@ #include "TrackSeeding.h" -#include "TVector2.h" #include #include #include @@ -26,6 +25,7 @@ #include #include #include +#include #if EDM4EIC_VERSION_MAJOR >= 5 #include @@ -271,22 +271,34 @@ std::pair eicrecon::TrackSeeding::findPCA(std::tuple>& positions, float X0, float Y0, float xpos, float ypos) const +int eicrecon::TrackSeeding::determineCharge(std::vector>& positions, const std::pair& PCA, std::tuple& RX0Y0) const { - // determine the charge by the bend angle of the first two hits + // determine the charge by the bend angle of the first two hits int charge = 1; + const auto& firstpos = positions.at(0); + auto hit_x = firstpos.first; + auto hit_y = firstpos.second; + + auto xpos = PCA.first; + auto ypos = PCA.second; - TVector2 radial_vector( (X0-xpos), (Y0-ypos) ); - TVector2 first_hit_vector(firstpos.first-xpos,firstpos.second-ypos); + float X0 = std::get<1>(RX0Y0); + float Y0 = std::get<2>(RX0Y0); - auto del_phi = first_hit_vector.DeltaPhi(radial_vector); + Acts::Vector2 radial(X0-xpos, Y0-ypos); + Acts::Vector2 hit(hit_x-xpos, hit_y-ypos); - if (del_phi > 0) charge = -1; + Eigen::Matrix2d matrix; + matrix << radial(0), radial(1), hit(0), hit(1); + auto det = matrix.determinant(); + + if (det > 0) charge = -1; return charge; } + /** * Circle fit to a given set of data points (in 2D) * This is an algebraic fit, due to Taubin, based on the journal article diff --git a/src/algorithms/tracking/TrackSeeding.h b/src/algorithms/tracking/TrackSeeding.h index 6a9b9e42b6..2f0b8d885b 100644 --- a/src/algorithms/tracking/TrackSeeding.h +++ b/src/algorithms/tracking/TrackSeeding.h @@ -44,7 +44,7 @@ namespace eicrecon { Acts::SeedFinderOptions m_seedFinderOptions; Acts::SeedFinderOrthogonalConfig m_seedFinderConfig; - int determineCharge(std::vector>& positions, float X0, float Y0, float xpos, float ypos) const; + int determineCharge(std::vector>& positions, const std::pair& PCA, std::tuple& RX0Y0) const; std::pair findPCA(std::tuple& circleParams) const; std::vector getSpacePoints(const edm4eic::TrackerHitCollection& trk_hits); std::unique_ptr makeTrackParams(SeedContainer& seeds); From 13c8de36161cc0d1ba93b99e4f065a173f4be873 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 10 Feb 2024 12:10:16 +0000 Subject: [PATCH 05/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/algorithms/tracking/TrackSeeding.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index ffd7221a62..2535208e2c 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -273,7 +273,7 @@ std::pair eicrecon::TrackSeeding::findPCA(std::tuple>& positions, const std::pair& PCA, std::tuple& RX0Y0) const { - // determine the charge by the bend angle of the first two hits + // determine the charge by the bend angle of the first two hits int charge = 1; const auto& firstpos = positions.at(0); From c5be85c39a684745e4789c16c6e878c28ffd69ce Mon Sep 17 00:00:00 2001 From: Jeetendra Gupta Date: Sat, 10 Feb 2024 06:26:09 -0600 Subject: [PATCH 06/12] update/ --- src/algorithms/tracking/TrackSeeding.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index 2535208e2c..1994f362f1 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -194,7 +194,7 @@ std::unique_ptr eicrecon::TrackSeeding::make //Determine charge - int charge = determineCharge(xyHitPositions, X0, Y0, xpos, ypos); + int charge = determineCharge(xyHitPositions, xypos, RX0Y0); float theta = atan(1./std::get<0>(slopeZ0)); // normalize to 0 Date: Sat, 10 Feb 2024 14:05:59 -0600 Subject: [PATCH 07/12] update --- src/algorithms/tracking/TrackSeeding.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index 1994f362f1..597bc1d528 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -273,7 +273,7 @@ std::pair eicrecon::TrackSeeding::findPCA(std::tuple>& positions, const std::pair& PCA, std::tuple& RX0Y0) const { - // determine the charge by the bend angle of the first two hits + int charge = 1; const auto& firstpos = positions.at(0); From c7833d3cbfe931b12fadb22b587113f38af535c8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 10 Feb 2024 20:06:21 +0000 Subject: [PATCH 08/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/algorithms/tracking/TrackSeeding.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index 597bc1d528..4275b07159 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -273,7 +273,7 @@ std::pair eicrecon::TrackSeeding::findPCA(std::tuple>& positions, const std::pair& PCA, std::tuple& RX0Y0) const { - + int charge = 1; const auto& firstpos = positions.at(0); From 58a191cb176d695c629704cb30dc925163fccb28 Mon Sep 17 00:00:00 2001 From: Jeetendra Gupta Date: Thu, 15 Feb 2024 18:05:49 -0600 Subject: [PATCH 09/12] update --- src/algorithms/tracking/TrackSeeding.cc | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index 4275b07159..6e4a9b285a 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -189,11 +189,8 @@ std::unique_ptr eicrecon::TrackSeeding::make auto slopeZ0 = lineFit(rzHitPositions); const auto xypos = findPCA(RX0Y0); - auto xpos = xypos.first; - auto ypos = xypos.second; //Determine charge - int charge = determineCharge(xyHitPositions, xypos, RX0Y0); float theta = atan(1./std::get<0>(slopeZ0)); @@ -206,6 +203,9 @@ std::unique_ptr eicrecon::TrackSeeding::make float qOverP = charge / p; //Calculate phi at xypos + auto xpos = xypos.first; + auto ypos = xypos.second; + auto vxpos = -1.*charge*(ypos-Y0); auto vypos = charge*(xpos-X0); @@ -274,8 +274,6 @@ std::pair eicrecon::TrackSeeding::findPCA(std::tuple>& positions, const std::pair& PCA, std::tuple& RX0Y0) const { - int charge = 1; - const auto& firstpos = positions.at(0); auto hit_x = firstpos.first; auto hit_y = firstpos.second; @@ -286,16 +284,15 @@ int eicrecon::TrackSeeding::determineCharge(std::vector>& float X0 = std::get<1>(RX0Y0); float Y0 = std::get<2>(RX0Y0); - Acts::Vector2 radial(X0-xpos, Y0-ypos); - Acts::Vector2 hit(hit_x-xpos, hit_y-ypos); + Acts::Vector3 B_z(0,0,1); + Acts::Vector3 radial(X0-xpos, Y0-ypos, 0); + Acts::Vector3 hit(hit_x-xpos, hit_y-ypos, 0); - Eigen::Matrix2d matrix; - matrix << radial(0), radial(1), hit(0), hit(1); - auto det = matrix.determinant(); + auto cross = radial.cross(hit); - if (det > 0) charge = -1; + float dot = cross.dot(z); - return charge; + return copysign(1., -dot); } From 08eb203c735ebba250b733712b3a85cb4cbefaba Mon Sep 17 00:00:00 2001 From: Jeetendra Gupta Date: Thu, 15 Feb 2024 18:24:36 -0600 Subject: [PATCH 10/12] update --- src/algorithms/tracking/TrackSeeding.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index 6e4a9b285a..435df366f0 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -290,7 +290,7 @@ int eicrecon::TrackSeeding::determineCharge(std::vector>& auto cross = radial.cross(hit); - float dot = cross.dot(z); + float dot = cross.dot(B_z); return copysign(1., -dot); } From 8581682c1db6baae6898021249d4bbe5e7ce83e7 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Thu, 15 Feb 2024 19:51:23 -0500 Subject: [PATCH 11/12] Update src/algorithms/tracking/TrackSeeding.cc --- src/algorithms/tracking/TrackSeeding.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index 435df366f0..8ecee8a252 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -25,7 +25,6 @@ #include #include #include -#include #if EDM4EIC_VERSION_MAJOR >= 5 #include From 68b853a940fec93229139fe103525a7149f6953d Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Mon, 19 Feb 2024 12:24:40 -0500 Subject: [PATCH 12/12] IWYU --- src/algorithms/tracking/TrackSeeding.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index 8ecee8a252..4491473623 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include