diff --git a/inst/lat/src/GLATAeff.cpp b/inst/lat/src/GLATAeff.cpp index 7c9e871..6e5249d 100644 --- a/inst/lat/src/GLATAeff.cpp +++ b/inst/lat/src/GLATAeff.cpp @@ -164,6 +164,11 @@ double GLATAeff::operator() (const double& logE, const double& ctheta) double aeff = (ctheta >= m_min_ctheta) ? m_aeff_bins.interpolate(logE, ctheta, m_aeff) : 0.0; + // Make sure that effective area is not negative + if (aeff < 0.0) { + aeff = 0.0; + } + // Return effective area value return aeff; } @@ -185,6 +190,11 @@ double GLATAeff::operator() (const double& logE, const double& ctheta, double aeff = (ctheta >= m_min_ctheta) ? m_aeff_bins.interpolate(logE, ctheta, m_aeff) : 0.0; + // Make sure that effective area is not negative + if (aeff < 0.0) { + aeff = 0.0; + } + // Return effective area value return aeff; }