From 3a987319d4f2233942e994f61f13f9b28c2773fa Mon Sep 17 00:00:00 2001 From: froejdh_e Date: Wed, 5 Mar 2025 21:51:23 +0100 Subject: [PATCH] WIP --- src/ClusterFile.cpp | 6 +++--- src/Interpolator.cpp | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ClusterFile.cpp b/src/ClusterFile.cpp index 37b5e89..be3f607 100644 --- a/src/ClusterFile.cpp +++ b/src/ClusterFile.cpp @@ -422,10 +422,10 @@ Eta2 calculate_eta2(Cluster3x3 &cl) { Eta2 calculate_eta2(Cluster2x2 &cl) { Eta2 eta{}; - eta.x = static_cast(cl.data[0]) / (cl.data[0] + cl.data[1]); - eta.y = static_cast(cl.data[0]) / (cl.data[0] + cl.data[2]); + eta.x = static_cast(cl.data[1]) / (cl.data[0] + cl.data[1]); + eta.y = static_cast(cl.data[2]) / (cl.data[0] + cl.data[2]); eta.sum = cl.data[0] + cl.data[1] + cl.data[2]+ cl.data[3]; - eta.c = cBottomLeft; //TODO! This is not correct + eta.c = cBottomLeft; //TODO! This is not correct, but need to put something return eta; } diff --git a/src/Interpolator.cpp b/src/Interpolator.cpp index a4ecb94..0e72849 100644 --- a/src/Interpolator.cpp +++ b/src/Interpolator.cpp @@ -139,12 +139,14 @@ std::vector Interpolator::interpolate(const ClusterVector& clus }; auto ix = find_index(m_etabinsx, eta.x)-1; auto iy = find_index(m_etabinsy, eta.y)-1; + if(ix<0) ix=0; + if(iy<0) iy=0; - photon.x += (1-m_ietax(ix, iy, idx))*2; //eta goes between 0 and 1 but we could move the hit anywhere in the 2x2 - photon.y += (1-m_ietay(ix, iy, idx))*2; + photon.x += m_ietax(ix, iy, 0)*2; //eta goes between 0 and 1 but we could move the hit anywhere in the 2x2 + photon.y += m_ietay(ix, iy, 0)*2; // photon.x = ix; - // photon.y = iy; + // photon.y = idx; photons.push_back(photon); }