The LAT does not measure the energy of the photons with infinite precision. The finite energy resolution of the LAT called the energy dispersion has been characterized by the LAT team and this information is part of the IRFs.

For Pass 8, the energy resolution is <10% between 1 GeV and 100 GeV, which is sufficient to limit the spectral distortion to less than 5% in this energy range. Below 1 GeV the energy measurement is more difficult and the energy resolution worsens: it is ∼20% at 100 MeV and ∼28% at 30 MeV. As a consequence, ignoring energy dispersion when analyzing data below 300 MeV can induce potentially large systematic errors in the spectral fits of sources. While the energy dispersion correction reduces systematic uncertainties at all energies, the correction is particularly important below 100 MeV where the induced fractional change in the counts spectrum can easily exceed the statistical uncertainties. Therefore the LAT team strongly recommends enabling the energy dispersion correction for any analysis of data below 100 MeV.

This page describes the recommended practices for modeling energy dispersion in science analysis and the internal implementation of the energy dispersion correction in the *Fermi* Science Tools. For analyses that neglect the energy dispersion correction, estimates of the the induced systematic uncertainties on the spectrum of a source are provided.

The correction for energy dispersion is disabled by default when performing likelihood analysis with the Science Tools. Currently it is possible to take into account energy dispersion only in the case of a binned analysis. When using pyLikelihood, energy dispersion can be enabled with the **set_edisp_flag** method:

```
>>> obs = BinnedObs(srcMaps='srcmap.fits',expCube='ltcube.fits',binnedExpMap='bexpmap.fits',irfs='CALDB')
```

>>> like = BinnedAnalysis.BinnedAnalysis(binnedData=obs,srcModel='srcmdl.xml')

>>> like.logLike.set_edisp_flag(True) # Enable energy dispersion

>>> like.logLike.use_edisp() # Check if energy dispersion is enabled

When using the **gtlike** tool, the correction for energy dispersion can be enabled by setting the **USE_BL_EDISP** environment variable to true before executing gtlike at the command-line:

```
prompt> export USE_BL_EDISP=true # bash
```

prompt> setenv USE_BL_EDISP true # c-shell

By default the energy dispersion correction is applied to all components of the model. The correction may be disabled for individual components by setting **apply_edisp=false** in the spectrum element of that component in the XML model file. The following example demonstrates how to disable energy dispersion for the isotropic component:

```
<source name="iso_P8R3_SOURCE_V2_v1" type="DiffuseSource">
```

<spectrum file="$(FERMI_DIR)/refdata/fermi/galdiffuse/iso_P8R3_SOURCE_V2_v1.txt" type="FileFunction" apply_edisp="false">

<parameter free="1" max="1000" min="1e-05" name="Normalization" scale="1" value="1" />

</spectrum>

<spatialModel type="ConstantValue">

<parameter free="0" max="10.0" min="0.0" name="Value" scale="1.0" value="1.0"/>

</spatialModel>

</source>

We recommend that you disable the energy dispersion correction for any model components that have already been corrected for energy dispersion or were fit to the data without taking energy dispersion into account. For 4FGL data products this only applies to the isotropic template. For analysis using older diffuse models (gll_iem_v06.fits or older) the energy dispersion should also be turned off for the diffuse model, as well as any point-like or extended sources for which the spectral parameters are fixed to the 3FGL (also applies to 2FGL and 1FGL) values.

When the energy dispersion correction is enabled, the *Fermi* Science Tools internally add two energy bins above and below the analysis energy range when evaluating the counts model. These additional bins are used to evaluate the contribution of events with true energies outside the range of reconstructed energies used in the analysis. Depending on the chosen bin width and energy range, these two additional energy bins may not be sufficient to accurately evaluate the counts model near the edges of the energy range. Therefore when performing a binned analysis in which the energy dispersion correction is enabled, the LAT team recommends that you prepare the analysis over a wider energy range than the one in which the spectral fit will be performed. The spectral fit energy range can be controlled in python with the **setEnergyRange(emin,emax)** method of the **BinnedAnalysis** class. The choice of the adequate energy range depends on the energy bin width as well as the energy threshold, and it is left to the user. It must be noted that the level of spectral distortion due to energy dispersion depends also on the source spectrum, especially in the case of sharp features (like an exponential cutoff).

The energy dispersion correction occurs in the calculation of the model counts spectrum at each iteration of the likelihood fit. The Science Tools internally translate the energy dispersion response functions contained in the IRFs into a Detector Response Matrix, that describes how the true energies are redistributed in measured energies. For a binned analysis with *n* bins in log*E* between log*E _{min}* and log

For each source in the model, the energy dispersion correction is performed as follows:

- the vector
*v*of the number of predicted counts (in log_{true}*E*bins) in the entire ROI is computed_{true} - two additional bins (one below log
*E*and one above log_{min}*E*) are added to_{max}*v*, extrapolating the counts in the neighboring bins_{true} *v*(in log_{meas}*E*bins) = DRM x_{meas}*v*_{true}- the number of predicted counts in the pixels in energy bin
*i*are all scaled by the factor*v*[_{meas}*i*]/v_{true}[*i*]

NOTE:The current energy dispersion correction in the Science Tools does not take into account the interplay between the energy dispersion and PSF. As a consequence, even if the counts spectrum integrated over the ROI is well predicted, the spatial distribution is not perfectly reproduced. The LAT team is currently working on assessing and improving this aspect.

Because of energy dispersion, the number of counts in a given bin of measured energy is the sum of counts at various true energies. In order to predict the number of counts in a given bin of measured energy, one must take into account the spectrum and the IRFs in a larger energy range than the width of the bin. That is why the Science Tools add two energy bins (one below log*E _{min}* and one above log

Neglecting the effect of energy dispersion introduces systematic errors in both the shape and normalization of the count spectrum. The effect of energy dispersion is largest at low energies (< 100 MeV) but also induces a smaller systematic offset in the flux normalization at higher energies. The following plot shows the induced bias in the counts spectrum versus energy for P8R2_SOURCE_V6 IRFs calculated for power-law sources of different spectral indices. Above 300 MeV the induced bias is less than 5% but rises rapidly below this energy. The effect of energy dispersion is largest for sources with soft spectra (those with spectral index larger than 2), particularly in the energy range between 30 MeV and 300 MeV.

**Image Caption:** The bias on the counts spectrum as a function of energy for different spectral indices with the P8R2_SOURCE_V6 IRFs. The dashed lines are drawn at a bias of ± 5%.

In order to quantify the error due to ignoring energy dispersion on the spectrum parameters, one can use a gtobssim simulation of a point source with a power-law spectrum and perform a binned analysis between 100 MeV and 100 GeV with 10 bins per decade. The following table gives the comparison of the measured spectrum with the input spectrum for various spectral indices:

Spectral Index | flux > 100 MeV / true flux | Measured Spectral Index |
---|---|---|

-1.50 | 1.02 | -1.51 |

-1.75 | 1.03 | -1.76 |

-2.00 | 1.05 | -2.02 |

-2.25 | 1.07 | -2.28 |

-2.50 | 1.08 | -2.53 |

-2.75 | 1.15 | -2.81 |

-3.00 | 1.18 | -3.07 |