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


evigweight (evigweight-1.8) [xmmsas_20230412_1735-21.0.0]


Algorithm

MODULE em_events_module

   Read the parameters
   Open events file
   If newoutput then  clone events file
   Read columns PI, DETX, DETY, RAWX, RAWY, CCDNR (if it exists)
   Create column WEIGHT (or enable modifications if it already exists)

   Set CAL state to central CCD
   call CAL_telCoordToCamCoord2(0,0,xmm2,ymm2,zmm2)
   call CAL_camCoord2ToCamCoord1(xmm2,ymm2,zmm2,xmm1,ymm1,zmm1)
   call CAL_camCoord1ToChipCoord(xmm1,ymm1,zmm1,RAWX0,RAWY0)
   Loop over PI
      eff0 = effarea(PI,0,0,RAWX0,RAWY0)
   end loop

   Set CAL state to current CCD
   call CAL_getMiscellaneousData('FOCAL_LENGTH',focalLength)
   step = 1. / realAttribute(detx_col,'TCDLT')
   conv = step * 180.d0 / pi / focalLength
   Loop over events
      if CCDNR exists and CCDNR changed then  set CAL state to new CCD
      if not (OUT_OF_FOV or OUT_OF_CCD_WINDOW or OUTSIDE_THRESHOLDS) then
         call CAL_camCoord2ToTelCoord(DETX/conv,DETY/conv,0,theta,phi)
         WEIGHT = eff0(PI) / effarea(PI,theta,phi,RAWX,RAWY)
      endif
   end loop

   Close events file

FUNCTION effarea(PI,DETX,DETY,RAWX,RAWY)

   effarea = 1.
   E0 = min(max(PI,100),14000)
   if witheffectivearea then
      effarea = effarea * CAL_getEffectiveArea(E0, theta, phi)
   if withfiltertransmission then
      effarea = effarea * CAL_getFilterTransmission(E0, theta, phi)
   if withquantumefficiency then
      effarea = effarea * CAL_getQuantumEfficiency(E0, RAWX, RAWY)

end module



XMM-Newton SOC -- 2023-04-16