if DPR.CATG=="CALIB" and DPR.TYPE=="BIAS" and DET.CHIPS==1 then
{
  RAW.TYPE = "BIAS_BLUE";
  DO.CATG = "BIAS_BLUE";
  PACK.DIR = "DET";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="BIAS" and DET.CHIPS==2 then
{
  RAW.TYPE = "BIAS_RED";
  DO.CATG = "BIAS_RED";
  PACK.DIR = "DET";
  CATG = "CALIB";
}


if DPR.CATG=="CALIB" and (
    ( DPR.TYPE=="BIAS,DETCHAR" and TPL.ID=="UVES_blue_tec_ccdflat" )
  ) and DET.CHIPS==1 then
{
  RAW.TYPE = "CCDTEST_BLUE";
  DO.CATG = "BIAS_DETCHAR_BLUE";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and (
    ( DPR.TYPE=="LAMP,FLAT,DETCHAR" and DPR.TECH=="IMAGE" and TPL.ID=="UVES_blue_tec_ccdflat" )
  ) and DET.CHIPS==1 then
{
  RAW.TYPE = "CCDTEST_BLUE";
  DO.CATG = "SCREEN_FLAT_DETCHAR_BLUE";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}

if DPR.CATG=="CALIB" and (
    ( DPR.TYPE=="BIAS,DETCHAR" and TPL.ID=="UVES_red_tec_ccdflat" )
  ) and DET.CHIPS==2 then
{
  RAW.TYPE = "CCDTEST_RED";
  DO.CATG = "BIAS_DETCHAR_RED";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and (
    ( DPR.TYPE=="LAMP,FLAT,DETCHAR" and DPR.TECH=="IMAGE" and TPL.ID=="UVES_red_tec_ccdflat" )
  ) and DET.CHIPS==2 then
{
  RAW.TYPE = "CCDTEST_RED";
  DO.CATG = "SCREEN_FLAT_DETCHAR_RED";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="DARK" and DPR.TECH=="IMAGE" and DET.CHIPS==1 then
{
  RAW.TYPE = "DARK_BLUE";
  DO.CATG = "DARK_BLUE";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="DARK" and DPR.TECH=="IMAGE" and DET.CHIPS==2 then
{
  RAW.TYPE = "DARK_RED";
  DO.CATG = "DARK_RED";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="PARASITIC" and DPR.TECH=="IMAGE" and DET.CHIPS==1 then
{
  RAW.TYPE = "PDARK_BLUE";
  DO.CATG = "PDARK_BLUE";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="PARASITIC" and DPR.TECH=="IMAGE" and DET.CHIPS==2 then
{
  RAW.TYPE = "PDARK_RED";
  DO.CATG = "PDARK_RED";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and (
  ( DPR.TYPE=="LAMP,FLAT" and DPR.TECH=="IMAGE" and TPL.ID=="UVES_blue_tec_cdtest" )
  or
  ( DPR.TYPE=="LAMP,CDALIGN" and DPR.TECH=="SPECTRUM" )
  ) and DET.CHIPS==1 then
{
  RAW.TYPE = "CD_ALIGN_ECH_BLUE";
  DO.CATG = "CD_ALIGN_BLUE";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and (
  ( DPR.TYPE=="LAMP,FLAT" and DPR.TECH=="IMAGE" and TPL.ID=="UVES_red_tec_cdtest" )
  or
  ( DPR.TYPE=="LAMP,CDALIGN" and DPR.TECH=="SPECTRUM" )
  ) and DET.CHIPS==2 then
{
  RAW.TYPE = "CD_ALIGN_ECH_RED";
  DO.CATG = "CD_ALIGN_RED";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FMTCHK" and DPR.TECH=="ECHELLE" and DET.CHIPS==1 then
{
  RAW.TYPE = "FMTCHK_ECH_BLUE";
  DO.CATG = "ARC_LAMP_FORM_BLUE";
  PACK.DIR = "SPEC_OTHER";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,ORDERDEF" and DPR.TECH=="ECHELLE" and DET.CHIPS==1 then
{
  RAW.TYPE = "ORDERDEF_ECH_BLUE";
  DO.CATG = "ORDER_FLAT_BLUE";
  PACK.DIR = "SPEC_OTHER";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FLAT" and DPR.TECH=="ECHELLE" and DET.CHIPS==1 then
{
  RAW.TYPE = "EFLAT_ECH_BLUE";
  DO.CATG = "FLAT_BLUE";
  PACK.DIR = "SPEC_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,DFLAT" and DPR.TECH=="ECHELLE" and DET.CHIPS==1 then
{
  RAW.TYPE = "DFLAT_ECH_BLUE";
  DO.CATG = "DFLAT_BLUE";
  PACK.DIR = "SPEC_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,WAVE" and DPR.TECH=="ECHELLE" and DET.CHIPS==1 then
{
  RAW.TYPE = "WAVE_ECH_BLUE";
  DO.CATG = "ARC_LAMP_BLUE";
  PACK.DIR = "SPEC_ARC";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FMTCHK" and DPR.TECH=="SPECTRUM" and DET.CHIPS==1 then
{
  RAW.TYPE = "FMTCHK_SPEC_BLUE";
  DO.CATG = "ARC_LAMP_FORM_BLUE";
  PACK.DIR = "SPEC_OTHER";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,ORDERDEF" and DPR.TECH=="SPECTRUM" and DET.CHIPS==1 then
{
  RAW.TYPE = "ORDERDEF_SPEC_BLUE";
  DO.CATG = "ORDER_FLAT_BLUE";
  PACK.DIR = "SPEC_OTHER";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FLAT" and DPR.TECH=="SPECTRUM" and DET.CHIPS==1 then
{
  RAW.TYPE = "EFLAT_SPEC_BLUE";
  DO.CATG = "FLAT_BLUE";
  PACK.DIR = "SPEC_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,DFLAT" and DPR.TECH=="SPECTRUM" and DET.CHIPS==1 then
{
  RAW.TYPE = "DFLAT_SPEC_BLUE";
  DO.CATG = "DFLAT_BLUE";
  PACK.DIR = "SPEC_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,WAVE" and DPR.TECH=="SPECTRUM" and DET.CHIPS==1 then
{
  RAW.TYPE = "WAVE_SPEC_BLUE";
  DO.CATG = "ARC_LAMP_BLUE";
  PACK.DIR = "SPEC_ARC";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FMTCHK" and DPR.TECH=="ECHELLE" and DET.CHIPS==2 then
{
  RAW.TYPE = "FMTCHK_ECH_RED";
  DO.CATG = "ARC_LAMP_FORM_RED";
  PACK.DIR = "SPEC_OTHER";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,ORDERDEF" and DPR.TECH=="ECHELLE" and DET.CHIPS==2 then
{
  RAW.TYPE = "ORDERDEF_ECH_RED";
  DO.CATG = "ORDER_FLAT_RED";
  PACK.DIR = "SPEC_OTHER";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FLAT" and DPR.TECH=="ECHELLE" and DET.CHIPS==2 then
{
  RAW.TYPE = "EFLAT_ECH_RED";
  DO.CATG = "FLAT_RED";
  PACK.DIR = "SPEC_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,IFLAT" and DPR.TECH=="ECHELLE,ABSORPTION-CELL" and DET.CHIPS==2 then
{
  RAW.TYPE = "IFLAT_ECH_RED";
  DO.CATG = "IFLAT_RED";
  PACK.DIR = "SPEC_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,WAVE" and DPR.TECH=="ECHELLE" and DET.CHIPS==2 then
{
  RAW.TYPE = "WAVE_ECH_RED";
  DO.CATG = "ARC_LAMP_RED";
  PACK.DIR = "SPEC_ARC";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FMTCHK" and DPR.TECH=="SPECTRUM" and DET.CHIPS==2 then
{
  RAW.TYPE = "FMTCHK_SPEC_RED";
  DO.CATG = "ARC_LAMP_FORM_RED";
  PACK.DIR = "SPEC_OTHER";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,ORDERDEF" and DPR.TECH=="SPECTRUM" and DET.CHIPS==2 then
{
  RAW.TYPE = "ORDERDEF_SPEC_RED";
  DO.CATG = "ORDER_FLAT_RED";
  PACK.DIR = "SPEC_OTHER";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FLAT" and DPR.TECH=="SPECTRUM" and DET.CHIPS==2 then
{
  RAW.TYPE = "EFLAT_SPEC_RED";
  DO.CATG = "FLAT_RED";
  PACK.DIR = "SPEC_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,IFLAT" and DPR.TECH=="SPECTRUM,ABSORPTION-CELL" and DET.CHIPS==2 then
{
  RAW.TYPE = "IFLAT_SPEC_RED";
  DO.CATG = "IFLAT_RED";
  PACK.DIR = "SPEC_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,WAVE" and DPR.TECH=="SPECTRUM" and DET.CHIPS==2 then
{
  RAW.TYPE = "WAVE_SPEC_RED";
  DO.CATG = "ARC_LAMP_RED";
  PACK.DIR = "SPEC_ARC";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,TFLAT" and (
      DPR.TECH=="ECHELLE" or
      DPR.TECH=="ECHELLE,SLIC#1" or
      DPR.TECH=="ECHELLE,SLIC#2" or
      DPR.TECH=="ECHELLE,SLIC#3"
   ) and DET.CHIPS==1 then
{
  RAW.TYPE = "TFLAT_ECH_BLUE";
  DO.CATG = "TFLAT_BLUE";
  PACK.DIR = "SPEC_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,TFLAT" and (
      DPR.TECH=="ECHELLE" or
      DPR.TECH=="ECHELLE,SLIC#1" or
      DPR.TECH=="ECHELLE,SLIC#2" or
      DPR.TECH=="ECHELLE,SLIC#3"
    ) and DET.CHIPS==2 then
{
  RAW.TYPE = "TFLAT_ECH_RED";
  DO.CATG = "TFLAT_RED";
  PACK.DIR = "SPEC_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="STD" and (
      DPR.TECH=="ECHELLE" or
      DPR.TECH=="ECHELLE,SLIC#1" or
      DPR.TECH=="ECHELLE,SLIC#2" or
      DPR.TECH=="ECHELLE,SLIC#3"
   ) and DET.CHIPS==1 then
{
  RAW.TYPE = "STD_ECH_BLUE";
  DO.CATG = "STANDARD_BLUE";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="STD" and (
      DPR.TECH=="ECHELLE" or
      DPR.TECH=="ECHELLE,SLIC#1" or
      DPR.TECH=="ECHELLE,SLIC#2" or
      DPR.TECH=="ECHELLE,SLIC#3"
   ) and DET.CHIPS==2 then
{
  RAW.TYPE = "STD_ECH_RED";
  DO.CATG = "STANDARD_RED";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="STD,TELLURIC" and (
      DPR.TECH=="ECHELLE"
   ) and DET.CHIPS==1 then
{
  RAW.TYPE = "STD_TELL_BLUE";
  DO.CATG = "STD_TELL_BLUE";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="STD,TELLURIC" and (
      DPR.TECH=="ECHELLE"
   ) and DET.CHIPS==2 then
{
  RAW.TYPE = "STD_TELL_RED";
  DO.CATG = "STD_TELL_RED";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="SCIENCE" and (
      DPR.TYPE=="OBJECT" or
      DPR.TYPE=="OBJECT,POINT" or
      DPR.TYPE=="OBJECT,POINT,POINT"
   ) and (
      DPR.TECH=="ECHELLE" or
      DPR.TECH=="ECHELLE,ABSORPTION-CELL"
   ) and DET.CHIPS==1 then
{
  RAW.TYPE = "SCI_POINT_ECH_BLUE";
  DO.CATG = "SCI_POINT_BLUE";
  PACK.DIR = "NONE";
  CATG = "SCIENCE";
}
if DPR.CATG=="SCIENCE" and (
      DPR.TYPE=="OBJECT" or
      DPR.TYPE=="OBJECT,POINT" or
      DPR.TYPE=="OBJECT,POINT,POINT"
   ) and (
      DPR.TECH=="ECHELLE" or
      DPR.TECH=="ECHELLE,ABSORPTION-CELL"
   ) and DET.CHIPS==2 then
{
  RAW.TYPE = "SCI_POINT_ECH_RED";
  DO.CATG = "SCI_POINT_RED";
  PACK.DIR = "NONE";
  CATG = "SCIENCE";
}
if DPR.CATG=="SCIENCE" and (
      DPR.TYPE=="OBJECT,EXTENDED" or
      DPR.TYPE=="OBJECT,EXTENDED,EXTENDED"
   ) and (
      DPR.TECH=="ECHELLE" or
      DPR.TECH=="ECHELLE,ABSORPTION-CELL"
   ) and DET.CHIPS==1 then
{
  RAW.TYPE = "SCI_EXTENDED_ECH_BLUE";
  DO.CATG = "SCI_EXTND_BLUE";
  PACK.DIR = "NONE";
  CATG = "SCIENCE";
}
if DPR.CATG=="SCIENCE" and (
      DPR.TYPE=="OBJECT,EXTENDED" or
      DPR.TYPE=="OBJECT,EXTENDED,EXTENDED"
   ) and (
      DPR.TECH=="ECHELLE" or
      DPR.TECH=="ECHELLE,ABSORPTION-CELL"
   ) and DET.CHIPS==2 then
{
  RAW.TYPE = "SCI_EXTENDED_ECH_RED";
  DO.CATG = "SCI_EXTND_RED";
  PACK.DIR = "NONE";
  CATG = "SCIENCE";
}
if DPR.CATG=="SCIENCE" and (
      DPR.TYPE=="OBJECT,POINT" or
      DPR.TYPE=="OBJECT,POINT,POINT"
   ) and (
      DPR.TECH=="ECHELLE,SLIC#1" or
      DPR.TECH=="ECHELLE,SLIC#2" or
      DPR.TECH=="ECHELLE,SLIC#3" or
      DPR.TECH=="ECHELLE,ABSORPTION-CELL,SLIC#1" or
      DPR.TECH=="ECHELLE,ABSORPTION-CELL,SLIC#2" or
      DPR.TECH=="ECHELLE,ABSORPTION-CELL,SLIC#3"
   ) and DET.CHIPS==1 then
{
  RAW.TYPE = "SCI_SLIC_ECH_BLUE";
  DO.CATG = "SCI_SLICER_BLUE";
  PACK.DIR = "NONE";
  CATG = "SCIENCE";
}
if DPR.CATG=="SCIENCE" and (
      DPR.TYPE=="OBJECT,POINT" or
      DPR.TYPE=="OBJECT,POINT,POINT"
   ) and (
      DPR.TECH=="ECHELLE,SLIC#1" or
      DPR.TECH=="ECHELLE,SLIC#2" or
      DPR.TECH=="ECHELLE,SLIC#3" or
      DPR.TECH=="ECHELLE,ABSORPTION-CELL,SLIC#1" or
      DPR.TECH=="ECHELLE,ABSORPTION-CELL,SLIC#2" or
      DPR.TECH=="ECHELLE,ABSORPTION-CELL,SLIC#3"
   ) and DET.CHIPS==2 then
{
  RAW.TYPE = "SCI_SLIC_ECH_RED";
  DO.CATG = "SCI_SLICER_RED";
  PACK.DIR = "NONE";
  CATG = "SCIENCE";
}
if DPR.CATG=="SCIENCE" and (
      DPR.TYPE=="OBJECT" or
      DPR.TYPE=="OBJECT,POINT" or
      DPR.TYPE=="OBJECT,POINT,POINT" or
      DPR.TYPE=="OBJECT,EXTENDED" or
      DPR.TYPE=="OBJECT,EXTENDED,EXTENDED"
   ) and (
      DPR.TECH=="SPECTRUM" or
      DPR.TECH=="SPECTRUM,ABSORPTION-CELL" or
      DPR.TECH=="SPECTRUM,SLIC#1" or
      DPR.TECH=="SPECTRUM,SLIC#2" or
      DPR.TECH=="SPECTRUM,SLIC#3" or
      DPR.TECH=="SPECTRUM,ABSORPTION-CELL,SLIC#1" or
      DPR.TECH=="SPECTRUM,ABSORPTION-CELL,SLIC#2" or
      DPR.TECH=="SPECTRUM,ABSORPTION-CELL,SLIC#3"
   ) and DET.CHIPS==1 then
{
  RAW.TYPE = "SCI_SPEC_BLUE";
  DO.CATG = "SCI_SPECTRUM_BLUE";
  PACK.DIR = "NONE";
  CATG = "SCIENCE";
}
if DPR.CATG=="SCIENCE" and (
      DPR.TYPE=="OBJECT" or
      DPR.TYPE=="OBJECT,POINT" or
      DPR.TYPE=="OBJECT,POINT,POINT"or
      DPR.TYPE=="OBJECT,EXTENDED" or
      DPR.TYPE=="OBJECT,EXTENDED,EXTENDED"
   ) and (
      DPR.TECH=="SPECTRUM" or
      DPR.TECH=="SPECTRUM,ABSORPTION-CELL" or
      DPR.TECH=="SPECTRUM,SLIC#1" or
      DPR.TECH=="SPECTRUM,SLIC#2" or
      DPR.TECH=="SPECTRUM,SLIC#3" or
      DPR.TECH=="SPECTRUM,ABSORPTION-CELL,SLIC#1" or
      DPR.TECH=="SPECTRUM,ABSORPTION-CELL,SLIC#2" or
      DPR.TECH=="SPECTRUM,ABSORPTION-CELL,SLIC#3"
   ) and DET.CHIPS==2 then
{
  RAW.TYPE = "SCI_SPEC_RED";
  DO.CATG = "SCI_SPECTRUM_RED";
  PACK.DIR = "NONE";
  CATG = "SCIENCE";
}
if DPR.CATG=="ACQUISITION" and DPR.TYPE=="SLIT" and DPR.TECH=="IMAGE" then
{
  RAW.TYPE = "ACQ_ECH";
  DO.CATG = "ACQ_ECH";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FMTCHK,SimCal" and DPR.TECH=="MOS" and DET.CHIPS==2 then
{
  RAW.TYPE = "FMTCHK_MOS_RED";
  DO.CATG = "FIB_ARC_LAMP_FORM_RED";
  PACK.DIR = "SPEC_OTHER";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,ORDERDEF,SimCal" and DPR.TECH=="MOS" and DET.CHIPS==2 then
{
  RAW.TYPE = "ORDERDEF_MOS_RED";
  DO.CATG = "FIB_ORDEF_RED";
  PACK.DIR = "SPEC_OTHER";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,SFLAT" and DPR.TECH=="ECHELLE" and DET.CHIPS==2 and TPL.NEXP==9 then
{
  RAW.TYPE = "SFLAT_MOS_RED";
  DO.CATG = "SFLAT_RED";
  PACK.DIR = "SPEC_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and (
      DPR.TYPE=="LAMP,FLAT,NASMYTH,OzPoz" or
      DPR.TYPE=="LAMP,FLAT,NASMYTH,SimCal"
   ) and DPR.TECH=="MOS" and DET.CHIPS==2 then
{
  RAW.TYPE = "NASMYTH_MOS_RED";
  DO.CATG = "NASMYTH_FLAT_RED";
  PACK.DIR = "MOS_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FLAT,EVEN,SimCal" and DPR.TECH=="MOS" and DET.CHIPS==2 and TPL.NEXP==3 then
{
  RAW.TYPE = "FFLAT_MOS_SIM_RED";
  DO.CATG = "FIB_FF_EVEN_RED";
  PACK.DIR = "MOS_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FLAT,ODD,SimCal" and DPR.TECH=="MOS" and DET.CHIPS==2 and TPL.NEXP==3 then
{
  RAW.TYPE = "FFLAT_MOS_SIM_RED";
  DO.CATG = "FIB_FF_ODD_RED";
  PACK.DIR = "MOS_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FLAT,ALL,SimCal" and DPR.TECH=="MOS" and DET.CHIPS==2 and TPL.NEXP==3 then
{
  RAW.TYPE = "FFLAT_MOS_SIM_RED";
  DO.CATG = "FIB_FF_ALL_RED";
  PACK.DIR = "MOS_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FLAT,EVEN,OzPoz" and DPR.TECH=="MOS" and DET.CHIPS==2 and TPL.NEXP==3 then
{
  RAW.TYPE = "FFLAT_MOS_OZ_RED";
  DO.CATG = "FIB_FF_EVEN_RED";
  PACK.DIR = "MOS_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FLAT,ODD,OzPoz" and DPR.TECH=="MOS" and DET.CHIPS==2 and TPL.NEXP==3 then
{
  RAW.TYPE = "FFLAT_MOS_OZ_RED";
  DO.CATG = "FIB_FF_ODD_RED";
  PACK.DIR = "MOS_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and DPR.TYPE=="LAMP,FLAT,ALL,OzPoz" and DPR.TECH=="MOS" and DET.CHIPS==2 and TPL.NEXP==3 then
{
  RAW.TYPE = "FFLAT_MOS_OZ_RED";
  DO.CATG = "FIB_FF_ALL_RED";
  PACK.DIR = "MOS_FLAT";
  CATG = "CALIB";
}
if DPR.CATG=="CALIB" and (
      DPR.TYPE=="LAMP,WAVE,SimCal" or
      DPR.TYPE=="LAMP,WAVE,OzPoz"
   ) and DPR.TECH=="MOS" and DET.CHIPS==2 then
{
  RAW.TYPE = "WAVE_MOS_RED";
  DO.CATG = "FIB_ARC_LAMP_RED";
  PACK.DIR = "MOS_ARC";
  CATG = "CALIB";
}
if DPR.CATG=="SCIENCE" and DPR.TYPE=="OBJECT,SimCal" and DPR.TECH=="MOS" and DET.CHIPS==2 then
{
  RAW.TYPE = "SCIENCE_MOS_SIM_RED";
  DO.CATG = "FIB_SCI_SIM_RED";
  PACK.DIR = "NONE";
  CATG = "SCIENCE";
}
if DPR.CATG=="SCIENCE" and DPR.TYPE=="OBJECT,OzPoz" and DPR.TECH=="MOS" and DET.CHIPS==2 then
{
  RAW.TYPE = "SCIENCE_MOS_RED";
  DO.CATG = "FIB_SCI_RED";
  PACK.DIR = "NONE";
  CATG = "SCIENCE";
}

if PRO.CATG=="EXTCOEFF_TABLE" then
{
  DO.CATG = "EXTCOEFF_TABLE";
}

if PRO.CATG=="LINE_REFER_TABLE" then
{
  DO.CATG = "LINE_REFER_TABLE";
}

if PRO.CATG=="FLUX_STD_TABLE" then
{
  DO.CATG = "FLUX_STD_TABLE";
}

select execute(ACTION_BIAS_BLUE) from inputFiles where RAW.TYPE=="BIAS_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,TPL.START as (TPL_A,tpl);
select execute(ACTION_BIAS_RED) from inputFiles where RAW.TYPE=="BIAS_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,TPL.START as (TPL_A,tpl);
select execute(ACTION_BIAS_MOS_RED) from inputFiles where RAW.TYPE=="BIAS_MOS_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,TPL.START as (TPL_A,tpl);
select execute(ACTION_CCDTEST_BLUE) from inputFiles where RAW.TYPE=="CCDTEST_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,TPL.START as (TPL_A,tpl);
select execute(ACTION_CCDTEST_RED) from inputFiles where RAW.TYPE=="CCDTEST_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,TPL.START as (TPL_A,tpl);
select execute(ACTION_DARK_BLUE) from inputFiles where RAW.TYPE=="DARK_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,TPL.START as (TPL_A,tpl);
select execute(ACTION_DARK_RED) from inputFiles where RAW.TYPE=="DARK_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,TPL.START as (TPL_A,tpl);
select execute(ACTION_PDARK_BLUE) from inputFiles where RAW.TYPE=="PDARK_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,TPL.START as (TPL_A,tpl);
select execute(ACTION_PDARK_RED) from inputFiles where RAW.TYPE=="PDARK_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,TPL.START as (TPL_A,tpl);
select execute(ACTION_CD_ALIGN_ECH_BLUE) from inputFiles where RAW.TYPE=="CD_ALIGN_ECH_BLUE"
  group by DET.READ.SPEED,INS.GRAT1.NAME,TPL.START as (TPL_A,tpl);
select execute(ACTION_CD_ALIGN_ECH_RED) from inputFiles where RAW.TYPE=="CD_ALIGN_ECH_RED"
  group by DET.READ.SPEED,INS.GRAT2.NAME,TPL.START as (TPL_A,tpl);
select execute(ACTION_FMTCHK_ECH_BLUE) from inputFiles where RAW.TYPE=="FMTCHK_ECH_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.GRAT1.WLEN,ARCFILE;
select execute(ACTION_ORDERDEF_ECH_BLUE) from inputFiles where RAW.TYPE=="ORDERDEF_ECH_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.GRAT1.WLEN,ARCFILE;
select execute(ACTION_DFLAT_ECH_BLUE) from inputFiles where RAW.TYPE=="DFLAT_ECH_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT1.WLEN,INS.SLIT2.WID,TPL.START as (TPL_A,tpl);
select execute(ACTION_EFLAT_ECH_BLUE) from inputFiles where RAW.TYPE=="EFLAT_ECH_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT1.WLEN,INS.SLIT2.WID,TPL.START as (TPL_A,tpl);
select execute(ACTION_WAVE_ECH_BLUE) from inputFiles where RAW.TYPE=="WAVE_ECH_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,INS.MODE,INS.SLIT1.NAME,INS.GRAT1.WLEN,INS.SLIT2.WID,ARCFILE;
select execute(ACTION_FMTCHK_SPEC_BLUE) from inputFiles where RAW.TYPE=="FMTCHK_SPEC_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.GRAT1.WLEN,ARCFILE;
select execute(ACTION_ORDERDEF_SPEC_BLUE) from inputFiles where RAW.TYPE=="ORDERDEF_SPEC_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.GRAT1.WLEN,ARCFILE;
select execute(ACTION_DFLAT_SPEC_BLUE) from inputFiles where RAW.TYPE=="DFLAT_SPEC_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT1.WLEN,INS.SLIT2.WID,TPL.START as (TPL_A,tpl);
select execute(ACTION_EFLAT_SPEC_BLUE) from inputFiles where RAW.TYPE=="EFLAT_SPEC_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT1.WLEN,INS.SLIT2.WID,TPL.START as (TPL_A,tpl);
select execute(ACTION_WAVE_SPEC_BLUE) from inputFiles where RAW.TYPE=="WAVE_SPEC_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,INS.MODE,INS.SLIT1.NAME,INS.GRAT1.WLEN,INS.SLIT2.WID,ARCFILE;
select execute(ACTION_FMTCHK_ECH_RED) from inputFiles where RAW.TYPE=="FMTCHK_ECH_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.GRAT2.WLEN,ARCFILE;
select execute(ACTION_ORDERDEF_ECH_RED) from inputFiles where RAW.TYPE=="ORDERDEF_ECH_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.GRAT2.WLEN,ARCFILE;
select execute(ACTION_EFLAT_ECH_RED) from inputFiles where RAW.TYPE=="EFLAT_ECH_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT2.WLEN,INS.SLIT3.WID,TPL.START as (TPL_A,tpl);
select execute(ACTION_IFLAT_ECH_RED) from inputFiles where RAW.TYPE=="IFLAT_ECH_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT2.WLEN,INS.SLIT3.WID,TPL.START as (TPL_A,tpl);
select execute(ACTION_WAVE_ECH_RED) from inputFiles where RAW.TYPE=="WAVE_ECH_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,INS.MODE,INS.SLIT1.NAME,INS.GRAT2.WLEN,INS.SLIT3.WID,ARCFILE;
select execute(ACTION_FMTCHK_SPEC_RED) from inputFiles where RAW.TYPE=="FMTCHK_SPEC_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.GRAT2.WLEN,ARCFILE;
select execute(ACTION_ORDERDEF_SPEC_RED) from inputFiles where RAW.TYPE=="ORDERDEF_SPEC_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.GRAT2.WLEN,ARCFILE;
select execute(ACTION_EFLAT_SPEC_RED) from inputFiles where RAW.TYPE=="EFLAT_SPEC_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT2.WLEN,INS.SLIT3.WID,TPL.START as (TPL_A,tpl);
select execute(ACTION_IFLAT_SPEC_RED) from inputFiles where RAW.TYPE=="IFLAT_SPEC_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT2.WLEN,INS.SLIT3.WID,TPL.START as (TPL_A,tpl);
select execute(ACTION_WAVE_SPEC_RED) from inputFiles where RAW.TYPE=="WAVE_SPEC_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,INS.MODE,INS.SLIT1.NAME,INS.GRAT2.WLEN,INS.SLIT3.WID,ARCFILE;
select execute(ACTION_TFLAT_ECH_BLUE) from inputFiles where RAW.TYPE=="TFLAT_ECH_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT1.WLEN,INS.SLIT2.WID,TPL.START as (TPL_A,tpl);
select execute(ACTION_TFLAT_ECH_RED) from inputFiles where RAW.TYPE=="TFLAT_ECH_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT2.WLEN,INS.SLIT3.WID,TPL.START as (TPL_A,tpl);
select execute(ACTION_STD_ECH_BLUE) from inputFiles where RAW.TYPE=="STD_ECH_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.GRAT1.WLEN,OBS.TARG.NAME,ARCFILE;
select execute(ACTION_STD_ECH_RED) from inputFiles where RAW.TYPE=="STD_ECH_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.GRAT2.WLEN,OBS.TARG.NAME,ARCFILE;
select execute(ACTION_STD_TELL_BLUE) from inputFiles where RAW.TYPE=="STD_TELL_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.GRAT1.WLEN,OBS.TARG.NAME,ARCFILE;
select execute(ACTION_STD_TELL_RED) from inputFiles where RAW.TYPE=="STD_TELL_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.GRAT2.WLEN,OBS.TARG.NAME,ARCFILE;
select execute(ACTION_FMTCHK_MOS_RED) from inputFiles where RAW.TYPE=="FMTCHK_MOS_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.SLIT3.PLATE,INS.GRAT2.WLEN,ARCFILE;
select execute(ACTION_ORDERDEF_MOS_RED) from inputFiles where RAW.TYPE=="ORDERDEF_MOS_RED"
  group by INS.SLIT3.PLATE,INS.GRAT2.WLEN,ARCFILE;
select execute(ACTION_SFLAT_MOS_RED) from inputFiles where RAW.TYPE=="SFLAT_MOS_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.GRAT2.WLEN,TPL.START as (TPL_A,tpl);
select execute(ACTION_NASMYTH_MOS_RED) from inputFiles where RAW.TYPE=="NASMYTH_MOS_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,INS.SLIT3.MODE,INS.GRAT2.WLEN,TPL.START as (TPL_A,tpl);
select execute(ACTION_FFLAT_MOS_SIM_RED) from inputFiles where RAW.TYPE=="FFLAT_MOS_SIM_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.SLIT3.MODE,INS.SLIT3.PLATE,INS.GRAT2.WLEN,TPL.START as (TPL_A,tpl);
select execute(ACTION_FFLAT_MOS_OZ_RED) from inputFiles where RAW.TYPE=="FFLAT_MOS_OZ_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.SLIT3.MODE,INS.SLIT3.PLATE,INS.GRAT2.WLEN,TPL.START as (TPL_A,tpl);
select execute(ACTION_WAVE_MOS_RED) from inputFiles where RAW.TYPE=="WAVE_MOS_RED"
  group by INS.SLIT3.MODE,INS.SLIT3.PLATE,INS.GRAT2.WLEN,ARCFILE;
select execute(ACTION_SCI_EXTENDED_ECH_BLUE) from inputFiles where RAW.TYPE=="SCI_EXTENDED_ECH_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT1.WLEN,INS.SLIT2.WID,ARCFILE;
select execute(ACTION_SCI_EXTENDED_ECH_RED) from inputFiles where RAW.TYPE=="SCI_EXTENDED_ECH_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT2.WLEN,INS.SLIT3.WID,ARCFILE;
select execute(ACTION_SCI_POINT_ECH_BLUE) from inputFiles where RAW.TYPE=="SCI_POINT_ECH_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT1.WLEN,INS.SLIT2.WID,ARCFILE;
select execute(ACTION_SCI_POINT_ECH_RED) from inputFiles where RAW.TYPE=="SCI_POINT_ECH_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT2.WLEN,INS.SLIT3.WID,ARCFILE;
select execute(ACTION_SCI_SLIC_ECH_BLUE) from inputFiles where RAW.TYPE=="SCI_SLIC_ECH_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT1.WLEN,INS.SLIT2.WID,ARCFILE;
select execute(ACTION_SCI_SLIC_ECH_RED) from inputFiles where RAW.TYPE=="SCI_SLIC_ECH_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT2.WLEN,INS.SLIT3.WID,ARCFILE;
select execute(ACTION_SCI_SPEC_BLUE) from inputFiles where RAW.TYPE=="SCI_SPEC_BLUE"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT1.WLEN,INS.SLIT2.WID,ARCFILE;
select execute(ACTION_SCI_SPEC_RED) from inputFiles where RAW.TYPE=="SCI_SPEC_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.MODE,INS.SLIT1.NAME,INS.GRAT2.WLEN,INS.SLIT3.WID,ARCFILE;
select execute(ACTION_SCIENCE_MOS_RED) from inputFiles where RAW.TYPE=="SCIENCE_MOS_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.SLIT3.MODE,INS.SLIT3.PLATE,INS.GRAT2.WLEN,ARCFILE;
select execute(ACTION_SCIENCE_MOS_SIM_RED) from inputFiles where RAW.TYPE=="SCIENCE_MOS_SIM_RED"
  group by DET.CHIPS,DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.SLIT3.MODE,INS.SLIT3.PLATE,INS.GRAT2.WLEN,ARCFILE;
action ACTION_BIAS_BLUE
{
  recipe uves_cal_mbias;
  product MASTER_BIAS_BLUE { PRO.CATG="MASTER_BIAS_BLUE"; PRO.EXT="tpl_0000.fits";}
}
action ACTION_BIAS_RED
{
  recipe uves_cal_mbias;
  product MASTER_BIAS_REDL { PRO.CATG="MASTER_BIAS_REDL"; PRO.EXT="tpl_0000.fits";}
  product MASTER_BIAS_REDU { PRO.CATG="MASTER_BIAS_REDU"; PRO.EXT="tpl_0001.fits";}
}
action ACTION_CCDTEST_BLUE
{
  recipe uves_cal_lingain;
}
action ACTION_CCDTEST_RED
{
  recipe uves_cal_lingain;
}
action ACTION_DARK_BLUE
{
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_BLUE from calibFiles where
    PRO.CATG=="MASTER_BIAS_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  product MASTER_DARK_BLUE { PRO.CATG="MASTER_DARK_BLUE"; PRO.EXT="tpl_0000.fits";}
  recipe uves_cal_mdark;
}
action ACTION_DARK_RED
{
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  recipe uves_cal_mdark;
  product MASTER_DARK_REDL { PRO.CATG="MASTER_DARK_REDL"; PRO.EXT="tpl_0000.fits";}
  product MASTER_DARK_REDU { PRO.CATG="MASTER_DARK_REDU"; PRO.EXT="tpl_0001.fits";}
}
action ACTION_PDARK_BLUE
{
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_BLUE from calibFiles where
    PRO.CATG=="MASTER_BIAS_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  recipe uves_cal_mdark;
}
action ACTION_PDARK_RED
{
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  recipe uves_cal_mdark;
}
action ACTION_CD_ALIGN_ECH_BLUE
{
  recipe uves_cal_cd_align ;
}
action ACTION_CD_ALIGN_ECH_RED
{
  recipe uves_cal_cd_align ;
}
action ACTION_FMTCHK_ECH_BLUE
{
  minRet = 1; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_FORM_BLUE from calibFiles where
    PRO.CATG=="MASTER_FORM_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  recipe uves_cal_predict;
  product ORDER_GUESS_TAB_BLUE { PRO.CATG="ORDER_GUESS_TAB_BLUE"; PRO.EXT="0001.fits";}
  product LINE_GUESS_TAB_BLUE { PRO.CATG="LINE_GUESS_TAB_BLUE"; PRO.EXT="0003.fits";}
}
action ACTION_ORDERDEF_ECH_BLUE
{
  minRet = 1; maxRet = 1;
  select file as ORDER_GUESS_TAB_BLUE from calibFiles where
    PRO.CATG=="ORDER_GUESS_TAB_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  recipe uves_cal_orderpos;
  product ORDER_TABLE_BLUE { PRO.CATG="ORDER_TABLE_BLUE"; PRO.EXT="0000.fits";}
}
action ACTION_EFLAT_ECH_BLUE
{
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_BLUE from calibFiles where
    PRO.CATG=="MASTER_BIAS_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_BLUE from calibFiles where
    PRO.CATG=="ORDER_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  recipe uves_cal_mflat;
  product MASTER_FLAT_BLUE { PRO.CATG="MASTER_FLAT_BLUE"; PRO.EXT="tpl_0000.fits";}
}
action ACTION_DFLAT_ECH_BLUE
{
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_BLUE from calibFiles where
    PRO.CATG=="MASTER_BIAS_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_BLUE from calibFiles where
    PRO.CATG=="ORDER_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  recipe uves_cal_mflat;
}
action ACTION_WAVE_ECH_BLUE
{
  minRet = 1; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as LINE_INTMON_TABLE from calibFiles where
    PRO.CATG=="LINE_INTMON_TABLE"
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_BLUE from calibFiles where
    PRO.CATG=="ORDER_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_GUESS_TAB_BLUE from calibFiles where
    PRO.CATG=="LINE_GUESS_TAB_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  recipe uves_cal_wavecal {
  "--tolerance=10.0";
  "--degree=4";
  }
  product LINE_TABLE_BLUE { PRO.CATG="LINE_TABLE_BLUE"; PRO.EXT="0000.fits";}
}
action ACTION_FMTCHK_SPEC_BLUE
{
  minRet = 1; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as SPEC_MASTER_FORM_BLUE from calibFiles where
    PRO.CATG=="SPEC_MASTER_FORM_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  recipe none;
  product SPEC_ORDER_GUESS_TAB_BLUE { PRO.CATG="SPEC_ORDER_GUESS_TAB_BLUE"; PRO.EXT="0001.fits";}
  product SPEC_LINE_GUESS_TAB_BLUE { PRO.CATG="SPEC_LINE_GUESS_TAB_BLUE"; PRO.EXT="0003.fits";}
}
action ACTION_ORDERDEF_SPEC_BLUE
{
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_GUESS_TAB_BLUE from calibFiles where
    PRO.CATG=="SPEC_ORDER_GUESS_TAB_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  recipe none;
  product SPEC_ORDER_TABLE_BLUE { PRO.CATG="SPEC_ORDER_TABLE_BLUE"; PRO.EXT="0000.fits";}
}
action ACTION_EFLAT_SPEC_BLUE
{
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_BLUE from calibFiles where
    PRO.CATG=="MASTER_BIAS_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_TABLE_BLUE from calibFiles where
    PRO.CATG=="SPEC_ORDER_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  recipe none;
  product SPEC_MASTER_FLAT_BLUE { PRO.CATG="SPEC_MASTER_FLAT_BLUE"; PRO.EXT="tpl_0000.fits";}
}
action ACTION_DFLAT_SPEC_BLUE
{
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_BLUE from calibFiles where
    PRO.CATG=="MASTER_BIAS_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_TABLE_BLUE from calibFiles where
    PRO.CATG=="SPEC_ORDER_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  recipe none;
}
action ACTION_WAVE_SPEC_BLUE
{
  minRet = 1; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as LINE_INTMON_TABLE from calibFiles where
    PRO.CATG=="LINE_INTMON_TABLE"
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_TABLE_BLUE from calibFiles where
    PRO.CATG=="SPEC_ORDER_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_LINE_GUESS_TAB_BLUE from calibFiles where
    PRO.CATG=="SPEC_LINE_GUESS_TAB_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  recipe none;
  product SPEC_LINE_TABLE_BLUE { PRO.CATG="SPEC_LINE_TABLE_BLUE"; PRO.EXT="0000.fits";}
}
action ACTION_FMTCHK_ECH_RED
{
  minRet = 1; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_FORM_REDL from calibFiles where
    PRO.CATG=="MASTER_FORM_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_FORM_REDU from calibFiles where
    PRO.CATG=="MASTER_FORM_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe uves_cal_predict;
  product ORDER_GUESS_TAB_REDL { PRO.CATG="ORDER_GUESS_TAB_REDL"; PRO.EXT="0001.fits";}
  product LINE_GUESS_TAB_REDL { PRO.CATG="LINE_GUESS_TAB_REDL"; PRO.EXT="0003.fits";}
  product ORDER_GUESS_TAB_REDU { PRO.CATG="ORDER_GUESS_TAB_REDU"; PRO.EXT="0005.fits";}
  product LINE_GUESS_TAB_REDU { PRO.CATG="LINE_GUESS_TAB_REDU"; PRO.EXT="0007.fits";}
}
action ACTION_ORDERDEF_ECH_RED
{
  minRet = 1; maxRet = 1;
  select file as ORDER_GUESS_TAB_REDL from calibFiles where
    PRO.CATG=="ORDER_GUESS_TAB_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_GUESS_TAB_REDU from calibFiles where
    PRO.CATG=="ORDER_GUESS_TAB_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe uves_cal_orderpos;
  product ORDER_TABLE_REDL { PRO.CATG="ORDER_TABLE_REDL"; PRO.EXT="0000.fits";}
  product ORDER_TABLE_REDU { PRO.CATG="ORDER_TABLE_REDU"; PRO.EXT="0003.fits";}
}
action ACTION_EFLAT_ECH_RED
{
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDL from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDU from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe uves_cal_mflat;
  product MASTER_FLAT_REDL { PRO.CATG="MASTER_FLAT_REDL"; PRO.EXT="tpl_0000.fits";}
  product MASTER_FLAT_REDU { PRO.CATG="MASTER_FLAT_REDU"; PRO.EXT="tpl_0002.fits";}
}
action ACTION_IFLAT_ECH_RED
{
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDL from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDU from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe uves_cal_mflat;
}
action ACTION_WAVE_ECH_RED
{
  minRet = 1; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as LINE_INTMON_TABLE from calibFiles where
    PRO.CATG=="LINE_INTMON_TABLE"
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDL from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_GUESS_TAB_REDL from calibFiles where
    PRO.CATG=="LINE_GUESS_TAB_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDU from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_GUESS_TAB_REDU from calibFiles where
    PRO.CATG=="LINE_GUESS_TAB_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe uves_cal_wavecal {
  "--tolerance=10.0";
  "--degree=4";
  }
  product LINE_TABLE_REDL { PRO.CATG="LINE_TABLE_REDL"; PRO.EXT="0000.fits";}
  product LINE_TABLE_REDU { PRO.CATG="LINE_TABLE_REDU"; PRO.EXT="0004.fits";}
}
action ACTION_FMTCHK_SPEC_RED
{
  minRet = 1; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as SPEC_MASTER_FORM_REDL from calibFiles where
    PRO.CATG=="SPEC_MASTER_FORM_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as SPEC_MASTER_FORM_REDU from calibFiles where
    PRO.CATG=="SPEC_MASTER_FORM_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe none;
  product SPEC_ORDER_GUESS_TAB_REDL { PRO.CATG="SPEC_ORDER_GUESS_TAB_REDL"; PRO.EXT="0001.fits";}
  product SPEC_LINE_GUESS_TAB_REDL { PRO.CATG="SPEC_LINE_GUESS_TAB_REDL"; PRO.EXT="0003.fits";}
  product SPEC_ORDER_GUESS_TAB_REDU { PRO.CATG="SPEC_ORDER_GUESS_TAB_REDU"; PRO.EXT="0005.fits";}
  product SPEC_LINE_GUESS_TAB_REDU { PRO.CATG="SPEC_LINE_GUESS_TAB_REDU"; PRO.EXT="0007.fits";}
}
action ACTION_ORDERDEF_SPEC_RED
{
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_GUESS_TAB_REDL from calibFiles where
    PRO.CATG=="SPEC_ORDER_GUESS_TAB_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_GUESS_TAB_REDU from calibFiles where
    PRO.CATG=="SPEC_ORDER_GUESS_TAB_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe none;
  product SPEC_ORDER_TABLE_REDL { PRO.CATG="SPEC_ORDER_TABLE_REDL"; PRO.EXT="0000.fits";}
  product SPEC_ORDER_TABLE_REDU { PRO.CATG="SPEC_ORDER_TABLE_REDU"; PRO.EXT="0003.fits";}
}
action ACTION_EFLAT_SPEC_RED
{
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_TABLE_REDL from calibFiles where
    PRO.CATG=="SPEC_ORDER_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_TABLE_REDU from calibFiles where
    PRO.CATG=="SPEC_ORDER_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe none;
  product SPEC_MASTER_FLAT_REDL { PRO.CATG="SPEC_MASTER_FLAT_REDL"; PRO.EXT="tpl_0000.fits";}
  product SPEC_MASTER_FLAT_REDU { PRO.CATG="SPEC_MASTER_FLAT_REDU"; PRO.EXT="tpl_0002.fits";}
}
action ACTION_IFLAT_SPEC_RED
{
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_TABLE_REDL from calibFiles where
    PRO.CATG=="SPEC_ORDER_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_TABLE_REDU from calibFiles where
    PRO.CATG=="SPEC_ORDER_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe none;
}
action ACTION_WAVE_SPEC_RED
{
  minRet = 1; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as LINE_INTMON_TABLE from calibFiles where
    PRO.CATG=="LINE_INTMON_TABLE"
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_TABLE_REDL from calibFiles where
    PRO.CATG=="SPEC_ORDER_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY  and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_LINE_GUESS_TAB_REDL from calibFiles where
    PRO.CATG=="SPEC_LINE_GUESS_TAB_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY  and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_TABLE_REDU from calibFiles where
    PRO.CATG=="SPEC_ORDER_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_LINE_GUESS_TAB_REDU from calibFiles where
    PRO.CATG=="SPEC_LINE_GUESS_TAB_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe none;
  product SPEC_LINE_TABLE_REDL { PRO.CATG="SPEC_LINE_TABLE_REDL"; PRO.EXT="0000.fits";}
  product SPEC_LINE_TABLE_REDU { PRO.CATG="SPEC_LINE_TABLE_REDU"; PRO.EXT="0004.fits";}
}
action ACTION_STD_ECH_BLUE
{
  minRet = 1; maxRet = 1;
  select file as FLUX_STD_TABLE from calibFiles where
    PRO.CATG=="FLUX_STD_TABLE"
  ;
  minRet = 1; maxRet = 1;
  select file as EXTCOEFF_TABLE from calibFiles where
    PRO.CATG=="EXTCOEFF_TABLE"
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_BLUE from calibFiles where
    PRO.CATG=="ORDER_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_BLUE from calibFiles where
    PRO.CATG=="LINE_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_BLUE from calibFiles where
    PRO.CATG=="MASTER_BIAS_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_BLUE from calibFiles where
    PRO.CATG=="MASTER_FLAT_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;

  recipe uves_cal_response {
  "--reduce.tiltcorr=false";
  }
  product MASTER_RESPONSE_BLUE { PRO.CATG="MASTER_RESPONSE_BLUE"; PRO.EXT="0000.fits";}
}
action ACTION_STD_ECH_RED
{
  minRet = 1; maxRet = 1;
  select file as FLUX_STD_TABLE from calibFiles where
    PRO.CATG=="FLUX_STD_TABLE"
  ;
  minRet = 1; maxRet = 1;
  select file as EXTCOEFF_TABLE from calibFiles where
    PRO.CATG=="EXTCOEFF_TABLE"
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDL from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_REDL from calibFiles where
    PRO.CATG=="LINE_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_REDL from calibFiles where
    PRO.CATG=="MASTER_FLAT_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDU from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_REDU from calibFiles where
    PRO.CATG=="LINE_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_REDU from calibFiles where
    PRO.CATG=="MASTER_FLAT_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED  and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe uves_cal_response {
  "--reduce.tiltcorr=false";
  }
  product MASTER_RESPONSE_REDL { PRO.CATG="MASTER_RESPONSE_REDL"; PRO.EXT="0000.fits";}
  product MASTER_RESPONSE_REDU { PRO.CATG="MASTER_RESPONSE_REDU"; PRO.EXT="0001.fits";}
}
action ACTION_STD_TELL_BLUE
{
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_BLUE from calibFiles where
    PRO.CATG=="ORDER_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY  and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_BLUE from calibFiles where
    PRO.CATG=="LINE_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_BLUE from calibFiles where
    PRO.CATG=="MASTER_BIAS_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_BLUE from calibFiles where
    PRO.CATG=="MASTER_FLAT_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_RESPONSE_BLUE from calibFiles where
    PRO.CATG=="MASTER_RESPONSE_BLUE"
    and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as EXTCOEFF_TABLE from calibFiles where
    PRO.CATG=="EXTCOEFF_TABLE"
  ;

  recipe uves_obs_scired {
  "--reduce.tiltcorr=true";
  }
}
action ACTION_STD_TELL_RED
{
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDL from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_REDL from calibFiles where
    PRO.CATG=="LINE_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_REDL from calibFiles where
    PRO.CATG=="MASTER_FLAT_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_RESPONSE_REDL from calibFiles where
    PRO.CATG=="MASTER_RESPONSE_REDL"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDU from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_REDU from calibFiles where
    PRO.CATG=="LINE_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_REDU from calibFiles where
    PRO.CATG=="MASTER_FLAT_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_RESPONSE_REDU from calibFiles where
    PRO.CATG=="MASTER_RESPONSE_REDU"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as EXTCOEFF_TABLE from calibFiles where
    PRO.CATG=="EXTCOEFF_TABLE"
  ;
  recipe uves_obs_scired {
  "--reduce.tiltcorr=true";
  "--reduce.extract.kappa=20";
  }
}
action ACTION_TFLAT_ECH_BLUE
{
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_BLUE from calibFiles where
    PRO.CATG=="MASTER_BIAS_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_BLUE from calibFiles where
    PRO.CATG=="ORDER_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_BLUE from calibFiles where
    PRO.CATG=="LINE_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
    and INS.SLIT2.WID==1.00
  ;
  minRet = 1; maxRet = 1;
  select file as REF_TFLAT_BLUE from calibFiles where
    PRO.CATG=="REF_TFLAT_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN and inputFile.INS.SLIT1.NAME==INS.SLIT1.NAME
  ;
  recipe uves_cal_tflat {
  "--reduce.tiltcorr=false";
  }
}
action ACTION_TFLAT_ECH_RED
{
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDL from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_REDL from calibFiles where
    PRO.CATG=="LINE_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
    and INS.SLIT3.WID==1.00
  ;
  minRet = 1; maxRet = 1;
  select file as REF_TFLAT_REDL from calibFiles where
    PRO.CATG=="REF_TFLAT_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT1.NAME==INS.SLIT1.NAME
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDU from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_REDU from calibFiles where
    PRO.CATG=="LINE_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
    and INS.SLIT3.WID==1.00
  ;
  minRet = 1; maxRet = 1;
  select file as REF_TFLAT_REDU from calibFiles where
    PRO.CATG=="REF_TFLAT_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT1.NAME==INS.SLIT1.NAME
  ;
  recipe uves_cal_tflat {
  "--reduce.tiltcorr=false";
  }
}
action ACTION_SCI_EXTENDED_ECH_BLUE
{
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_BLUE from calibFiles where
    PRO.CATG=="ORDER_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_BLUE from calibFiles where
    PRO.CATG=="LINE_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN and inputFile.INS.SLIT2.WID==INS.SLIT2.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_BLUE from calibFiles where
    PRO.CATG=="MASTER_BIAS_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_BLUE from calibFiles where
    PRO.CATG=="MASTER_FLAT_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN and inputFile.INS.SLIT2.WID==INS.SLIT2.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_RESPONSE_BLUE from calibFiles where
    PRO.CATG=="MASTER_RESPONSE_BLUE"
    and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as EXTCOEFF_TABLE from calibFiles where
    PRO.CATG=="EXTCOEFF_TABLE"
  ;


// Force workflow to work adding frames that otherwhise are not needed
  minRet = 0; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as ARC_LAMP_FORM_BLUE from calibFiles where
    DO.CATG=="ARC_LAMP_FORM_BLUE" and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY
  ;
  minRet = 0; maxRet = 1;
  select file as FLUX_STD_TABLE from calibFiles where
    PRO.CATG=="FLUX_STD_TABLE"
  ;


  recipe uves_obs_scired {
    "--reduce.backsub.mmethod=minimum";
    "--reduce.tiltcorr=true";
    "--reduce.extract.method=2d";
  }
}
action ACTION_SCI_EXTENDED_ECH_RED
{
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDL from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_REDL from calibFiles where
    PRO.CATG=="LINE_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_REDL from calibFiles where
    PRO.CATG=="MASTER_FLAT_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_RESPONSE_REDL from calibFiles where
    PRO.CATG=="MASTER_RESPONSE_REDL"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDU from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_REDU from calibFiles where
    PRO.CATG=="LINE_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_REDU from calibFiles where
    PRO.CATG=="MASTER_FLAT_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_RESPONSE_REDU from calibFiles where
    PRO.CATG=="MASTER_RESPONSE_REDU"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as EXTCOEFF_TABLE from calibFiles where
    PRO.CATG=="EXTCOEFF_TABLE"
  ;



// Force workflow to work adding frames that otherwhise are not needed
  minRet = 0; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as ARC_LAMP_FORM_RED from calibFiles where
    DO.CATG=="ARC_LAMP_FORM_RED" and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY
  ;
  minRet = 0; maxRet = 1;
  select file as FLUX_STD_TABLE from calibFiles where
    PRO.CATG=="FLUX_STD_TABLE"
  ;

  recipe uves_obs_scired {
    "--reduce.backsub.mmethod=minimum";
    "--reduce.tiltcorr=true";
    "--reduce.extract.method=2d";
  }
}
action ACTION_SCI_POINT_ECH_BLUE
{
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_BLUE from calibFiles where
    PRO.CATG=="ORDER_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_BLUE from calibFiles where
    PRO.CATG=="LINE_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN and inputFile.INS.SLIT2.WID==INS.SLIT2.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_BLUE from calibFiles where
    PRO.CATG=="MASTER_BIAS_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;

  minRet = 0; maxRet = 1;
  select file as MASTER_DARK_BLUE from calibFiles where
    PRO.CATG=="MASTER_DARK_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;

  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_BLUE from calibFiles where
    PRO.CATG=="MASTER_FLAT_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN and inputFile.INS.SLIT2.WID==INS.SLIT2.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_RESPONSE_BLUE from calibFiles where
    PRO.CATG=="MASTER_RESPONSE_BLUE"
    and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as EXTCOEFF_TABLE from calibFiles where
    PRO.CATG=="EXTCOEFF_TABLE"
  ;

// Force workflow to work adding frames that otherwhise are not needed
  minRet = 0; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as ARC_LAMP_FORM_BLUE from calibFiles where
    DO.CATG=="ARC_LAMP_FORM_BLUE" and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY
  ;
  minRet = 0; maxRet = 1;
  select file as FLUX_STD_TABLE from calibFiles where
    PRO.CATG=="FLUX_STD_TABLE"
  ;
  recipe uves_obs_scired {
  "--reduce.tiltcorr=true";
  }
}
action ACTION_SCI_POINT_ECH_RED
{
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDL from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_REDL from calibFiles where
    PRO.CATG=="LINE_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_REDL from calibFiles where
    PRO.CATG=="MASTER_FLAT_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_RESPONSE_REDL from calibFiles where
    PRO.CATG=="MASTER_RESPONSE_REDL"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDU from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_REDU from calibFiles where
    PRO.CATG=="LINE_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_REDU from calibFiles where
    PRO.CATG=="MASTER_FLAT_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_RESPONSE_REDU from calibFiles where
    PRO.CATG=="MASTER_RESPONSE_REDU"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as EXTCOEFF_TABLE from calibFiles where
    PRO.CATG=="EXTCOEFF_TABLE"
  ;



// Force workflow to work adding frames that otherwhise are not needed
  minRet = 0; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as ARC_LAMP_FORM_RED from calibFiles where
    DO.CATG=="ARC_LAMP_FORM_RED" and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY
  ;
  minRet = 0; maxRet = 1;
  select file as FLUX_STD_TABLE from calibFiles where
    PRO.CATG=="FLUX_STD_TABLE"
  ;

  recipe uves_obs_scired {
  "--reduce.tiltcorr=true";
  }
}
action ACTION_SCI_SLIC_ECH_BLUE
{
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_BLUE from calibFiles where
    PRO.CATG=="ORDER_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_BLUE from calibFiles where
    PRO.CATG=="LINE_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN and inputFile.INS.SLIT2.WID==INS.SLIT2.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_BLUE from calibFiles where
    PRO.CATG=="MASTER_BIAS_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_BLUE from calibFiles where
    PRO.CATG=="MASTER_FLAT_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN and inputFile.INS.SLIT2.WID==INS.SLIT2.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_RESPONSE_BLUE from calibFiles where
    PRO.CATG=="MASTER_RESPONSE_BLUE"
    and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as EXTCOEFF_TABLE from calibFiles where
    PRO.CATG=="EXTCOEFF_TABLE"
  ;



// Force workflow to work adding frames that otherwhise are not needed
  minRet = 0; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as ARC_LAMP_FORM_BLUE from calibFiles where
    DO.CATG=="ARC_LAMP_FORM_BLUE" and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY
  ;





  recipe uves_obs_scired {
    "--reduce.extract.method=average";
    "--reduce.tiltcorr=true";
  }
}
action ACTION_SCI_SLIC_ECH_RED
{
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDL from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_REDL from calibFiles where
    PRO.CATG=="LINE_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_REDL from calibFiles where
    PRO.CATG=="MASTER_FLAT_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_RESPONSE_REDL from calibFiles where
    PRO.CATG=="MASTER_RESPONSE_REDL"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as ORDER_TABLE_REDU from calibFiles where
    PRO.CATG=="ORDER_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as LINE_TABLE_REDU from calibFiles where
    PRO.CATG=="LINE_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_FLAT_REDU from calibFiles where
    PRO.CATG=="MASTER_FLAT_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_RESPONSE_REDU from calibFiles where
    PRO.CATG=="MASTER_RESPONSE_REDU"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as EXTCOEFF_TABLE from calibFiles where
    PRO.CATG=="EXTCOEFF_TABLE"
  ;





// Force workflow to work adding frames that otherwhise are not needed
  minRet = 0; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as ARC_LAMP_FORM_RED from calibFiles where
    DO.CATG=="ARC_LAMP_FORM_RED" and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY
  ;



  recipe uves_obs_scired {
    "--reduce.extract.method=average";
    "--reduce.tiltcorr=true";
  }
}
action ACTION_SCI_SPEC_BLUE
{
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_TABLE_BLUE from calibFiles where
    PRO.CATG=="SPEC_ORDER_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_LINE_TABLE_BLUE from calibFiles where
    PRO.CATG=="SPEC_LINE_TABLE_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN and inputFile.INS.SLIT2.WID==INS.SLIT2.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_BLUE from calibFiles where
    PRO.CATG=="MASTER_BIAS_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_MASTER_FLAT_BLUE from calibFiles where
    PRO.CATG=="SPEC_MASTER_FLAT_BLUE"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN and inputFile.INS.SLIT2.WID==INS.SLIT2.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 0; maxRet = 1;
  select file as SPEC_MASTER_RESPONSE_BLUE from calibFiles where
    PRO.CATG=="SPEC_MASTER_RESPONSE_BLUE"
    and inputFile.INS.GRAT1.WLEN==INS.GRAT1.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as EXTCOEFF_TABLE from calibFiles where
    PRO.CATG=="EXTCOEFF_TABLE"
  ;
  recipe none;
}
action ACTION_SCI_SPEC_RED
{
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_TABLE_REDL from calibFiles where
    PRO.CATG=="SPEC_ORDER_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_LINE_TABLE_REDL from calibFiles where
    PRO.CATG=="SPEC_LINE_TABLE_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_MASTER_FLAT_REDL from calibFiles where
    PRO.CATG=="SPEC_MASTER_FLAT_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 0; maxRet = 1;
  select file as SPEC_MASTER_RESPONSE_REDL from calibFiles where
    PRO.CATG=="SPEC_MASTER_RESPONSE_REDL"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_ORDER_TABLE_REDU from calibFiles where
    PRO.CATG=="SPEC_ORDER_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_LINE_TABLE_REDU from calibFiles where
    PRO.CATG=="SPEC_LINE_TABLE_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as SPEC_MASTER_FLAT_REDU from calibFiles where
    PRO.CATG=="SPEC_MASTER_FLAT_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.WID==INS.SLIT3.WID
    and ( OBS.ID==inputFile.OBS.ID or (MJD-OBS < inputFile.MJD-OBS or MJD-OBS >= inputFile.MJD-OBS) )
  ;
  minRet = 0; maxRet = 1;
  select file as SPEC_MASTER_RESPONSE_REDU from calibFiles where
    PRO.CATG=="SPEC_MASTER_RESPONSE_REDU"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as EXTCOEFF_TABLE from calibFiles where
    PRO.CATG=="EXTCOEFF_TABLE"
  ;
  recipe none;
}
action ACTION_FMTCHK_MOS_RED
{
  minRet = 1; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_FORM_REDL from calibFiles where
    PRO.CATG=="MASTER_FORM_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 0; maxRet = 1;
  select file as MASTER_FORM_REDU from calibFiles where
    PRO.CATG=="MASTER_FORM_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe flames_cal_predict {
  }
  product FIB_LIN_GUE_REDL { PRO.CATG="FIB_LIN_GUE_REDL"; PRO.EXT="0000.fits";}
  product FIB_LIN_GUE_REDU { PRO.CATG="FIB_LIN_GUE_REDU"; PRO.EXT="0001.fits";}
  product FIB_ORD_GUE_REDL { PRO.CATG="FIB_ORD_GUE_REDL"; PRO.EXT="0002.fits";}
  product FIB_ORD_GUE_REDU { PRO.CATG="FIB_ORD_GUE_REDU"; PRO.EXT="0003.fits";}
}
action ACTION_ORDERDEF_MOS_RED
{
  minRet = 1; maxRet = 1;
  select file as FIB_ORD_GUE_REDL from calibFiles where
    PRO.CATG=="FIB_ORD_GUE_REDL"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORD_GUE_REDU from calibFiles where
    PRO.CATG=="FIB_ORD_GUE_REDU"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe flames_cal_orderpos;
  product FIB_ORDEF_REDL { PRO.CATG="FIB_ORDEF_REDL"; PRO.EXT="0000.fits";}
  product FIB_ORD_TAB_REDL { PRO.CATG="FIB_ORD_TAB_REDL"; PRO.EXT="0001.fits";}
  product FIB_ORDEF_REDU { PRO.CATG="FIB_ORDEF_REDU"; PRO.EXT="0002.fits";}
  product FIB_ORD_TAB_REDU { PRO.CATG="FIB_ORD_TAB_REDU"; PRO.EXT="0003.fits";}
}
action ACTION_SFLAT_MOS_RED
{
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORD_TAB_REDL from calibFiles where
    PRO.CATG=="FIB_ORD_TAB_REDL"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORD_TAB_REDU from calibFiles where
    PRO.CATG=="FIB_ORD_TAB_REDU"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe flames_cal_mkmaster {
  }
  product MASTER_SFLAT_REDL { PRO.CATG="MASTER_SFLAT_REDL"; PRO.EXT="tpl_0000.fits";}
  product MASTER_SFLAT_REDU { PRO.CATG="MASTER_SFLAT_REDU"; PRO.EXT="tpl_0001.fits";}
  product MASTER_SFLAT_REDL { PRO.CATG="MASTER_SFLAT_REDL"; PRO.EXT="tpl_0002.fits";}
  product MASTER_SFLAT_REDU { PRO.CATG="MASTER_SFLAT_REDU"; PRO.EXT="tpl_0003.fits";}
  product MASTER_SFLAT_REDL { PRO.CATG="MASTER_SFLAT_REDL"; PRO.EXT="tpl_0004.fits";}
  product MASTER_SFLAT_REDU { PRO.CATG="MASTER_SFLAT_REDU"; PRO.EXT="tpl_0005.fits";}
}
action ACTION_FFLAT_MOS_OZ_RED
{
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORDEF_REDL from calibFiles where
    PRO.CATG=="FIB_ORDEF_REDL"
    and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORD_TAB_REDL from calibFiles where
    PRO.CATG=="FIB_ORD_TAB_REDL"
    and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 3;
  select file as MASTER_SFLAT_REDL from calibFiles where
    PRO.CATG=="MASTER_SFLAT_REDL"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORDEF_REDU from calibFiles where
    PRO.CATG=="FIB_ORDEF_REDU"
    and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORD_TAB_REDU from calibFiles where
    PRO.CATG=="FIB_ORD_TAB_REDU"
    and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 3;
  select file as MASTER_SFLAT_REDU from calibFiles where
    PRO.CATG=="MASTER_SFLAT_REDU"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe flames_cal_prep_sff_ofpos {
  "--sat_thr=55000";
  }
  product SLIT_FF_COM_REDL { PRO.CATG="SLIT_FF_COM_REDL"; PRO.EXT="tpl_0003.fits";}
  product SLIT_FF_NOR_REDL { PRO.CATG="SLIT_FF_NOR_REDL"; PRO.EXT="tpl_0004.fits";}
  product SLIT_FF_DTC_REDL { PRO.CATG="SLIT_FF_DTC_REDL"; PRO.EXT="tpl_0005.fits";}
  product SLIT_FF_SGC_REDL { PRO.CATG="SLIT_FF_SGC_REDL"; PRO.EXT="tpl_0006.fits";}
  product SLIT_FF_BPC_REDL { PRO.CATG="SLIT_FF_BPC_REDL"; PRO.EXT="tpl_0007.fits";}
  product SLIT_FF_BNC_REDL { PRO.CATG="SLIT_FF_BNC_REDL"; PRO.EXT="tpl_0008.fits";}
  product FIB_ORDEF_TABLE_REDL { PRO.CATG="FIB_ORDEF_TABLE_REDL"; PRO.EXT="tpl_0009.fits";}
  product FIB_FF_COM_REDL { PRO.CATG="FIB_FF_COM_REDL"; PRO.EXT="tpl_0010.fits";}
  product FIB_FF_NOR_REDL { PRO.CATG="FIB_FF_NOR_REDL"; PRO.EXT="tpl_0011.fits";}
  product FIB_FF_NSG_REDL { PRO.CATG="FIB_FF_NSG_REDL"; PRO.EXT="tpl_0012.fits";}
  product FIB_FF_DTC_REDL { PRO.CATG="FIB_FF_DTC_REDL"; PRO.EXT="tpl_0013.fits";}
  product FIB_FF_SGC_REDL { PRO.CATG="FIB_FF_SGC_REDL"; PRO.EXT="tpl_0014.fits";}
  product FIB_FF_BPC_REDL { PRO.CATG="FIB_FF_BPC_REDL"; PRO.EXT="tpl_0015.fits";}
  product SLIT_FF_COM_REDU { PRO.CATG="SLIT_FF_COM_REDU"; PRO.EXT="tpl_0016.fits";}
  product SLIT_FF_NOR_REDU { PRO.CATG="SLIT_FF_NOR_REDU"; PRO.EXT="tpl_0017.fits";}
  product SLIT_FF_DTC_REDU { PRO.CATG="SLIT_FF_DTC_REDU"; PRO.EXT="tpl_0018.fits";}
  product SLIT_FF_SGC_REDU { PRO.CATG="SLIT_FF_SGC_REDU"; PRO.EXT="tpl_0019.fits";}
  product SLIT_FF_BPC_REDU { PRO.CATG="SLIT_FF_BPC_REDU"; PRO.EXT="tpl_0020.fits";}
  product SLIT_FF_BNC_REDU { PRO.CATG="SLIT_FF_BNC_REDU"; PRO.EXT="tpl_0021.fits";}
  product FIB_ORDEF_TABLE_REDU { PRO.CATG="FIB_ORDEF_TABLE_REDU"; PRO.EXT="tpl_0022.fits";}
  product FIB_FF_COM_REDU { PRO.CATG="FIB_FF_COM_REDU"; PRO.EXT="tpl_0023.fits";}
  product FIB_FF_NOR_REDU { PRO.CATG="FIB_FF_NOR_REDU"; PRO.EXT="tpl_0024.fits";}
  product FIB_FF_NSG_REDU { PRO.CATG="FIB_FF_NSG_REDU"; PRO.EXT="tpl_0025.fits";}
  product FIB_FF_DTC_REDU { PRO.CATG="FIB_FF_DTC_REDU"; PRO.EXT="tpl_0026.fits";}
  product FIB_FF_SGC_REDU { PRO.CATG="FIB_FF_SGC_REDU"; PRO.EXT="tpl_0027.fits";}
  product FIB_FF_BPC_REDU { PRO.CATG="FIB_FF_BPC_REDU"; PRO.EXT="tpl_0028.fits";}
}
action ACTION_FFLAT_MOS_SIM_RED
{
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORDEF_REDL from calibFiles where
    PRO.CATG=="FIB_ORDEF_REDL"
    and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORD_TAB_REDL from calibFiles where
    PRO.CATG=="FIB_ORD_TAB_REDL"
    and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 3;
  select file as MASTER_SFLAT_REDL from calibFiles where
    PRO.CATG=="MASTER_SFLAT_REDL"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORDEF_REDU from calibFiles where
    PRO.CATG=="FIB_ORDEF_REDU"
    and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORD_TAB_REDU from calibFiles where
    PRO.CATG=="FIB_ORD_TAB_REDU"
    and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 3;
  select file as MASTER_SFLAT_REDU from calibFiles where
    PRO.CATG=="MASTER_SFLAT_REDU"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe flames_cal_prep_sff_ofpos {
  "--sat_thr=40000";
  }
  product SLIT_FF_COM_REDL { PRO.CATG="SLIT_FF_COM_REDL"; PRO.EXT="tpl_0003.fits";}
  product SLIT_FF_NOR_REDL { PRO.CATG="SLIT_FF_NOR_REDL"; PRO.EXT="tpl_0004.fits";}
  product SLIT_FF_DTC_REDL { PRO.CATG="SLIT_FF_DTC_REDL"; PRO.EXT="tpl_0005.fits";}
  product SLIT_FF_SGC_REDL { PRO.CATG="SLIT_FF_SGC_REDL"; PRO.EXT="tpl_0006.fits";}
  product SLIT_FF_BPC_REDL { PRO.CATG="SLIT_FF_BPC_REDL"; PRO.EXT="tpl_0007.fits";}
  product SLIT_FF_BNC_REDL { PRO.CATG="SLIT_FF_BNC_REDL"; PRO.EXT="tpl_0008.fits";}
  product FIB_ORDEF_TABLE_REDL { PRO.CATG="FIB_ORDEF_TABLE_REDL"; PRO.EXT="tpl_0009.fits";}
  product FIB_FF_COM_REDL { PRO.CATG="FIB_FF_COM_REDL"; PRO.EXT="tpl_0010.fits";}
  product FIB_FF_NOR_REDL { PRO.CATG="FIB_FF_NOR_REDL"; PRO.EXT="tpl_0011.fits";}
  product FIB_FF_NSG_REDL { PRO.CATG="FIB_FF_NSG_REDL"; PRO.EXT="tpl_0012.fits";}
  product FIB_FF_DTC_REDL { PRO.CATG="FIB_FF_DTC_REDL"; PRO.EXT="tpl_0013.fits";}
  product FIB_FF_SGC_REDL { PRO.CATG="FIB_FF_SGC_REDL"; PRO.EXT="tpl_0014.fits";}
  product FIB_FF_BPC_REDL { PRO.CATG="FIB_FF_BPC_REDL"; PRO.EXT="tpl_0015.fits";}
  product SLIT_FF_COM_REDU { PRO.CATG="SLIT_FF_COM_REDU"; PRO.EXT="tpl_0016.fits";}
  product SLIT_FF_NOR_REDU { PRO.CATG="SLIT_FF_NOR_REDU"; PRO.EXT="tpl_0017.fits";}
  product SLIT_FF_DTC_REDU { PRO.CATG="SLIT_FF_DTC_REDU"; PRO.EXT="tpl_0018.fits";}
  product SLIT_FF_SGC_REDU { PRO.CATG="SLIT_FF_SGC_REDU"; PRO.EXT="tpl_0019.fits";}
  product SLIT_FF_BPC_REDU { PRO.CATG="SLIT_FF_BPC_REDU"; PRO.EXT="tpl_0020.fits";}
  product SLIT_FF_BNC_REDU { PRO.CATG="SLIT_FF_BNC_REDU"; PRO.EXT="tpl_0021.fits";}
  product FIB_ORDEF_TABLE_REDU { PRO.CATG="FIB_ORDEF_TABLE_REDU"; PRO.EXT="tpl_0022.fits";}
  product FIB_FF_COM_REDU { PRO.CATG="FIB_FF_COM_REDU"; PRO.EXT="tpl_0023.fits";}
  product FIB_FF_NOR_REDU { PRO.CATG="FIB_FF_NOR_REDU"; PRO.EXT="tpl_0024.fits";}
  product FIB_FF_NSG_REDU { PRO.CATG="FIB_FF_NSG_REDU"; PRO.EXT="tpl_0025.fits";}
  product FIB_FF_DTC_REDU { PRO.CATG="FIB_FF_DTC_REDU"; PRO.EXT="tpl_0026.fits";}
  product FIB_FF_SGC_REDU { PRO.CATG="FIB_FF_SGC_REDU"; PRO.EXT="tpl_0027.fits";}
  product FIB_FF_BPC_REDU { PRO.CATG="FIB_FF_BPC_REDU"; PRO.EXT="tpl_0028.fits";}
}
action ACTION_WAVE_MOS_RED
{
  minRet = 1; maxRet = 1;
  select file as LINE_REFER_TABLE from calibFiles where
    PRO.CATG=="LINE_REFER_TABLE"
  ;
  minRet = 0; maxRet = 1;
  select file as LINE_INTMON_TABLE from calibFiles where
    PRO.CATG=="LINE_INTMON_TABLE"
  ;
  minRet = 1; maxRet = 1;
  select file as CORVEL_MASK from calibFiles where
    PRO.CATG=="CORVEL_MASK"
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_LIN_GUE_REDL from calibFiles where
    PRO.CATG=="FIB_LIN_GUE_REDL"
    and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORDEF_TABLE_REDL from calibFiles where
    PRO.CATG=="FIB_ORDEF_TABLE_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_LIN_GUE_REDU from calibFiles where
    PRO.CATG=="FIB_LIN_GUE_REDU"
    and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORDEF_TABLE_REDU from calibFiles where
    PRO.CATG=="FIB_ORDEF_TABLE_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe flames_cal_wavecal {
  "--tolerance=10.0";
  "--degree=4";
  }
  product FIB_LINE_TABLE_REDL { PRO.CATG="FIB_LINE_TABLE_REDL"; PRO.EXT="0000.fits";}
  product FIB_LINE_TABLE_REDU { PRO.CATG="FIB_LINE_TABLE_REDU"; PRO.EXT="0001.fits";}
}
action ACTION_NASMYTH_MOS_RED
{
  recipe none;
}
action ACTION_SCIENCE_MOS_RED
{
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_LINE_TABLE_REDL from calibFiles where
    PRO.CATG=="FIB_LINE_TABLE_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORDEF_TABLE_REDL from calibFiles where
    PRO.CATG=="FIB_ORDEF_TABLE_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_COM_REDL from calibFiles where
    PRO.CATG=="SLIT_FF_COM_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_NOR_REDL from calibFiles where
    PRO.CATG=="SLIT_FF_NOR_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_DTC_REDL from calibFiles where
    PRO.CATG=="SLIT_FF_DTC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_SGC_REDL from calibFiles where
    PRO.CATG=="SLIT_FF_SGC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_BPC_REDL from calibFiles where
    PRO.CATG=="SLIT_FF_BPC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_BNC_REDL from calibFiles where
    PRO.CATG=="SLIT_FF_BNC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_COM_REDL from calibFiles where
    PRO.CATG=="FIB_FF_COM_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_NOR_REDL from calibFiles where
    PRO.CATG=="FIB_FF_NOR_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_NSG_REDL from calibFiles where
    PRO.CATG=="FIB_FF_NSG_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_DTC_REDL from calibFiles where
    PRO.CATG=="FIB_FF_DTC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_SGC_REDL from calibFiles where
    PRO.CATG=="FIB_FF_SGC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_BPC_REDL from calibFiles where
    PRO.CATG=="FIB_FF_BPC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 3; maxRet = 3;
  select file as MASTER_SFLAT_REDL from calibFiles where
    PRO.CATG=="MASTER_SFLAT_REDL"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_LINE_TABLE_REDU from calibFiles where
    PRO.CATG=="FIB_LINE_TABLE_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORDEF_TABLE_REDU from calibFiles where
    PRO.CATG=="FIB_ORDEF_TABLE_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_COM_REDU from calibFiles where
    PRO.CATG=="SLIT_FF_COM_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_NOR_REDU from calibFiles where
    PRO.CATG=="SLIT_FF_NOR_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_DTC_REDU from calibFiles where
    PRO.CATG=="SLIT_FF_DTC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_SGC_REDU from calibFiles where
    PRO.CATG=="SLIT_FF_SGC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_BPC_REDU from calibFiles where
    PRO.CATG=="SLIT_FF_BPC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_BNC_REDU from calibFiles where
    PRO.CATG=="SLIT_FF_BNC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_COM_REDU from calibFiles where
    PRO.CATG=="FIB_FF_COM_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_NOR_REDU from calibFiles where
    PRO.CATG=="FIB_FF_NOR_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_NSG_REDU from calibFiles where
    PRO.CATG=="FIB_FF_NSG_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_DTC_REDU from calibFiles where
    PRO.CATG=="FIB_FF_DTC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_SGC_REDU from calibFiles where
    PRO.CATG=="FIB_FF_SGC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_BPC_REDU from calibFiles where
    PRO.CATG=="FIB_FF_BPC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 3; maxRet = 3;
  select file as MASTER_SFLAT_REDU from calibFiles where
    PRO.CATG=="MASTER_SFLAT_REDU"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe flames_obs_scired {
  "--pixel_thresh_max=40000";
  "--cubify_sw=Y";
  }
}
action ACTION_SCIENCE_MOS_SIM_RED
{
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDL"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_LINE_TABLE_REDL from calibFiles where
    PRO.CATG=="FIB_LINE_TABLE_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_COM_REDL from calibFiles where
    PRO.CATG=="SLIT_FF_COM_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_NOR_REDL from calibFiles where
    PRO.CATG=="SLIT_FF_NOR_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORDEF_TABLE_REDL from calibFiles where
    PRO.CATG=="FIB_ORDEF_TABLE_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_DTC_REDL from calibFiles where
    PRO.CATG=="SLIT_FF_DTC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_SGC_REDL from calibFiles where
    PRO.CATG=="SLIT_FF_SGC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_BPC_REDL from calibFiles where
    PRO.CATG=="SLIT_FF_BPC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_BNC_REDL from calibFiles where
    PRO.CATG=="SLIT_FF_BNC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_COM_REDL from calibFiles where
    PRO.CATG=="FIB_FF_COM_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_NOR_REDL from calibFiles where
    PRO.CATG=="FIB_FF_NOR_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_NSG_REDL from calibFiles where
    PRO.CATG=="FIB_FF_NSG_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_DTC_REDL from calibFiles where
    PRO.CATG=="FIB_FF_DTC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_SGC_REDL from calibFiles where
    PRO.CATG=="FIB_FF_SGC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_BPC_REDL from calibFiles where
    PRO.CATG=="FIB_FF_BPC_REDL"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 3; maxRet = 3;
  select file as MASTER_SFLAT_REDL from calibFiles where
    PRO.CATG=="MASTER_SFLAT_REDL"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU from calibFiles where
    PRO.CATG=="MASTER_BIAS_REDU"
    and inputFile.DET.CHIPS==DET.CHIPS and inputFile.DET.WIN1.BINX==DET.WIN1.BINX and inputFile.DET.WIN1.BINY==DET.WIN1.BINY and inputFile.DET.READ.SPEED==DET.READ.SPEED
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_LINE_TABLE_REDU from calibFiles where
    PRO.CATG=="FIB_LINE_TABLE_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_COM_REDU from calibFiles where
    PRO.CATG=="SLIT_FF_COM_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_NOR_REDU from calibFiles where
    PRO.CATG=="SLIT_FF_NOR_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORDEF_TABLE_REDU from calibFiles where
    PRO.CATG=="FIB_ORDEF_TABLE_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_DTC_REDU from calibFiles where
    PRO.CATG=="SLIT_FF_DTC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_SGC_REDU from calibFiles where
    PRO.CATG=="SLIT_FF_SGC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_BPC_REDU from calibFiles where
    PRO.CATG=="SLIT_FF_BPC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as SLIT_FF_BNC_REDU from calibFiles where
    PRO.CATG=="SLIT_FF_BNC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_COM_REDU from calibFiles where
    PRO.CATG=="FIB_FF_COM_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_NOR_REDU from calibFiles where
    PRO.CATG=="FIB_FF_NOR_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_NSG_REDU from calibFiles where
    PRO.CATG=="FIB_FF_NSG_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_DTC_REDU from calibFiles where
    PRO.CATG=="FIB_FF_DTC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_SGC_REDU from calibFiles where
    PRO.CATG=="FIB_FF_SGC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_FF_BPC_REDU from calibFiles where
    PRO.CATG=="FIB_FF_BPC_REDU"
    and inputFile.INS.SLIT3.MODE==INS.SLIT3.MODE and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 3; maxRet = 3;
  select file as MASTER_SFLAT_REDU from calibFiles where
    PRO.CATG=="MASTER_SFLAT_REDU"
    and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as CORVEL_MASK from calibFiles where
    PRO.CATG=="CORVEL_MASK"
  ;
  recipe flames_obs_scired {
  "--pixel_thresh_max=40000";
  "--cubify_sw=Y";
  }
}
