Bug #2663

GCTAOnOffObservation::apply_ebounds() cut on rmf gives strange spectral model fit results

Added by Specovius Andreas over 5 years ago. Updated over 5 years ago.

Status:ClosedStart date:08/16/2018
Priority:NormalDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:1.6.0
Duration:

Description

It seems like the method GCTAOnOffObservation::apply_ebounds() which accounts for the observations energy boundaries does something strange when cutting on the rmf.

The result of a spectral plaw model fit to pks2155 HESS PDR data seem to fit well our expectations for deactivated cut on rmf, but deviates for activated cut on rmf:

      | Reference (hess tool, gammapy) | joint, activated cut on rmf | joint, deactivated cut on rmf
------+--------------------------------+-----------------------------+-------------------------------
Norm  |      1.802 +- 0.212 e-11       |  2.236 +- 0.242 e-11 (+24%) |  1.814 +- 0.213 e-11 (+0.7%)
Index |      3.429 +- 0.269            |  3.758 +- 0.265      (+10%) |  3.393 +- 0.268      (-1.1%)

I am using ctools/gammalib dev Aug 04 version.

47803.png - rmf sum(ereco) for all etrue bins (run047803) (50.4 KB) Specovius Andreas, 08/16/2018 01:30 PM

pred_spec_no_cut_on_rmf.png - Predicted spectrum vs measured on-counts for one run (cut on rmf=no; Aeff beyond thresholds=0) (6.1 KB) Specovius Andreas, 09/05/2018 03:24 PM

pred_counts_rmf_cut_AeffNotZero.png - Predicted spectrum vs measured on-counts for one run (cut on rmf=yes; Aeff beyond thresholds<>0) (6.53 KB) Specovius Andreas, 09/05/2018 03:25 PM

47803 Pred_spec_no_cut_on_rmf Pred_counts_rmf_cut_aeffnotzero

Recurrence

No recurrence.

History

#1 Updated by Specovius Andreas over 5 years ago

May it be a problem, that the rmf is not re-normalized to unity after the cuts are applied?

For testing purposes I calculated a sum in the way shown below. The sums for different locations in the code are shown in the plot.

for (int itrue=0; itrue<ntrue; ++itrue) {
    double sum = 0;
    for (int ireco=0; ireco<nreco; ++ireco) {
        sum += m_rmf(itrue, ireco);
    }
}

rmf sum(ereco) for all etrue bins (run047803)

If I apply a quick renormalization via dividing per etrue bin by the just calculated sum the fit result enhances a bit:

      | Reference (hess tool, gammapy) | joint, activated cut on rmf, renormalized
------+--------------------------------+-------------------------------------------
Norm  |      1.802 +- 0.212 e-11       |         1.957 +- 0.210 e-12 (+9%)
Index |      3.429 +- 0.269            |         3.568 +- 0.256.     (+4%)

#2 Updated by Specovius Andreas over 5 years ago

Specovius Andreas wrote:

May it be a problem, that the rmf is not re-normalized to unity after the cuts are applied?

For testing purposes I calculated a sum in the way shown below. The sums for different locations in the code are shown in the plot.
[...]

rmf sum(ereco) for all etrue bins (run047803)

If I apply a quick renormalization via dividing per etrue bin by the just calculated sum the fit result enhances a bit:

[...]

Actually a re-normalization improved the fit results slightly, but should probably not be done.. The incoming gamma-likes having true energies above the thresholds but being reconstructed to energies below the thresholds are also simply cut away. So this is alike.

#3 Updated by Specovius Andreas over 5 years ago

I think the underlying problem is something different and disabling the cut on the rmf and/or renormalizing the energy dispersion are just something that patched the actual issue (maybe by chance to reasonable fit results):

We discussed in our group here in Erlangen and we think that the effective area should not be zero beyond the energy threshold (at least for the case where energy dispersion is enabled!). As this seems to be a different major topic I opened a new issue: https://cta-redmine.irap.omp.eu/issues/2674

A zero effective area beyond the threshold prevents the model flux with true energies below the threshold from contributing to the predicted counts above and in the vicinity of the threshold although their probability of being reconstructed to energies above the threshold may be >0 (depends on specific edisp!).

This would mean that the predicted counts in the vicinity of the threshold are systematically underestimated.

why did renormalization improve results?

Hence, indeed renormalization of the energy dispersion after the cut on the rmf was applied improves the fit results as the predicted counts in the vicinity of the thresholds, which are underestimated, are “manually” scaled up.

why did disabling the cuts on the rmf improve results?

This is pretty sure due to the full contribution of the energy dispersion to the predicted flux also beyond thresholds. See the following plot showing the predicted flux expanding beyond thresholds when the cut on the rmf is not done (here, effective area is zero beyond thresholds, how it is implemented in ctools).
Predicted spectrum vs measured on-counts for one run (cut on rmf=no; Aeff beyond thresholds=0)

For comparison the following plot shows the predicted flux when the cut on the rmf is done but the effective area is not set to zero beyond thresholds.
Predicted spectrum vs measured on-counts for one run (cut on rmf=yes; Aeff beyond thresholds<>0)

#4 Updated by Knödlseder Jürgen over 5 years ago

Thanks for doing this detailed study. I have current a few important things to do on my desk, and the CTAC meeting is coming closer, but I will help you with that as soon as I find some time.

#5 Updated by Knödlseder Jürgen over 5 years ago

  • Assigned To set to Knödlseder Jürgen
  • Target version set to 1.6.0

I fixed the application of the energy threshold in #2674. Does this also fix this issue?

#6 Updated by Specovius Andreas over 5 years ago

Indeed. This issue seems to be closed!

#7 Updated by Knödlseder Jürgen over 5 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF