;+
; NAME
;
;    EIS_MOMENT__TILT_CORRECTION()
;
; PROJECT
;
;    Hinode/EIS
;
; EXPLANATION
;
;    Corrects the eis_auto_fit fit structure for the tilt of the EIS slit.
;    Both the 1" and 2" slits are accounted for.
;
; INPUTS
;
;
; OUTPUT
;
;
; CALLS
;
; HISTORY
;
;    Ver.1,18-Feb-2008, A. Gardini, adapted from eis_tilt_correction. 
;          18-Mar-2008, A. Gardini. Changed the column's order of moments.
;           4-Jul-2008, A. Gardini. Added the init keyword. 
;-
pro eis_moment::tilt_correction, data, iwin, refwvl, init=init
  if n_elements(init) eq 1 then return
;
; The array tilt_values gives the tilt values for the different EIS slits.
;   0 - 1"
;   1 - 266"
;   2 - 2"
;   3 - 40"
;
  tilt_values=[1.22e-5,0.,1.14e-4,0]

  slit_ind=data->getinfo('slit_ind')

  tilt=tilt_values[slit_ind]

  nx=(size(*self.w[iwin]))[3]
  ny=(size(*self.w[iwin]))[2]

  corr=findgen(ny)*tilt
  c = 2.997924580d5     ; km/s
  velcorr=corr/refwvl*c

  velcorr=(fltarr(nx)+1.)#temporary(velcorr)

  missing=-100.


  for i=0,nx-1 do $
    for j=0,ny-1 do $ 
      if (*self.w[iwin])[1,j,i] ne missing then $
        (*self.w[iwin])[1,j,i]=(*self.w[iwin])[1,j,i]-velcorr[i,j]

  return
end
