Dealing with background in XSPEC

When the background requires a different response to the source

Suppose we have a model for the background spectrum which requires a different response to that for the source spectrum. Read in the source and background spectra as separate files :

XSPEC12>data 1:1 source.pha 2:2 back.pha

The source and background files have their own response matrices :

XSPEC12>response 1 source.rsp 2 back.rsp

Set up the model for the source. Here we will take the simple case of an absorbed power-law :

XSPEC12>model phabs(pow)

Input parameter value, delta, min, bot, top, and max values for ...

1:data group 1::phabs:nH>

2:data group 1::powerlaw:PhoIndex>

3:data group 1::powerlaw:norm>

Input parameter value, delta, min, bot, top, and max values for ...

4:data group 2::phabs:nH>

5:data group 2::powerlaw:PhoIndex>

6:data group 2::powerlaw:norm>0 0

Note that we have fixed the normalization of the source model for the background dataset at zero so it doesn't contribute. Now we need to set up the background model for both datasets with its own response matrix.

XSPEC12>response 2:1 back.rsp 2:2 back.rsp

This tells xspec that both these datasets have a second model which must be multiplied by the back.rsp response matrix. We now define the background model to be used. In this case take the simple example of a single power-law

XSPEC12>model 2:myback pow

Input parameter value, delta, min, bot, top, and max values for ...

1:myback:data group 1::powerlaw:PhoIndex>

2:myback:data group 1::powerlaw:norm>

Input parameter value, delta, min, bot, top, and max values for ...

3:myback:data group 2::powerlaw:PhoIndex>

4:myback:data group 2::powerlaw:norm>

We have now set up xspec so that the source data is modeled by a source model multiplied by the source response plus a background model multiplied by the background response and the background data is modeled by the background model multiplied by the background response. The background models fitted to the source and background data are constrained to be the same.

XSPEC12>show model

Current model list:

======================================================================== Model phabs<1>*powerlaw<2> Source No.: 1 Active/On Model Model Component Parameter Unit Value

======================================================================== Model myback:powerlaw<1> Source No.: 2 Active/On Model Model Component Parameter Unit Value