From a44185cf46cbd489e330c3a2215d3bc8e3e52da0 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Sat, 1 Feb 2014 18:04:00 +0100 Subject: [PATCH] Adjust parameters --- inst/cta/src/GCTAResponse.cpp | 2 +- src/model/GModelSky.cpp | 2 +- src/obs/GObservation.cpp | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/inst/cta/src/GCTAResponse.cpp b/inst/cta/src/GCTAResponse.cpp index 853c4c6..b462ad9 100644 --- a/inst/cta/src/GCTAResponse.cpp +++ b/inst/cta/src/GCTAResponse.cpp @@ -2281,7 +2281,7 @@ double GCTAResponse::nedisp(const GSkyDir& srcDir, GIntegral integral(&integrand); // Set integration precision - //integral.eps(1.0e-5); + integral.eps(1.0e-3); // Do Romberg integration nedisp += integral.romb(e_log_min, e_log_max); diff --git a/src/model/GModelSky.cpp b/src/model/GModelSky.cpp index 8984aea..d9aac39 100644 --- a/src/model/GModelSky.cpp +++ b/src/model/GModelSky.cpp @@ -1400,7 +1400,7 @@ double GModelSky::integrate_energy(const GEvent& event, GIntegral integral(&integrand); // Set integration precision - //integral.eps(1.0e-5); + integral.eps(1.0e-3); // Do Romberg integration emin = std::log(emin); diff --git a/src/obs/GObservation.cpp b/src/obs/GObservation.cpp index 904975f..597e018 100644 --- a/src/obs/GObservation.cpp +++ b/src/obs/GObservation.cpp @@ -1402,8 +1402,19 @@ double GObservation::npred_spec(const GModel& model, const GTime& obsTime) const { // Set integration energy interval in MeV - double emin = events()->ebounds().emin().MeV(); - double emax = events()->ebounds().emax().MeV(); + GEnergy e_min = events()->ebounds().emin(); + GEnergy e_max = events()->ebounds().emax(); + + // If model is sky model and observation uses energy dispersion then + // add margin + if (dynamic_cast(&model) != NULL && response().use_edisp()) { + e_min = response().ebounds_src(e_min).emin(); + e_max = response().ebounds_src(e_max).emax(); + } + + // Get energy interval in MeV + double emin = e_min.MeV(); + double emax = e_max.MeV(); // Throw exception if energy range is not valid if (emax <= emin) { -- libgit2 0.21.4