The mask-weight count rate for a particular photon energy is derived in terms of the source flux, the transparency of the lead tiles and other passive materials, and the effective area of a single detector.
Photons/s/cm2 (from source) arriving at the detector if no absorbing materials were in the way:
Photons/s/cm2 arriving at the detector if absorbing material is in the way:

Photons/s/cm2 arriving at the detector if a lead tile is also partly in the way:
, where
We will now introduce a new quantity called the "mask-weighting factor", w, defined as:

where C is chosen so that w satisfies the equation:

It turns out that C≅1.
K may be chosen in a number of different ways, depending on the
"corrections" options given when running batmaskwtimg or
batmaskwtevt (hereafter I refer only to batmaskwtimg, but it is
implied that batmaskwtevt behaves in the same way).
More on this later.
Substituting w into the expression for photons/s/cm2 above gives:

Counts/s measured by the detector that result from photons which propagate directly from the source:

Total Counts/s measured by the detector (including background counts):

To generate a "mask-weighted" count rate that eliminates background counts, the individual count rates are added together, weighted by the mask-weighting factor:

If we assume that:


(because of how the constant C was chosen).
Parenthetically,
is approximately equal to a constant multiplied by the number of detectors
in the sum. This constant, which depends only upon the distance between the
source and the array, is approximately 0.54 for a source at infinity.
By default, K is chosen so that

With K chosen in this way, the mask-weighted count rate becomes:

Note that at low photon energies, fPb ≅ 0, so the count rate is just the expected count rate for a detector that is not shadowed by the mask. At higher photon energies, fPb approaches 1, so that as the mask becomes more and more transparent, the mask-weighted count rate decreases to 0.
B does not actually have to be the same for every detector for it to cancel out of the expression. It just needs to satisfy ∑B⋅w = 0 (that is, B must not be correlated with w), which can more reasonably be assumed to be true.
To find the number of counts/s in a particular energy bin, the same analysis applies. In that case, Aeff would be the effective area of a detector corresponding to that energy bin (in other words, the number of counts/s depositing their energy in that energy bin per incident photon/s/cm2).
By default (when the "corrections" parameter of batmaskwtimg is set to "default", which is equivalent to "flatfield,ndets,pcode,maskwt"), the contant "K" is equal to cosedge*NGOODPIX*PCODEFR*0.27, where
With these corrections,
as described above, and the pha file is
normalized to "the number of counts/s per fully illuminated on-axis detector"
batmaskwtimg creates a keyword called MSKWTSQF (historically short for "mask-weight squared factor") that carries over into the pha file. The keyword contains information about which corrections were applied, and batdrmgen uses it to normalize the response matrix.
In the "corrections=default" case described above, the MSKWTSQF keyword is 1/cosedge.
The rule is:
Here are some examples:
| Corrections | K | MSKWTSQF |
|---|---|---|
| flatfield,ndets,pcode,maskwt | cosedge*NGOODPIX*PCODEFR*0.27 | 1/cosedge |
| ndets,pcode,maskwt | NGOODPIX*PCODEFR*0.27 | 1 |
| flatfield,maskwt | cosedge*0.27 | NGOODPIX*PCODEFR/cosedge |
| flatfield | cosedge | NGOODPIX*PCODEFR*0.27/cosedge |
| ndets,pcode | NGOODPIX*PCODEFR | 0.27 |
| maskwt | 0.27 | NGOODPIX*PCODEFR |
| (none) | 1 | NGOODPIX*PCODEFR*0.27 |