Commit a44185cf46cbd489e330c3a2215d3bc8e3e52da0

Authored by Jürgen Knödlseder
1 parent c65054ff

Adjust parameters

inst/cta/src/GCTAResponse.cpp
@@ -2281,7 +2281,7 @@ double GCTAResponse::nedisp(const GSkyDir& srcDir, @@ -2281,7 +2281,7 @@ double GCTAResponse::nedisp(const GSkyDir& srcDir,
2281 GIntegral integral(&integrand); 2281 GIntegral integral(&integrand);
2282 2282
2283 // Set integration precision 2283 // Set integration precision
2284 - //integral.eps(1.0e-5); 2284 + integral.eps(1.0e-3);
2285 2285
2286 // Do Romberg integration 2286 // Do Romberg integration
2287 nedisp += integral.romb(e_log_min, e_log_max); 2287 nedisp += integral.romb(e_log_min, e_log_max);
src/model/GModelSky.cpp
@@ -1400,7 +1400,7 @@ double GModelSky::integrate_energy(const GEvent& event, @@ -1400,7 +1400,7 @@ double GModelSky::integrate_energy(const GEvent& event,
1400 GIntegral integral(&integrand); 1400 GIntegral integral(&integrand);
1401 1401
1402 // Set integration precision 1402 // Set integration precision
1403 - //integral.eps(1.0e-5); 1403 + integral.eps(1.0e-3);
1404 1404
1405 // Do Romberg integration 1405 // Do Romberg integration
1406 emin = std::log(emin); 1406 emin = std::log(emin);
src/obs/GObservation.cpp
@@ -1402,8 +1402,19 @@ double GObservation::npred_spec(const GModel& model, @@ -1402,8 +1402,19 @@ double GObservation::npred_spec(const GModel& model,
1402 const GTime& obsTime) const 1402 const GTime& obsTime) const
1403 { 1403 {
1404 // Set integration energy interval in MeV 1404 // Set integration energy interval in MeV
1405 - double emin = events()->ebounds().emin().MeV();  
1406 - double emax = events()->ebounds().emax().MeV(); 1405 + GEnergy e_min = events()->ebounds().emin();
  1406 + GEnergy e_max = events()->ebounds().emax();
  1407 +
  1408 + // If model is sky model and observation uses energy dispersion then
  1409 + // add margin
  1410 + if (dynamic_cast<const GModelSky*>(&model) != NULL && response().use_edisp()) {
  1411 + e_min = response().ebounds_src(e_min).emin();
  1412 + e_max = response().ebounds_src(e_max).emax();
  1413 + }
  1414 +
  1415 + // Get energy interval in MeV
  1416 + double emin = e_min.MeV();
  1417 + double emax = e_max.MeV();
1407 1418
1408 // Throw exception if energy range is not valid 1419 // Throw exception if energy range is not valid
1409 if (emax <= emin) { 1420 if (emax <= emin) {