Maximal Identical Regions for All Detectors Simultaneously

I had a project with a FOV whose spectrum varied strongly with position. Thus, in order to extract spectra from all detectors that could be used for fitting the soft proton contamination, it was necessary to extract exactly the same region on the sky for each detector. Of course, I wanted as large a region as possible. This is not a trivial selection expression to construct. It's not so much difficult as just painful.

For a MOS detector the expression for the FOV can be expressed as

circle$_{mos}$ && (chip1 || chip2 || chip3 || chip4 || chip5 || chip6 || chip7)

where the circle is an expression describing the FOV, and chipn is a description of the area covered by chip n. Since we don't generally lose parts of the pn, we can use an expression of the form

circle$_{pn}$ && box$_{pn}$.

If we are extracting events from the MOS1 detector, we need to extract in MOS1 detector coordinates, which means that we must translate the expression for the MOS2 FOV out of MOS2 detector coordinates into sky coordinates and then into MOS1 detector coordinates. Similarly, the expression for the pn must be similarly transformed from one set of detector coordinates to another. To extract events from the MOS2 detector, the FOV expressions for all of the other detectors must be converted to MOS2 detector coordinates. Similarly for the pn.

Assuming that we have the appropriate expressions in the appropriate detector coordinates, the selection expression for a single detector can be expressed as:

circle$_{MOS1}$ && (chip1-1 || chip1-2 || chip1-3 || chip1-4 || chip1-5 || chip1-6 || chip1-7) &&
circle$_{MOS2}$ && (chip2-1 || chip2-2 || chip2-3 || chip2-4 || chip2-5 || chip2-6 || chip2-7) &&
circle$_{pn}$ && box$_{pn}$


which is a rather cumbersome expression. Indeed, you'll get an error message that the expression is too large to store. For MOS1 this corresponds to:

((DETX,DETY) IN circle(109.0,-227.0,17158.0))&& (((DETX,DETY) IN box(-11.0,-0.5,6593.0,6604.5,0.00))|| ((DETX,DETY) IN box(6498.0,-13580.0,6594.0,6583.0,0.00))|| ((DETX,DETY) IN box(13255.0,-327.5,6595.0,6583.5,0.00))|| ((DETX,DETY) IN box(6562.0,13035.5,6593.0,6549.5,0.00))|| ((DETX,DETY) IN box(-6405.0,13112.5,6591.0,6591.5,0.00))|| ((DETX,DETY) IN box(-13167.0,-76.5,6593.0,6581.5,0.00))|| ((DETX,DETY) IN box(-6521.0,-13438.5,6600.0,6582.5,0.00)))&& ((DETX,DETY) IN circle(-63.8,-159.8,17088.0))&& (((DETX,DETY) IN box(219.4,-158.5,6593.0,6604.5,-90.00))|| ((DETX,DETY) IN box(-13181.0,-6861.9,6594.5,6584.5,-90.00))|| ((DETX,DETY) IN box(29.4,-13533.4,6595.5,6582.5,-90.00))|| ((DETX,DETY) IN box(13357.0,-6701.2,6596.0,6573.0,-90.00))|| ((DETX,DETY) IN box(13367.8,6480.6,6606.0,6595.0,-90.00))|| ((DETX,DETY) IN box(96.0,13059.5,6594.0,6593.5,-90.00))|| ((DETX,DETY) IN box(-13213.4,6456.1,6594.5,6573.0,-90.00)))&& ((DETX,DETY) IN circle(1163.6,-2521.3,18000.0))&& ((DETX,DETY) IN box(1163.6,-2521.3,16122.5,15642.0,-90.00))

For MOS2 this corresponds to:

((DETX,DETY) IN circle(57.2,-110.8,17158.0))&& (((DETX,DETY) IN box(-169.5,-223.4,6593.0,6604.5,90.00))|| ((DETX,DETY) IN box(13439.7,6213.8,6594.0,6583.0,90.00))||( (DETX,DETY) IN box(224.5,13033.8,6595.0,6583.5,90.00))|| ((DETX,DETY) IN box(-13168.3,6410.8,6593.0,6549.5,90.00))|| ((DETX,DETY) IN box(-13314.2,-6556.6,6591.0,6591.5,90.00))|| ((DETX,DETY) IN box(-160.5,-13385.5,6593.0,6581.5,90.00))|| ((DETX,DETY) IN box(13236.1,-6804.5,6600.0,6582.5,90.00)))&& ((DETX,DETY) IN circle(-12.5,-284.5,17088.0))&& (((DETX,DETY) IN box(-10.0,-0.5,6593.0,6604.5,0.00))|| ((DETX,DETY) IN box(6626.0,-13434.5,6594.5,6584.5,0.00))|| ((DETX,DETY) IN box(13362.0,-258.5,6595.5,6582.5,0.00))|| ((DETX,DETY) IN box(6600.0,13105.0,6596.0,6573.0,0.00))|| ((DETX,DETY) IN box(-6583.0,13182.0,6606.0,6595.0,0.00))|| ((DETX,DETY) IN box(-13229.0,-56.5,6594.0,6593.5,0.00))|| ((DETX,DETY) IN box(-6690.0,-13397.0,6594.5,6573.0,0.00)))&& ((DETX,DETY) IN circle(2356.8,934.4,18000.0))&& ((DETX,DETY) IN box(2356.8,934.4,16122.5,15642.0,0.00))

For the pn this corresponds to:

((DETX,DETY) IN circle(88.3,-34.3,17158.0))&& (((DETX,DETY) IN box(314.1,80.2,6593.0,6604.5,90.00))|| ((DETX,DETY) IN box(-13237.6,-6477.4,6594.0,6583.0,90.00))|| ((DETX,DETY) IN box(37.5,-13179.9,6595.0,6583.5,90.00))|| ((DETX,DETY) IN box(13371.1,-6438.5,6593.0,6549.5,90.00))|| ((DETX,DETY) IN box(13402.1,6529.7,6591.0,6591.5,90.00))|| ((DETX,DETY) IN box(188.3,13241.8,6593.0,6581.5,90.00))|| ((DETX,DETY) IN box(-13149.4,6542.2,6600.0,6582.5,90.00)))&& ((DETX,DETY) IN circle(154.9,136.3,17088.0))&& (((DETX,DETY) IN box(157.3,-146.8,6593.0,6604.5,0.00))|| ((DETX,DETY) IN box(-6596.5,13228.2,6594.5,6584.5,0.00))|| ((DETX,DETY) IN box(-13218.3,-7.2,6595.5,6582.5,0.00))|| ((DETX,DETY) IN box(-6335.9,-13309.0,6596.0,6573.0,0.00))|| ((DETX,DETY) IN box(6845.8,-13270.3,6606.0,6595.0,0.00))|| ((DETX,DETY) IN box(13374.7,26.2,6594.0,6593.5,0.00))|| ((DETX,DETY) IN box(6721.3,13310.7,6594.5,6573.0,0.00)))&& ((DETX,DETY) IN circle(-2201.5,-1101.0,18000.0))&& ((DETX,DETY) IN box(-2201.5,-1101.0,16122.5,15642.0,0.00))

If a chip has been turned off, then one can remove it by zeroing out its box size.