From 0c4f639abcdbb45273c343caf5499e832047fcea Mon Sep 17 00:00:00 2001
From: Guang Zhao <zhaog@ihep.ac.cn>
Date: Mon, 23 Dec 2024 11:15:15 +0800
Subject: [PATCH] fix costheta bug

---
 Service/SimplePIDSvc/src/SimplePIDSvc.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Service/SimplePIDSvc/src/SimplePIDSvc.cpp b/Service/SimplePIDSvc/src/SimplePIDSvc.cpp
index 5ccece5b..ecdeedf3 100644
--- a/Service/SimplePIDSvc/src/SimplePIDSvc.cpp
+++ b/Service/SimplePIDSvc/src/SimplePIDSvc.cpp
@@ -29,12 +29,12 @@ double SimplePIDSvc::getDndx(double mean, double sigma) {
 
 double SimplePIDSvc::getDndxMean(double bg, double cos)
 {
-    return interpolate(m_dndxMean, bg, cos);
+    return interpolate(m_dndxMean, bg, fabs(cos));
 }
 
 double SimplePIDSvc::getDndxSigma(double bg, double cos, double len)
 {
-    return interpolate(m_dndxSigma, bg, cos)/sqrt(len*0.1); // len in mm, need to convert to cm
+    return interpolate(m_dndxSigma, bg, fabs(cos))/sqrt(len*0.1); // len in mm, need to convert to cm
 }
 
 double SimplePIDSvc::getChi2(double dndx_meas, double dndx_exp, double dndx_sigma) {
-- 
GitLab