; Time-stamp: <2001-05-16 12:22:09 dph> 
; MIT Directory: ~dph/d1/CXC/Test_ciao_2.0/OSIP_Test_0104/
; File: Plt_newqe.pro
; Author: D. Huenemoerder
; Original version: 2001.05.15
;====================================================================

; show affect OF new acis-s filter transmission correction on $
; letg/acis-s 1st order grating arf.


IF (!ioflags.do_read EQ 1) THEN BEGIN 
  nam1=mrdfits('acisf01198_002N001LEG_-1_garf.fits',1,hnam1)
  nap1=mrdfits('acisf01198_002N001LEG_1_garf.fits',1,hnap1)
  am1=mrdfits('acisf01198_001N001LEG_-1_garf.fits',1,ham1)
  ap1=mrdfits('acisf01198_001N001LEG_1_garf.fits',1,hap1)
ENDIF

sav_x = !x
sav_y = !y
sav_p = !p

window,1,xsi=900,ysi=400,retain=2

!x.title='Wavelength*m '+!anglbl
!y.title='Effective Area [cm!u2!n]'
!p.title='ObsID 1198; LETG/ACIS-S gARF (m=+/-1) with HLM filter correction!c!c'

e_tics = [1.0,  0.6,  0.40,  0.30,  0.25, 0.20]
e_tics = [-reverse(e_tics), e_tics]
xtickv = !hc/e_tics
xticks = n_elements(xtickv)-1
xtickname = string(e_tics, format = '(f5.2)')

yra = [0.1, 100]
xra = [-65, 65]
!y.margin = [4, 6]

defcol = 1

rn = 'Garf_aciss_letg-qeN0004'
foo = ps_open()
IF !ioflags.do_ps EQ 1 THEN BEGIN 
   device, /inch, /color, /land, encap=0, xsi=10, ysi=4.44, file=rn+'.ps'
   defcol = 0
ENDIF


plot,-nam1.bin_lo,nam1.specresp,xra=xra,/yty,yra=yra,xst=9,thick=2
oplot,-am1.bin_lo,am1.specresp,col=155,line=2
oplot,nap1.bin_lo,nap1.specresp,thick=2
oplot,ap1.bin_lo,ap1.specresp,col=155,line=2
legend, ['Old', 'New'], line=[2,0], color=[155,(!d.n_colors-1)*defcol],thick=[2,1],textcolor=[155,(!d.n_colors-1)*defcol],/top,/right
xyouts, -60, 50,  'QE_ARD = acisD1997-04-17qeN0004.fits'
id_plot

!x.title = 'Energy*m [keV]
axis, xra[0], yra[1], /xax, xtickv = xtickv, xticks = xticks, xtickname = xtickname

png_out, rn+'.png'

!x = sav_x
!y = sav_y
!p = sav_p

ps_close

END
