;+
; A routine that returns the pre-flight EIS effective areas located in SSW
;
; IDL> eis_effective_area_read,waveSW,eaSW,/short
; IDL> eis_effective_area_read,waveLW,eaLW,/long
;
; :History:
;   27-AUG-2013: HPW : Documented version.
;
; $Id: eis_effective_area_read.pro 2880 2013-08-27 12:12:17Z hwarren $:
;-
pro eis_effective_area_read,wave,area,long=long,short=short,files=files

  common eis_effective_area_read_com,init,srcA,srcB,filesRead
  if n_elements(init) eq 0 then init = 1

  if init then begin
    ;; --- path to the response directory
    path   = filepath('',root=getenv('SSW'),subdir=['hinode','eis','response'])

    ;; --- A files: LW
    filesA = file_search(path,'EIS_EffArea_A.*',count=nfilesA)
    fileA  = filesA[nfilesA-1] ;; last by default
    srcA   = rd_tfile(fileA,/auto) 
    ;; --- B files: SW
    filesB = file_search(path,'EIS_EffArea_B.*',count=nfilesB)
    fileB  = filesB[nfilesB-1] ;; last by default
    srcB   = rd_tfile(fileB,/auto) 

    filesRead = [fileA,fileB]

    init = 0
  endif

  if keyword_set(long) then begin
    wave = float(reform(srcA[0,*]))
    area = float(reform(srcA[1,*]))
  endif else begin
    wave = float(reform(srcB[0,*]))
    area = float(reform(srcB[1,*]))
  endelse

  files = filesRead

return
end
