;+
; Project     :	SOHO - CDS
;
; Name        :	def_ief
;
; Purpose     :	Sets up default IEF parameters and returns structure.
;
; Explanation : Sets up default values for the rather complicated structure needed by add_ief.
;
; Use         : < def = def_ief ( n_iefwins ) >
;
; Inputs      : n_iefwins = No. of ief windows.
;
; Outputs     : def = anonymous structure containing default IEF database values.
;                  def.ieftab_id  = I*2      IEFTAB database ID.
;                                            Initially, this is zero.  It is updated by this routine to
;				             reflect the ID number in the database.
;                  def.desc       = C*65     Description of event generation scheme.
;                  def.upp_era    = 4(I*2)   Upper limit for each ERA measure (unsigned INT16)
;                  def.low_era    = 4(I*2)   Lower limit for each ERA measure (unsigned INT16)
;                  def.discrim    = I*2      Discriminator level (unsigned INT16)
;                  def.ev_type    = I*2      Event type (4 bits)
;                  def.pmode      = I*2      Pointing mode : NIS=0, VF=1, GIS=2 (2 bits)
;                  def.cmode      = I*2      Centroid mode : POS=0, NEG=1, ABS=2 (2 bits)
;                  def.c_banda    = I*2      Slit centre band A (INT16)
;                  def.c_bandb    = I*2      Slit centre band B (INT16)
;                  def.c_row      = I*2      Central row (INT16)
;                  def.detector   = C*1      'N'= NIS, 'G'= GIS.
;                  def.wins       =  array of structures IEF_WINDOWS containing window info
;                    wins.iefwin_id  = I*2    Window ID.
;                    wins.win_name   = C*40   Window name
;                    wins.ev_desc    = C*65   Description of event detection scheme employed
;                    wins.win_def    = 4(I*2) Window definition ( xstart, ystart, xsize, ysize )
;                    wins.px_offset  = I*2    Pixel offset defining ROI around peak pixel.
;                    wins.exp_era    = 4(I*2) Expected values for each ERA in window.
;                    wins.dev_era    = 4(I*2) Deviations for each ERA in window.
;                    wins.wgt_era    = 4(I*2) Weights for each direct ERA in window.
;                    wins.wgt_dera   = 4(I*2) Weights for each differential ERA in window.
;
; Keywords    :	None.
;
; Restrictions:	None.
;
; Side effects:	None.
;
; Calls       :	.
;                
; Common      :	None.
;
; Category    :	Command preparation.
;
; Prev. Hist. : None.
;
; Written     :	Version 0.0, Martin Carter, RAL, 18/10/95
;
; Modified    :	
;
; Version     :	Version 0.0, 18/10/95
;-
;**********************************************************

FUNCTION def_ief, n_iefwins

  ; set up default window structure

  iefwin =  { IEF_WINDOWS,                           $
              iefwin_id : 0,                         $
              win_name  : 'Default window',          $
              ev_desc   : 'Bright point source',     $
              win_def   : [ 100, 632, 21, 120],      $
              px_offset : 8,                         $
              exp_era   : [ 100, 0, 0, 0],           $
              dev_era   : [ 100, 0, 0, 0],           $
              wgt_era   : [ 1, 0, 0, 0],             $
              wgt_dera  : [ 0, 0, 0, 0] }

   ;  Set up default table structure

   ieftab = { ieftab_id  : 0,                      $
              desc       : 'Default IEF table',    $
              upp_era    : [ -1, -1, -1, -1], $
              low_era    : [ 0, 0, 0, 0],          $
              discrim    : 1000,                   $
              ev_type    : 'D'X,                    $
              pmode      : 0,                      $
              cmode      : 0,                      $
              c_banda    : 572,                    $
              c_bandb    : 452,                    $
              c_row      : 511,                    $
              detector   : 'N',                    $
              wins       : REPLICATE ( iefwin, n_iefwins) }

   RETURN, ieftab

END