;+
;
; NAME: 
;	RD_TGRS_DRM
;
; PURPOSE:
;	This procedure returns the vector photoefficiency for the TGRS spectrometer.
; CATEGORY:
;	NEAR, SPEX
;
; CALLING SEQUENCE:
;	RD_TGRS_DRM,  EDGES_OUT=EDGES_OUT, EDGES_IN=EDGES_IN, $
;		AREA=AREA, DRM=DRM
;
; CALLS:
;	RESP_CALC
;
; KEYWORDS:
;	EDGES_OUT- Energy channel edges in keV.
;	EDGES_IN - Photon input energies for DRM in keV.
;	DRM - detector response, a vector, counts/sec/cm2/keV per photon/keV/cm2
;
; OPTIONAL INPUTS:
;	none
;
; OUTPUTS:
;       none explicit, only through commons;
;
; OPTIONAL OUTPUTS:
;	none
;
; COMMON BLOCKS:
;	none
;
; SIDE EFFECTS:
;	none
;
; RESTRICTIONS:
;	none
;
; PROCEDURE:
;	none
;
; MODIFICATION HISTORY:
;	Version 1	ras, 17-may-1996	
;
;-

PRO RD_TGRS_DRM, EDGES_OUT=EDGES_OUT, EDGES_IN=EDGES, AREA=AREA, DRM=DRM, $
	_extra=_extra

AREA = 35 ;CM2
edges = edges_out
en_eff=      [20.,   40.,   80.,   160,  320.,  640., 1280, 2559, 5118., 10034.2 ]
oeff  =      [0.00,  0.21, 4.27,  5.47, 3.66,   3.89 ,3.72, 2.53,  1.22,     0.4]  / area ;occulted
efficiency = [0.02, 0.70, 17.84, 24.76, 17.68, 11.12, 7.10, 4.11,  2.03,     0.74] / area ;unocculted

;Occulter covers 90/360 degrees
efficiency = (3*efficiency + oeff)/4. 

e = avg(edges_out,0)>20.<1e4

drm = exp( spline( alog(en_eff), alog(efficiency), alog(e)))

end
