Q1: What is shown in GAIN.cbf?
A1: A "gain map" which represents the value of the gain mapped on the detector.
Q2: How are the gain values calculated?
A2: Each gain value is calculated for a (2*NBX+1)*(2*NBY+1) pixel sized box (NBX and NBY can be adjusted in XDS.INP; their default is 3) centered on the position where that particular gain value is to be stored in GAIN.cbf . That gain value is calculated as the variance of the pixels in that box, divided by the average of the pixels in that box. The result is smoothed. NB: you can easily do this calculation for yourself, by reading e.g. a single frame with a self-written program written in Fortran or C, so there's nothing mysterious about it. It is just an empirical fact that all detectors seem to produce these deviations from homogeneity across their surface, in this calculation.
Q3: How are the gain values used inside XDS?
A3: They are used to calculate the variances of the intensities of the reflections in the dataset that XDS processes.
Q4: Why does XDS not use a fixed GAIN value for a specific detector, like e.g. MOSFLM does?
A4: Because the gain is in reality variable, as shown in A2.
Q5: Does it matter? Is it important to use the values in GAIN.pck instead of a single fixed value for the detector?
A5: I don't know how big the influence is, but it is certainly related to the variation of the gain values themselves. As this variation is often more than 20% or so I'd guess that it is a good idea to take the information in GAIN.cbf into account. Remember: only the variances of the intensities are affected by the gain values, not the intensities themselves.
Q6: Why is the gain not constant across the detector?
A6: This is something you should ask the detector manufacturer. I'd guess that the detectors are calibrated in a flood-field experiment such that a homogeneous exposure produces the same readout everywhere on the detector. This would constitute an intensity calibration, but the variance is not calibrated by this automatically at the same time! This means that e.g. the fiber optics can still be seen in the gain map.