From bae227178fb2e2c7010c1b920291d9d18635a6b6 Mon Sep 17 00:00:00 2001 From: GianfrancoIngratta Date: Wed, 25 Sep 2024 13:09:25 +0200 Subject: [PATCH 1/3] corrected helicity term in function that get the reconstructed momentum from line and circle fit --- include/SANDRecoUtils.h | 29 +++++++-------------------- src/SANDRecoUtils.cpp | 44 +++++++++++------------------------------ 2 files changed, 19 insertions(+), 54 deletions(-) diff --git a/include/SANDRecoUtils.h b/include/SANDRecoUtils.h index 21f7e8e..22be427 100644 --- a/include/SANDRecoUtils.h +++ b/include/SANDRecoUtils.h @@ -253,23 +253,14 @@ class Circle return {x_l(angle), y_l(angle)}; } - TVector2 GetDerivativeAt(double angle) const { - return {dx_derivative(angle), dy_derivative(angle)}; - } - - TVector2 GetDerivativeAt(double arg_x, double arg_y) const { - double angle = GetAngleFromPoint(arg_x, arg_y); - return {dx_derivative(angle), dy_derivative(angle)}; - } + // TVector2 GetDerivativeAt(double angle) const { + // return {dx_derivative(angle), dy_derivative(angle)}; + // } - double GetAngleFromPoint(double arg_x, double arg_y) const { - // return the angle [0, 2pi) corresponding to the point (x,y) - if(arg_y - center_y_ > 0){ - return atan2(arg_y - center_y_, arg_x - center_x_); - }else{ - return atan2(arg_y - center_y_, arg_x - center_x_) + 2 * TMath::Pi(); - } - } + // TVector2 GetDerivativeAt(double arg_x, double arg_y) const { + // double angle = GetAngleFromPoint(arg_x, arg_y); + // return {dx_derivative(angle), dy_derivative(angle)}; + // } TF1* GetUpperSemiCircle() const { // y as function of the x coordinate @@ -659,12 +650,6 @@ double NLL(Helix& h,const std::vector& digits); // negativ double FunctorNLL(const double* p); -double GetDipAngleFromCircleLine(const Circle& circle, - const Line2D& line, - double Phi0, - int helicity, - TVector3& Momentum); - Helix GetHelixFromCircleLine(const Circle& circle, const Line2D& line, const Helix& true_helix, diff --git a/src/SANDRecoUtils.cpp b/src/SANDRecoUtils.cpp index 9d88922..6f68876 100644 --- a/src/SANDRecoUtils.cpp +++ b/src/SANDRecoUtils.cpp @@ -551,36 +551,6 @@ double RecoUtils::FunctorNLL(const double* p) return nll; } -double RecoUtils::GetDipAngleFromCircleLine(const Circle& circle, - const Line2D& line, - double Phi0, - int helicity, - TVector3& momentum){ - /* - input: - circle : fitted trajectory in the ZY bending plane - line : fitted trajectory in the XZ plane - Phi0 : angle corresponding to the trajecotry starting point - Momentum : reference TVector3 that will be filled with particle - total momentum - NOTE: a guess for the initial vertex is needed because related to the dip angle - */ - double pt = circle.R() * 0.3 * 0.6; - // define theta as the angle [0, 2 pi) between the momentum vector and z axis - double theta = Phi0 - helicity * TMath::Pi() / 2.; - double py = pt * sin(theta); - double pz = pt * cos(theta); - - // slope of the tangent in the zx plane - double pz_over_px = line.m(); - double px = pz / pz_over_px; - - // fill momentum - momentum = {px, py, pz}; - - return atan2(px, pt); -} - Helix RecoUtils::GetHelixFromCircleLine(const Circle& circle, const Line2D& line, const Helix& true_helix, @@ -598,10 +568,20 @@ Helix RecoUtils::GetHelixFromCircleLine(const Circle& circle, auto helicity = true_helix.h(); - double Phi0 = circle.GetAngleFromPoint(vertex.Z() ,vertex.Y()); + double pt = circle.R() * 0.29979 * 0.6; - double dip_angle = RecoUtils::GetDipAngleFromCircleLine(circle, line, Phi0, helicity, momentum); + double pz = pt * (helicity * (vertex.Y() - circle.center_y()) / circle.R()) + + double py = pt * (-helicity * (vertex.Z() - circle.center_x()) / circle.R()) + + double pz_over_px = line.m(); + + double px = pz / pz_over_px; + + double Phi0 = TMath::ATan2(py, pz) + helicity * TMath::Pi()*0.5;; + momentum = {px, py, pz}; + return Helix(circle.R(), dip_angle, Phi0, helicity, vertex); } From 6b771f0986c3572a4e1b853c39bb64d3097cca44 Mon Sep 17 00:00:00 2001 From: GianfrancoIngratta Date: Wed, 25 Sep 2024 13:13:16 +0200 Subject: [PATCH 2/3] updated gitignore ignore test folder --- .gitignore | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 358ed34..5075a76 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,4 @@ build/* *.sh *.png *.gdml -tests/*.root -tests/*.pdf -tests/*.png -tests/*.txt +tests/* \ No newline at end of file From 48296ee6541bda70a1836dc31ac3a5f19b53664e Mon Sep 17 00:00:00 2001 From: GianfrancoIngratta Date: Wed, 25 Sep 2024 13:16:05 +0200 Subject: [PATCH 3/3] updated gitignore ignore tests/python_tools/__pycache__/ folder --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5075a76..519214f 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ build/* *.sh *.png *.gdml -tests/* \ No newline at end of file +tests/* +tests/python_tools/__pycache__/ \ No newline at end of file