;+
; A routine that returns the pre-flight EIS effective area for a given
; wavelength. The result is in square cm.  If the input wavelength is
; not observed by EIS then 0 is returned.
;
; The returned values are interpolated using data from
;   $SSW/hinode/eis/response/
;
; An example,
;
;  IDL> print,eis_ea(195)
;       0.301803
;  IDL> print,eis_ea(284)
;      0.0413185
;
; The entire effective area curve for a channel can also be
; returned. For example,
;
; IDL> eaSW = eis_ea(waveSW,/short)
; IDL> eaLW = eis_ea(waveLW,/long)
; IDL> plot,waveSW,eaSW
; IDL> plot,waveLW,eaLW
;
; :History:
;   27-AUG-2013: HPW : Documented version.
;
; $Id: eis_ea.pro 2880 2013-08-27 12:12:17Z hwarren $:
;-
function eis_ea,input_wave,short=short,long=long

  if keyword_set(short) then begin
    eis_effective_area_read,wave,ea,/short
    input_wave = wave
    return,ea
  endif
  if keyword_set(long) then begin
    eis_effective_area_read,wave,ea,/long
    input_wave = wave
    return,ea
  endif

  nWave = n_elements(input_wave) 
  ea = fltarr(nWave)

  for i=0,nWave-1 do begin
    
    result = is_eis_wavelength(input_wave[i],long=long,short=short)

    if short eq 0 and long eq 0 then begin
      ea[i] = 0.0
    endif else begin
      eis_effective_area_read,wave,area,long=long,short=short
      ea[i] = exp(interpol(alog(area),wave,input_wave[i],/spline))
    endelse

  endfor

  if nWave eq 1 then ea = ea[0]

return,ea
end
