XMM-Newton SAS Home Page
XMM-Newton Science Analysis System


emsaplib (emsaplib-2.33) [xmmsas_20230412_1735-21.0.0]

energy combination

CAL_mosPhaBuild call:

Computes a single energy PHA (in ADU) for each event from a weighted sum of the E$_i$, and the residual background $Bkg(x,y)$ computed in CCDBKG, assumed not to vary with time (i.e. the time series output from CCDBKG is not used).
The coefficients $\alpha_1$,$\alpha_2$,$\alpha_3$,$\alpha_4$ are defined by the CAL from a CCF file. They have 1 value for each of the 32 patterns.
E$_1$ is entered as real in order to allow randomisation before calling CAL_mosPhaBuild.

Two different formulaes are used depending on whether $\alpha_4$ is positive or negative.

If $\alpha_4 \le 0$ (and normally $\ge -1$), then the idea is to use a weighted average of $E_4$ and $Bkg$ to estimate the local background. This is adapted to compact events.

$\displaystyle Wght$ $\textstyle =$ $\displaystyle \alpha_1 + \alpha_2 N_{above} + \alpha_3 (8-N_{above})$ 
$\displaystyle Pha$ $\textstyle =$ $\displaystyle \alpha_1 E_1 + \alpha_2 E_2 + \alpha_3 E_3 - Wght
\left((1+\alpha_4) Bkg - \frac{\alpha_4 E_4}{16-Peripix}\right)$(1)

If $\alpha_4 \ge 0$, then the idea is to use $E_4$ as part of the signal, and estimate the local background entirely from $Bkg$. This is adapted to events spread out over many pixels.

$\displaystyle Wght$ $\textstyle =$ $\displaystyle \alpha_1 + \alpha_2 N_{above} + \alpha_3 (8-N_{above})
+ \alpha_4 (16-Peripix)$ 
$\displaystyle Pha$ $\textstyle =$ $\displaystyle \alpha_1 E_1 + \alpha_2 E_2 + \alpha_3 E_3 + \alpha_4 E_4
- Wght \, Bkg$(2)

In both cases $N_{above}$ is the number of secondary pixels above threshold (for example 1 for bipixels). E$_4$ is used only where PERIPIX $<$ 7. E$_3$ and E$_4$ are not used if next to a bad line or column.

Depending on the calibration results (not yet known) the $\alpha_i$ may depend on the pattern and possibly also on energy. The idea is then to loop on emenergy for different selections on the events.

The C++ possible call are :

CalReal32Vector &EnergyCombinator::combine(const CalReal32Vector &energye1,
                                           const CalInt16Vector &energye2,
                                           const CalInt8Vector   &pattern,
                                           CalReal32Vector &pha,    // out
                                           
                                           const CalReal32Vector &locbkg, 
                                           const CalInt16Vector &energye3,
                                           const CalInt16Vector &energye4,
                                           const CalInt8Vector &peripix,
                                           const CalInt32Vector &flag
                                          )
Input: energye1 : array of real32 with event energy E1 energye2 : array of int16 with event energy E2 energye3 : array of int16 with event energy E3 (optional) energye4 : array of int16 with event energy E4 (optional) pattern : array of int8 with event pattern number peripix : array of int8 with event peripix number (optional) flag : array of int32 with event flag (optional) locbkg : array of real32 with event local background (optional) Out: pha : array of computed event PHA

energye3, energye4, peripix and flag : are present or not in the same time, while locbkg is optional independently. Which leads to 4 possible calls.

CalReal32Vector &EnergyCombinator::combine(const CalReal32Vector &energye1,
                                           const CalInt16Vector &energye2,
                                           const CalInt8Vector   &pattern,
                                           CalReal32Vector &pha     // out
                                          )

CalReal32Vector &EnergyCombinator::combine(const CalReal32Vector &energye1,
                                           const CalInt16Vector &energye2,
                                           const CalInt8Vector   &pattern,
                                           CalReal32Vector &pha,    // out
                                           
                                           const CalReal32Vector &locbkg
                                          )
CalReal32Vector &EnergyCombinator::combine(const CalReal32Vector &energye1,
                                           const CalInt16Vector &energye2,
                                           const CalInt8Vector   &pattern,
                                           CalReal32Vector &pha,    // out
                                           
                                           const CalInt16Vector &energye3,
                                           const CalInt16Vector &energye4,
                                           const CalInt8Vector &peripix,
                                           const CalInt32Vector &flag
                                          )
CalReal32Vector &EnergyCombinator::combine(const CalReal32Vector &energye1,
                                           const CalInt16Vector &energye2,
                                           const CalInt8Vector   &pattern,
                                           CalReal32Vector &pha,    // out
                                           
                                           const CalReal32Vector &locbkg, 
                                           const CalInt16Vector &energye3,
                                           const CalInt16Vector &energye4,
                                           const CalInt8Vector &peripix,
                                           const CalInt32Vector &flag
                                          )
The F90 possible call will be :

   subroutine CAL_mosPhaBuild(energye1, energye2, pattern, pha )
                             

   subroutine CAL_mosPhaBuild(energye1, energye2, pattern, pha,  &
                              locbkg )

   subroutine CAL_mosPhaBuild(energye1, energye2, pattern, pha,  &
                               energye3, energye4, peripix, flag)

   subroutine CAL_mosPhaBuild(energye1, energye2, pattern, pha,  &
                              locbkg, energye3, energye4, peripix, flag)

XMM-Newton SOC -- 2023-04-16