From 396a007ca517a1eb61a88f16ff4132351361c19a Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Wed, 14 Oct 2015 23:23:50 +0200 Subject: [PATCH] Add energy margin to energy boundary containment check. --- src/ctbin/ctbin.cpp | 7 +++++-- src/ctmodel/ctmodel.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ctbin/ctbin.cpp b/src/ctbin/ctbin.cpp index 13e8f07..8dce155 100644 --- a/src/ctbin/ctbin.cpp +++ b/src/ctbin/ctbin.cpp @@ -40,6 +40,9 @@ /* __ Coding definitions _________________________________________________ */ +/* __ Constants __________________________________________________________ */ +const GEnergy g_energy_margin(1.0e-12, "TeV"); + /*========================================================================== = = @@ -530,8 +533,8 @@ void ctbin::fill_cube(GCTAObservation* obs) // Determine energy bin. Skip if we are outside the energy range int index = m_ebounds.index(event->energy()); if (index == -1 || - !obs_ebounds.contains(m_ebounds.emin(index), - m_ebounds.emax(index))) { + !obs_ebounds.contains(m_ebounds.emin(index)+g_energy_margin, + m_ebounds.emax(index)-g_energy_margin)) { num_outside_ebds++; continue; } diff --git a/src/ctmodel/ctmodel.cpp b/src/ctmodel/ctmodel.cpp index 7777c33..9aa8bda 100644 --- a/src/ctmodel/ctmodel.cpp +++ b/src/ctmodel/ctmodel.cpp @@ -39,6 +39,9 @@ /* __ Coding definitions _________________________________________________ */ +/* __ Constants __________________________________________________________ */ +const GEnergy g_energy_margin(1.0e-12, "TeV"); + /*========================================================================== = = @@ -617,8 +620,8 @@ void ctmodel::fill_cube(const GCTAObservation* obs) // Skip bin if it is outside the energy range of the observation int index = cube_ebounds.index(bin->energy()); if (index == -1 || - !obs_ebounds.contains(cube_ebounds.emin(index), - cube_ebounds.emax(index))) { + !obs_ebounds.contains(cube_ebounds.emin(index)+g_energy_margin, + cube_ebounds.emax(index)-g_energy_margin)) { num_outside_ebds++; continue; } -- libgit2 0.21.4