The SAS task rmfgen includes an option to correct for the flux loss and energy distortion caused by the pile-up of photons within a single frame. It does this by generating a redistribution matrix that attempts to compensate for the pile-up effects, which are calculated from the frequency and spectrum of the incoming photons. Because of this, rmfgen needs to read a raw event file to make the pile-up correction. This file should contain all the charges which landed on the CCD where the source is centred. The raw event file is not created by default by the SAS processing. It has to be produced in one of the following ways:
which produces a raw event file for each CCD with the name eventsCCD[#].dat, or,
which produces a raw event file for each CCD with the name *_CCD[#]_PileupEvts.ds.
where [#] in both cases indicates the CCD number, most commonly CCD4 where the boresight is located.
The pile-up correction technique used is very compute-intensive, the execution time is of the order of hours for typical observations. This correction technique can only be applied to EPIC-pn imaging modes.
It is also possible at the same time to correct for X-ray loading. The X-ray loading correction is only necessary for EPIC-pn imaging modes. For Timing mode, this is dealt with by SAS automatically, while for MOS, the correction is not necessary.
For this purpose, run the previous commands with options:
epchain keepintermediate=all runepxrlcorr=yes
epproc pileuptempfile=yes runepxrlcorr=yes
This produces an output event file with corrected energies.
Once the corrected response file is produced, one can proceed in the usual way. More details are given in the pile-up thread.