diff --git a/inst/cta/src/GCTAResponse.cpp b/inst/cta/src/GCTAResponse.cpp index 05865cd..8fa3260 100644 --- a/inst/cta/src/GCTAResponse.cpp +++ b/inst/cta/src/GCTAResponse.cpp @@ -64,8 +64,7 @@ " GEnergy&, GTime&, GObservation&)" #define G_NPRED "GCTAResponse::npred(GSkyDir&, GEnergy&, GTime&,"\ " GObservation&)" -#define G_MC "GCTAResponse::mc(double&,GPhoton&,GPointing&,GRan&)" - +#define G_MC "GCTAResponse::mc(double&, GPhoton&, GObservation&, GRan&)" #define G_IRF_RADIAL "GCTAResponse::irf_radial(GEvent&, GSource&,"\ " GObservation&)" #define G_IRF_ELLIPTICAL "GCTAResponse::irf_elliptical(GEvent&, GSource&,"\ @@ -471,6 +470,18 @@ GCTAEventAtom* GCTAResponse::mc(const double& area, const GPhoton& photon, // Compute limiting value double ulimite = effective_area / area; + // Warning if ulimite is larger than one + if (ulimite > 1.0) { + std::string msg = "Effective area "+ + gammalib::str(effective_area)+ + " cm2 is larger than simulation surface area "+ + gammalib::str(area)+ + " cm2 for photon energy "+ + gammalib::str(photon.energy().TeV())+ + " TeV. Simulations are inaccurate."; + gammalib::warning(G_MC, msg); + } + // Continue only if event is detected if (ran.uniform() <= ulimite) { @@ -1487,9 +1498,6 @@ double GCTAResponse::npred_radial(const GSource& source, GIntegral integral(&integrand); npred = integral.romb(rho_min, rho_max); - // Apply deadtime correction - npred *= obs.deadc(srcTime); - // Compile option: Show integration results #if defined(G_DEBUG_NPRED_RADIAL) std::cout << "GCTAResponse::npred_radial:"; @@ -1650,9 +1658,6 @@ double GCTAResponse::npred_elliptical(const GSource& source, GIntegral integral(&integrand); npred = integral.romb(rho_min, rho_max); - // Apply deadtime correction - npred *= obs.deadc(srcTime); - // Compile option: Show integration results #if defined(G_DEBUG_NPRED_ELLIPTICAL) std::cout << "GCTAResponse::npred_elliptical:"; @@ -1817,13 +1822,9 @@ double GCTAResponse::npred_diffuse(const GSource& source, // Integrate over theta GIntegral integral(&integrand); - //integral.eps(1.0e-4); - integral.eps(1.0e-5); + integral.eps(1.0e-4); npred = integral.romb(0.0, roi_psf_radius); - // Apply deadtime correction - npred *= obs.deadc(srcTime); - // Compile option: Show integration results #if defined(G_DEBUG_NPRED_DIFFUSE) std::cout << "GCTAResponse::npred_diffuse:";