Commit bf27cf6fb126bd8101d7c96557b005166a7e96dd

Authored by knodlseder
1 parent 3481cd34

make sure that Aeff is not negative

Showing 1 changed file with 10 additions and 0 deletions
inst/lat/src/GLATAeff.cpp
@@ -164,6 +164,11 @@ double GLATAeff::operator() (const double& logE, const double& ctheta) @@ -164,6 +164,11 @@ double GLATAeff::operator() (const double& logE, const double& ctheta)
164 double aeff = (ctheta >= m_min_ctheta) 164 double aeff = (ctheta >= m_min_ctheta)
165 ? m_aeff_bins.interpolate(logE, ctheta, m_aeff) : 0.0; 165 ? m_aeff_bins.interpolate(logE, ctheta, m_aeff) : 0.0;
166 166
  167 + // Make sure that effective area is not negative
  168 + if (aeff < 0.0) {
  169 + aeff = 0.0;
  170 + }
  171 +
167 // Return effective area value 172 // Return effective area value
168 return aeff; 173 return aeff;
169 } 174 }
@@ -185,6 +190,11 @@ double GLATAeff::operator() (const double&amp; logE, const double&amp; ctheta, @@ -185,6 +190,11 @@ double GLATAeff::operator() (const double&amp; logE, const double&amp; ctheta,
185 double aeff = (ctheta >= m_min_ctheta) 190 double aeff = (ctheta >= m_min_ctheta)
186 ? m_aeff_bins.interpolate(logE, ctheta, m_aeff) : 0.0; 191 ? m_aeff_bins.interpolate(logE, ctheta, m_aeff) : 0.0;
187 192
  193 + // Make sure that effective area is not negative
  194 + if (aeff < 0.0) {
  195 + aeff = 0.0;
  196 + }
  197 +
188 // Return effective area value 198 // Return effective area value
189 return aeff; 199 return aeff;
190 } 200 }