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


epevents (epevents-6.55) [xmmsas_20211130_0941-20.0.0]


Algorithm

   subroutine epevents

   *** Get program parameters from parameter input

   *** Open and check input file, copy to output file and condition outfile  
   infile   = dataSet(stringParameter("eventset"),READ)
     check if infile has EVENTS extension
     check if infile has EXPOSURE extension
   copyDataSet infile => outfile
   outfile = dataSet(stringParameter("outset"),MODIFY)
     create event attributes in EVENTS extension
     addColumn DETX,DETY,PHA\_GAIN,PHA\_CTI,PI,PAT\_TYP,PAT\_IND,PAT\_ORI,
                 PAT\_ID,PAT\_SEQ,PATTERN
     setNullValue PHA\_CTI,PI,PAT\_TYP,PAT\_IND,PAT\_ORI,PAT\_ID,
                 PAT\_SEQ,PATTERN
     open columns needed 
     do checks on quadrant and ccd numbers

   *** Get program parameters from dataset attributes
     get datamode to guide further processing 
        EpnPrimeFullWindow
        FastTiming          => no trailing event rejection
                               source position used to determine event time 
        FastBurst           => source position used to determine event time
     get number of events in data set
     get window dimensions and determine edges
     get source position for timing and burst mode
     get MIP rejection mode used in epframes
        NONE = mip columns not flagged
        SAS  = mip columns flagged
        COM  = mip columns and neighbours flagged

   *** Read and convolve bad pixel map
     check if bad pixel extension exists
     create bad pixel map (intensity codes bad pixel type)
     create convolved bad pixel map (mark pixels above, below, left and right 
       of a bad pixel, and mark edge pixels)
   
   *** Determine frame boundaries and discarded lines in frame 
     read number of frames and frame boundaries from exposure extension
     read discarded lines in frame from exposure extension

   do frame = firstFrame, lastFrame

      set parameters and allocate array size according to number of events
          in frame
     
      *** adjust bad pixel map and convolved bad pixel map according to
        mip rejection mode (MIP flagged columns correspond to bad pixels,
        neighbour columns are flagged like edge pixels)

      *** flag reemission events (if not timing mode)
        determine trailing event
        flag if PHA of trailing event is < reemissionthreshold 
          determined from PHA of preceding event
        count trailing events
  
      *** perform pattern analysis
        determine the pattern parameters PAT_TYP, PAT_IND, PAT_ORI 
          and PAT_SEQ
        mark uncertain patterns as invalid: if a single or the maximum of a 
          pattern coincides with a pixel of the convolved bad pixel map, 
          edge pixels are treated as if there was a bad pixel just outside 
          the sensitive area of the CCD
        check for MIPs
        count different pattern types
   
      *** collect PAT_Infos and combine into PATTERN and PAT_ID columns

      *** perform gain correction, use CAL routine CAL_pnGainCorrect

   enddo
   
   *** perform cti correction, use CAL routine CAL_pnCtiCorrect

   *** recombine the corrected amplitudes from each pattern (=> PI column)

   show results of trailing event and pattern analysis   

   *** convert raw unlinearized detection coordinates RAWX/Y into 
   corresponding physical location DETX/Y 

   *** Store statistics of pattern analysis as attributes in exposure extension

   end subroutine epevents



XMM-Newton SOC -- 2021-11-30