2000.01.20

* inspect L1.5:
	order-sorting looks odd: doesn't follow irmf boundaries
	(display or processing problem?)

	Gain wiggles --> re-process.

* acis_process_events.par:

#--------------------------------------------------------------------------
#
#  acis_process_events.par- Parameter file for acis_process_events program
#
#--------------------------------------------------------------------------
infile,s,a,"acisf00811_000N001_evt1.fits",,,"Input event file or stack"
outfile,s,a,"acisf00811_000N002_evt1.fits",,,"Output event file name"
acaofffile,s,a,"acisf00811_000N001_aoff1.fits",,,"aspect offset file ( NONE | none | <filename>)"
alignmentfile,s,a,"acisf00811_000N001_soff1.fits",,,"sim/fam alignment file ( NONE | none | <filename>)"
obsfile,s,h,"NONE",,,"obs.par file for output file keywords ( NONE | none | <filename>)"
logfile,s,h,"acis_process_events.log",,,"debug log file ( STDOUT | stdout | <filename>)"
gradefile,s,h,"))echo ${ASCDS_CALIB}/asca_grades.fits",,,"grade mapping file ( NONE | none | <filename>)"
gainfile,s,h,"./RefData/acisD1999-09-16gainN0003_110.fits",,,"acis gain file ( NONE | none | <filename>)"
threshfile,s,h,"NONE",,,"split threshold file ( NONE | none | <filename>)"
eventdef,s,h,")stdlev1",,,"output format definition"
doevtgrade,b,h,yes,,,"Determine event flight grade?"
spthresh,i,h,13,0,4095,"Default split threshold level (overridden by values in threshfile)"
time_offset,r,h,0,,,"Offset to add to event time field to synch w/ fam data"
docentroid,b,h,no,,,"Determine pixel centroid for coord. conversion?"
calculate_pi,b,h,yes,,,"perform pha->pi conversion? (requires gain file)"
pi_bin_width,r,h,14.6,1,100,"Width of Pi bin in eV"
pi_num_bins,i,h,1024,256,32767,"Number of values to bin energy into"
tstart,s,h,"TSTART",,,"header key containing start/default time value"
tstop,s,h,"TSTOP",,,"header key containing time of last event"
qp_internals,b,h,)qpoe.qp_internals,,,"prompt for qpoe internals?"
qp_pagesize,i,h,)qpoe.qp_pagesize,,,"page size for qpoe file"
qp_bucketlen,i,h,)qpoe.qp_bucketlen,,,"bucket length for qpoe file"
clobber,b,h,yes,,,"Overwrite output event file if it already exists?"
verbose,i,h,1,0,5,"level of debug detail (0=none, 5=most)"
stop,s,h,"sky",,,"end transformations at [chip,tdet,det,tan,sky,none]"
instrume,pset,h,acis,,,"axaf instrument- used for instrument parameter file"
telescop,pset,h,,,,"telescop parameter file"
rand_seed,i,h,1,0,,"random seed (for pixlib), 0 = use time dependend seed"
rand_pix_size,r,h,0.5,0,0.5,"pixel randomization width (-size..+size) 0=no randomization"
stdlev1,s,h,"{d:time,s:ccd_id,i:expno,s:chip,s:tdet,f:det,f:sky,s:phas,l:pha,f:energy,s:pi,s:fltgrade,s:grade,s:status}",,,"TE faint modes event definition string"
grdlev1,s,h,"{d:time,s:ccd_id,i:expno,s:chip,s:tdet,s:det,s:sky,l:pha,s:corn_pha,l:pi,s:fltgrade,s:grade,s:status}",,,"TE graded event format definition string"
intlev1,s,h,"{d:time,i:expno,s:chipx,s:chipy,s:tdetx,s:tdety,s:detx,s:dety,s:x,s:y,s:ccd_id,l:pha,s:grade,s:ccdnode}",,,"event format definition string"
cclev1,s,h,"{d:time,s:ccd_id,i:expno,s:chip,s:tdet,s:det,s:sky,s:phas,l:pha,l:pi,s:fltgrade,s:grade,s:status}",,,"CC faint event format definition string"
stdsim,s,h,"{d:time,s:readx,s:ready,s:chipx,s:chipy,s:frame,s:phas1,s:phas2,s:phas3,s:phas4,s:phas5,s:phas6,s:phas7,s:phas8,s:phas9,s:ccdnode,s:detx,s:dety,l:pha,s:grade}",,,"event format definition string"
mode,s,h,"ql",,,
	
** NOTE: non-standard gainfile. Guessed at FP_TEMP (not in header!)
         Gain files are being released.

* inspect zero-order source position:
  zoom on sky x,y center.
  read x,y from src1a file, and overplot.
  Looks good: in center of source.

  use src1a.fits in tg_create_mask: adjusted pars for LETG/ACIS-S:

##
## TG_CREATE_MASK -- Calculates the mask regions of the grating arms
##    for AXAF flight L1 grating data files.  The output is a region
##    file(s) in sky coordinates.
##
infile,s,a,"acisf00811_000N002_evt1.fits",,,"Input event file or stack"
outfile,s,a,"acisf00811_000N002_evt1a.reg",,,"Output region file or stack"
input_pos_tab,s,a,"acisf00811_000N001_src1a.fits",,,"Input table with zero order positions or stack"
input_psf_tab,s,h,"))echo $ASCDS_CALIB/hrmaD1996-11-01wpsfN0001.fits",,,"Calibration file with mirror psf vs off-axis angle"
grating_par,s,h,"grating",,,"Name of grating constants parameter file"
grating_obs,s,a,"header_value",HETG|HEG|MEG|LETG|header_value|HEADER_VALUE,,"Observed grating type (header_value|HETG|HEG|MEG|LETG)"
detector,s,h,"header_value",header_value|ACIS|HRC-I|HRC-S,,"Detector type: ACIS | HRC-I | HRC-S | header_value"
radius_factor_zero,r,h,50,1,400,"A scale factor which multiplies the app. calculation of the one-sigma zero order radius"
width_factor_arms,r,h,20,1,200,"A scale factor which multiplies the app. one-sigma width of the region in the cross-dispersion direction"
r_astig_max_hetg,r,h,0.5600000000000001,0,2,"Max grating r coord (deg, along the dispersion) for HETG astigmatism calc"
r_astig_max_letg,r,h,0.5600000000000001,0,4,"Max grating r coord (deg, along the dispersion) for LETG astigmatism calc"
r_mask_max_hetg,r,h,0.992,0,2,"Max grating r coord (deg) for HETG mask (to support offset pointing)"
r_mask_max_letg,r,h,1,0,4,"Max grating r coordinate (deg) for LETG mask (to support offset pointing)"
verbose,i,h,1,0,5,"Verbose level: 0 - no output, 5 - max verbosity"
clobber,b,h,no,YES|yes|NO|no,,"Clobber existing outfile?"
# --------------------------------------------------------------------------
# The parameters below are to be set ONLY if the user wants to use their
[deleted]

* run tg_resolve_events
  Use appropriate rmfile (not default!)
      $ASCDS_CALIB/acisD1999-08-26irmf_N0002.fits
  edit stdlev1 to change outputs to single precision where doubles not
       needed.
  edit stdlev1 to include "status" (needed for subsequent filtering)
  
#--------------------------------------------------------------------------
#
#   tg_resolve_events.par: Parameter file for the tg_resolve_events program
#
#--------------------------------------------------------------------------
infile,s,a,"acisf00811_000N002_evt1.fits",,,"Input event file or stack"
outfile,s,a,"acisf00811_000N002_evt1a.fits",,,"Output event file or stack"
regionfile,s,a,"acisf00811_000N002_evt1a.reg",,,"Input region file or stack"
acaofffile,s,h,"acisf00811_000N001_aoff1.fits",,,"Input aspect offset file ( NONE | none | <filename>)"
alignmentfile,s,h,"acisf00811_000N001_soff1.fits",,,"Input sim/fam alignment file ( NONE | none | <filename>)"
logfile,s,h,"tg_resolve_events.log",,,"Output log filename or 'NONE'/'STDOUT'"
rmfile,s,h,"))echo $ASCDS_CALIB/acisD1999-08-26irmf_N0002.fits",,,"RM lookup table for order resolving (acis only)"
grating_obs,s,h,"header_value",HETG|HEG|MEG|LETG|header_value|HEADER_VALUE,,"Observed grating type (header_value|HETG|HEG|MEG|LETG)"
detector,s,h,"header_value",ACIS|HRC-I|HRC-S|header_value|HEADER_VALUE,,"Detector type: ACIS | HRC-I | HRC-S | header_value"
energy_lo_adj,r,h,1.0,0,10,"Lower Energy limit factor"
energy_hi_adj,r,h,1.0,0,10,"Upper Energy limit factor"
time_offset,r,h,0,,,"Offset to add to event time to synch w/ alignment data"
rand_seed,i,h,1,0,32767,"Random seed (for pixlib), 0 = use time dependend seed"
rand_pix_size,r,h,0.5,0,0.5,"pixel randomization width (-size..+size), 0.0 = no randomization"
eventdef,s,h,")stdlev1",,,"Output format definition"
qp_internals,b,h,)qpoe.qp_internals,,,"Prompt for qpoe internals?"
qp_pagesize,i,h,)qpoe.qp_pagesize,,,"Page size for qpoe file"
qp_bucketlen,i,h,)qpoe.qp_bucketlen,,,"Bucket length for qpoe file"
verbose,i,h,1,0,5,"Verbosity level of detail (0=none, 5=most)"
clobber,b,h,no,YES|yes|NO|no,,"Clobber outfile if it already exists?"
stdlev1,s,h,"{d:time,i:expno,f:rd,s:chip,s:tdet,f:det,f:sky,s:ccd_id,l:pha,s:pi,f:energy,s:grade,s:fltgrade,s:ccdnode,s:tg_m,f:tg_lam,f:tg_mlam,s:tg_srcid,s:tg_part,s:tg_smap,s:status}",,,"Event format definition string"
mode,s,h,"ql",,,

* inspect:
  use idl code to look at order-sorting region.

  Order sorting region has problems: may be due to collisions of
  boundaries for default width.
  
  Use narrower region: elo,ehi_adj=0.5 (in tg_resolve_events)
  (downside is that fractional power is not known for arbitrary
  factors).  (but it is wrong, anyway, due to degraded cti)

  Re-run tg_resolve_events (increment version , N003)

* filter 1.5 events: grades 0,2,3,4,6; status=0; energy<10000.

dmcopy acisf00811_000N003_evt1a.fits"[EVENTS][grade=0,2,3,4,6,status=0,energy<10000]" acisf00811_000N003_evt2.fits

* append region to L2 events:
  dmrega2fits

##
## DMREGA2FITS -- Convert an ascii region file into a fits file,
##                with the option to append the FITS region to
##                the FITS header_file as a REGION extension.
##
infile,s,a,"acisf00811_000N002_evt1a.reg",,,"Input ascii region file"
outfile,s,a,"null",,,"Output FITS region file (if not appending to FITS event file)"
header_file,s,a,"acisf00811_000N003_evt2.fits",,,"Input file with observation header information"
header_file_extname,s,a,"EVENTS",,,"FITS header file extension name to extract header; if par file, then use NONE"
header_file_kernal,s,a,"FITS",ASCII|ascii|FITS|fits,,"Header file kernal type: FITS header or ASCII par file"
append_region_to_events,b,a,yes,YES|yes|NO|no,,"If FITS header event file, do you want to append output region?"
clobber,b,h,yes,YES|yes|NO|no,,"OK to overwrite existing output file?"
verbose,i,h,1,0,5,"Verbosity Level (0-5)"
mode,s,h,"ql",,,

* inspect (custom idl s/w)

  Pretty good!  Some odd order clipping near 1st order extrema;
		Bad affects where irmf table extrapolates to energies
		lower than ccd table provides.

       ;      order      LEG out
       ;        -3        1069
       ;        -2         947
       ;        -1       10196
       ;         0       23203
       ;         1       10796
       ;         2        1081
       ;         3        1105
       [x_ctr, y_ctr] = [       4096.5000,        4096.5000]
		

    Grating clocking angle is off.---- FIX (get Cal input)
    tg_d vs tg_lam is truncated ---- display or data problem?

   *** PROBLEM ***
    tg_lam, tg_mlam only ranges to 3.3.  Should go to 57A (at about
    0.3deg).   tg_lam vs tg_r not even linear.
    Problem w/ changing precision in stdlev1 eventdef? Revert...
    ..revision N004...   fstatistic shows MUCH BETTER. (bug w/ eventdef?)
        filter, append region, inspect:  GOOD.

* tgextract
     make wide enough for tilt
     check binning params for LETG/ACIS: (verbose=5)
         tg_d=-0.00132778:0.00132778,
	 tg_lam=1:21.4794]
	 [bin tg_lam=1:21.4794:0.00125]

	 Plot tg_r, tg_d: need tg_d range:  -0.00115:0.00111
	 	    Defaults OK for tg_d

                    Defaults NOT OK for tg_lam (BUG xxxx????)
		    tg_lam range should be up to about 60A.
		    
		    use: min_bin=1
		         bin_size=0.0125
			 num_bins=16384
			 max_bin='compute'
			 (will be commensurate w/ LETG gRMF)
##
## TGEXTRACT -- create 1D spectrum(a) table file(s) from the
##              L1.5 output event list
##
infile,f,a,"acisf00811_000N004_evt2.fits",,,"Input event file (output event file from L1.5 processing)"
outfile_type,s,a,"pha_typeII",pha_typeI|pha_typeII,,"Ouput file type: typeI (single spectrum) or typeII (multiple spectra)"
outfile,f,a,"acisf00811_000N004_pha2.fits",,,"If typeII, enter full output file name or '.'; if typeI, enter output rootname"
#
# tg_srcid_list patameter explanation...
#  - "all" will process all the sources id's found in the event list
#  - a comma list is a comma separated string list of all the 
#    sources to process, ie:
#       "1,2,5,7"
#  - @file is a pointer to an ascii file which contains a comma
#    separated list of the id's to process
#
tg_srcid_list,s,a,"1",,,"Source ID's to process: 'all', comma list, @file"
tg_part_list,s,a,"header_value",HETG|HEG|MEG|LETG|HESF|header_value,,"Grating parts to process: HETG, HEG, MEG, LETG, HESF, header_value"
#
# tg_order_list parameter explanation...
#  - "default" is set to process the following:
#       if ACIS:  1, 2, 3, -1, -2, -3
#       if HRC:   -1, 1
#  - a comma list is a comma separated string list of the orders
#    the user wants to process, ie:
#       "-5, -1, 1, 3"
#  - a range list sets the min and max of the orders to process;
#    all the orders in between, will be processed, ie:
#       "-1..5"  will do orders from -1 to +5th order
#    a range list can be mixed with comma separated list
#  - @file is a pointer to an ascii file which contains a comma
#    separated list and/or range list of the orders to process
#
tg_order_list,s,a,"-1,1",,,"Grating diffraction orders to process: 'default', comma list, range list, @file"
ancrfile,s,a,"none",,,"Input ancillary response file name"
respfile,s,a,"none",,,"Input redistribution file name"
backfile,s,h,"none",,,"Input background file name"
rowid,s,h,"",,,"If rowid column is to be filled in, enter name here"
grating_par,s,h,"grating",,,"Name of the grating .par file with tg characteristics"
bin_units,s,h,"angstrom",angstrom|eV|keV|degrees|pixel|mm,,"Bin units (for bin parameters below): angstrom, eV, keV, degrees, pixel, mm"
min_bin,s,h,"1.0",,,"Minimum dispersion coordinate, or 'compute'"
max_bin,s,h,"compute",,,"Maximum dispersion coordinate, or 'compute'"
bin_size,s,h,"0.0125",,,"Bin size for binning spectra, or 'compute'"
num_bins,s,h,"16384",,,"Number of bins for the resultant spectra, or 'compute'"
tg_d_units,s,h,"degrees",degrees|arcsec|mm|pixel,,"Units in which tg_d parameters are given (for below): degrees, arcsec, mm, pixel"
min_tg_d,s,h,"default",,,"Minimum tg_d range to include in histogram, or use 'default'"
max_tg_d,s,h,"default",,,"Maximum tg_d range to include in histogram, or use 'default'"
extract_background,b,h,yes,yes|no|YES|NO,,"Extract the local background spectrum?"
min_bkg_tg_d,s,h,"default",,,"Minimum absolute value of the tg_d for a bkg region, or use 'default'"
max_bkg_tg_d,s,h,"default",,,"Maximum absolute value of the tg_d for a bkg region, or use 'default'"
clobber,b,h,no,no|NO|yes|YES,,"OK to overwrite existing output file(s)?"
verbose,i,h,5,0,5,"Verbosity level (0 = no display)"
mode,s,h,"ql",,,

*2000-01-21  continue processing

* make grating arfs -

  Need garfs for each chip: 
       ccd  order
       s0    -1
       s1    -1
       s2    -1
       s3    -1
       s4    +1
       s5    +1

**    Fix GTI extensions: dmmerge will attach:
	 dmmerge  infile=acisf00811_000N004_evt2.fits"[@acisf00811_000N001_flt1.fits]" columnList="" outfile=acisf00811_000N005_evt2.fits outBlock=""

*** check file structure: (I used fstruct; could use dmlist)

bash-2.01$ bash-2.01$ fstruct acisf00811_000N005_evt2.fits
  No. Type     EXTNAME      BITPIX Dimensions(columns)      PCOUNT  GCOUNT
 
   0  PRIMARY                 16     0                           0    1
   1  BINTABLE EVENTS          8     112(26) 228710              0    1
   2  BINTABLE GTI             8     16(2) 28                    0    1
   3  BINTABLE GTI             8     16(2) 27                    0    1
   4  BINTABLE GTI             8     16(2) 33                    0    1
   5  BINTABLE GTI             8     16(2) 29                    0    1
   6  BINTABLE GTI             8     16(2) 28                    0    1
   7  BINTABLE GTI             8     16(2) 28                    0    1

**    Apply sim offsets to aspect offsets, put range keywords into header:

#--------------------------------------------------------------------------
#
#       asp_apply_sim.par  
#
#--------------------------------------------------------------------------
infile,s,a,"acisf00811_000N001_aoff1.fits",,,"Aspect Observation Interval File"
outfile,s,a,"acisf00811_000N002_aoff1.fits",,,"Output File "
verbose,i,h,1,0,5,"display Level(0-5)"
kernel,s,h,"default",fits|iraf|default,,"Output Kernel"
clobber,b,h,no,,,"Clobber existing output?"
mode,s,h,"ql",,,

**    Make asphist for each chip:

#--------------------------------------------------------------------------
#
#       asphist.par  Parameter file for the ASPECT HISTOGRAM Tool
#
#--------------------------------------------------------------------------
infile,s,a,"acisf00811_000N002_aoff1.fits",,,"Aspect Observation Interval File"
outfile,s,a,"acisf00811_000N002_ah4.fits",,,"Aspect Histogram Output File"
gtifile,s,a,"acisf00811_000N005_evt2.fits[ccd_id=4]",,,"Event file which contains GTI subspace"
dtffile,s,a,"",,,"Live Time Correction"
res_xy,r,h,0.5,,,"Aspect resolution x and y in arcsec"
res_roll,r,h,600.,,,"Aspect Resolution roll in arcsec"
verbose,i,h,1,0,5,"display Level(0-5)"
kernel,s,h,"default",fits|iraf|default,,"Output Kernel"
clobber,b,h,no,,,"Clobber existing output?"
mode,s,h,"ql",,,

*** inspect: (via idl)
What?> ah4=mrdfits('acisf00811_000N002_ah4.fits',1,hah4)
What?> ao=mrdfits('acisf00811_000N002_aoff1.fits',1,hao)
What?> plot,ao.x_offsets,ao.y_offsets,psy=3,/yno
What?> oplot,ah4.x_offset,ah4.y_offset,psy=1,col=144

  --- looks good: lissajous, range +-30 pix; no deviant points to be
      filtered. 

*** check exposures: 
What?> print,total(ah4.duration)
       78928.953
What?> print,sxpar(he,'exposure')
       81662.616

   --- good - should be close, but may not be exactly the same.

*** repeat, iterating on outfile and ccd_id, for ccd_id=4..9

asphist outfile=acisf00811_000N002_ah5.fits gtifile=acisf00811_000N005_evt2.fits"[ccd_id=5]" verb=0
asphist outfile=acisf00811_000N002_ah6.fits gtifile=acisf00811_000N005_evt2.fits"[ccd_id=6]" verb=0
asphist outfile=acisf00811_000N002_ah7.fits gtifile=acisf00811_000N005_evt2.fits"[ccd_id=7]" verb=0
asphist outfile=acisf00811_000N002_ah8.fits gtifile=acisf00811_000N005_evt2.fits"[ccd_id=8]" verb=0
asphist outfile=acisf00811_000N002_ah9.fits gtifile=acisf00811_000N005_evt2.fits"[ccd_id=9]" verb=0

** Now do grating arfs via mkgarf:
*** need grmf reference
 cp caldb/data/axaf/grating/letg/cpf/grmf/hrcleg1D1999-0923rmfN0000.fits ./RefData

*** get a clean mkgarf.par file to edit:
    punlearn mkgarf
    pset mkgarf verbose=1 

*** need source position:
bash-2.01$ fdump acisf00811_000N004_pha2.fits+1 STDOUT "X,Y" page- prh-
Lists of rows[-] 

        X               Y
        pixel           pixel
      1   4.0627000E+03   4.1497002E+03
      2   4.0627000E+03   4.1497002E+03

pset mkgarf sourcepixelx=4062.7 sourcepixely=4149.7

mkgarf.par:

detsubsys,s,a,"ACIS-S0",,,"Detector Name"
mirror,s,a,"HRMA",,,"Mirror Name"
order,i,a,-1,,,"Enter Grating order"
grating_arm,s,a,"LEG",HEG|MEG|LEG,,"Enter Grating Arm"
outfile,f,a,"./s0_legm1_arf.fits",,,"Output File Name"
asphistfile,f,a,"./acisf00811_000N002_ah4.fits[ASPHIST]",,,"Aspect Histogram File"
ardlibparfile,s,a,"ardlib.par",,,"name of ardlib parameter file"
obsfile,s,a,")asphistfile",,,"Name of fits file with obs info"
#
#
#rmffile,f,a,"/tmp/heg_m1.rmf",,,"RMF file with energy grid"
rmffile,f,a,"./RefData/hrcleg1D1999-0923rmfN0000.fits",,,"RMF file with energy grid"
#---------------------------------------------------------------------------
#  Region Information
#---------------------------------------------------------------------------
#sourcepixelx,r,a,16384.5,,,"Source X Pixel"
#sourcepixely,r,a,16384.5,,,"Source Y Pixel"
#sourcepixelx,r,a,4096.5,,,"Source X Pixel"
#sourcepixely,r,a,4096.5,,,"Source Y Pixel"
sourcepixelx,r,a,4062.7,,,"Source X Pixel"
sourcepixely,r,a,4149.7,,,"Source Y Pixel"
verbose,i,a,1,0,10,"Verbosity"
mode,s,hl,"hl",ql|hl|q|h,,"Enter mode for parameter file."

pset mkgarf verbose=0
mkgarf detsubsys="ACIS-S0" order=-1 outfile=s0_legm1_arf.fits asphistfile=acisf00811_000N002_ah4.fits"[ASPHIST]"
mkgarf detsubsys="ACIS-S1" order=-1 outfile=s1_legm1_arf.fits asphistfile=acisf00811_000N002_ah5.fits"[ASPHIST]"
mkgarf detsubsys="ACIS-S2" order=-1 outfile=s2_legm1_arf.fits asphistfile=acisf00811_000N002_ah6.fits"[ASPHIST]"
mkgarf detsubsys="ACIS-S3" order=-1 outfile=s3_legm1_arf.fits asphistfile=acisf00811_000N002_ah7.fits"[ASPHIST]"
mkgarf detsubsys="ACIS-S3" order=1 outfile=s3_legp1_arf.fits asphistfile=acisf00811_000N002_ah7.fits"[ASPHIST]"
mkgarf detsubsys="ACIS-S4" order=1 outfile=s4_legp1_arf.fits asphistfile=acisf00811_000N002_ah8.fits"[ASPHIST]"
mkgarf detsubsys="ACIS-S5" order=1 outfile=s5_legp1_arf.fits asphistfile=acisf00811_000N002_ah9.fits"[ASPHIST]"

** merge pieces with dmarfadd:

*** put into list files:
bash-2.01$ ls s*leg*m1*.fits > leg_m1.list
bash-2.01$ ls s*leg*p1*.fits > leg_p1.list

#-------------------------------------------------------------------- 
#
#       parameter file for the DMARFADD tool
#
#--------------------------------------------------------------------
infile,s,a,"@leg_m1.list",,,"Input list of files"
outfile,s,a,"acisf00811_m1_arf.fits",,,"Output dataset name"
kernel,s,h,"default",FITS|default,,"Output Kernel"
clobber,b,h,no,,,"Clobber existing output?"
verbose,i,h,1,0,5,"Debug Level(0-5)"
mode,s,h,"ql",,,

dmarfadd infile=@leg_m1.list outfile=acisf00811_m1_arf.fits
dmarfadd infile=@leg_p1.list outfile=acisf00811_p1_arf.fits

** inspect: 

What?> arfm1=mrdfits('acisf00811_m1_arf.fits',1,hm1)
What?> arfp1=mrdfits('acisf00811_p1_arf.fits',1,hp1)
What?> help,/st,arfm1
** Structure <4bc730>, 5 tags, length=20, refs=1:
   ENERG_LO        FLOAT         0.0729326
   ENERG_HI        FLOAT         0.0729385
   SPECRESP        FLOAT           0.00000
   BIN_LO          FLOAT           169.986
   BIN_HI          FLOAT           170.000
What?> plot,arfm1.bin_lo,arfm1.specresp,psy=0,xra=[0,70],/yty,yra=[0.01,100],xtitle='Wavelength '+!anglbl,ytitle='Effective Area [cm!u2!n]',title='gARFs, obsid 811'
What?> oplot,arfp1.bin_lo,arfp1.specresp,psy=0,col=155

*** Looks ok.
    BUT: grid is NOT same as pha file.  Traced to RMF.
    RMF and ARF have same grids  (but may not help...try xspec?)

2000.01.24 
* make new garfs, w/ new ref grating rmf
  Look good.