//Classification
if DPR.CATG=="CALIB" and DPR.TYPE=="BIAS" and DPR.TECH=="IMAGE" and DET.CHIPS==2 and TPL.ID!="UVES_red_tec_ccdflat" then 
{
  RAW.TYPE = "BIAS_RED";
  REFLEX.CATG = "BIAS_RED";
  DO.CATG = "BIAS_RED";
  PACK.DIR = "DET";
  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";
  REFLEX.CATG = "FIB_ARC_LAMP_FORM_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";
  REFLEX.CATG = "FIB_ORDEF_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";
  REFLEX.CATG = "SFLAT_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";
  REFLEX.CATG = "NASMYTH_MOS_RED";
  DO.CATG = "NASMYTH_FLAT_RED";
  PACK.DIR = "MOS_FLAT";
  CATG = "CALIB";
}

if DPR.CATG=="CALIB" and ( DPR.TYPE=="LAMP,FLAT,EVEN,OzPoz" or DPR.TYPE=="LAMP,FLAT,EVEN,SimCal" ) and DPR.TECH=="MOS" and DET.CHIPS==2 and TPL.NEXP==3 then 
{
  RAW.TYPE = "FFLAT_MOS_RED";
  REFLEX.CATG = "FIB_FF_EVEN_RED";
  DO.CATG = "FIB_FF_EVEN_RED";
  PACK.DIR = "MOS_FLAT";
  CATG = "CALIB";
}

if DPR.CATG=="CALIB" and ( DPR.TYPE=="LAMP,FLAT,ODD,OzPoz" or DPR.TYPE=="LAMP,FLAT,ODD,SimCal" ) and DPR.TECH=="MOS" and DET.CHIPS==2 and TPL.NEXP==3 then 
{
  RAW.TYPE = "FFLAT_MOS_RED";
  REFLEX.CATG = "FIB_FF_ODD_RED";
  DO.CATG = "FIB_FF_ODD_RED";
  PACK.DIR = "MOS_FLAT";
  CATG = "CALIB";
}

if DPR.CATG=="CALIB" and ( DPR.TYPE=="LAMP,FLAT,ALL,OzPoz" or DPR.TYPE=="LAMP,FLAT,ALL,SimCal" ) and DPR.TECH=="MOS" and DET.CHIPS==2 and TPL.NEXP==3 then 
{
  RAW.TYPE = "FFLAT_MOS_RED";
  REFLEX.CATG = "FIB_FF_ALL_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";
  REFLEX.CATG = "FIB_ARC_LAMP_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";
  REFLEX.CATG = "FIB_SCI_SIM_RED";
  DO.CATG = "FIB_SCI_SIM_RED";
  PACK.DIR = "NONE";
  CATG = "SCIENCE";
  REFLEX.TARGET = "T";
}

if DPR.CATG=="SCIENCE" and DPR.TYPE=="OBJECT,OzPoz" and DPR.TECH=="MOS" and DET.CHIPS==2 then 
{
  RAW.TYPE = "SCIENCE_MOS_RED";
  REFLEX.CATG = "FIB_SCI_RED";
  DO.CATG = "FIB_SCI_RED";
  PACK.DIR = "NONE";
  CATG = "SCIENCE";
  REFLEX.TARGET = "T";
}

if DPR.CATG=="CALIB" and DPR.TYPE=="DARK" and DPR.TECH=="IMAGE" and DET.CHIPS==2 then 
{
  RAW.TYPE = "DARK_RED";
  REFLEX.CATG = "DARK_RED";
  DO.CATG = "DARK_RED";
  PACK.DIR = "NONE";
  CATG = "CALIB";
}



if PRO.CATG=="LINE_REFER_TABLE" and INSTRUME=="UVES" then
{
  REFLEX.CATG = "LINE_REFER_TABLE";
}

if PRO.CATG=="MASTER_FORM_REDL" and INSTRUME=="UVES" then
{
  REFLEX.CATG = "MASTER_FORM_REDL";
}

if PRO.CATG=="MASTER_FORM_REDU" and INSTRUME=="UVES" then
{
  REFLEX.CATG = "MASTER_FORM_REDU";
}

if PRO.CATG=="CORVEL_MASK" and INSTRUME=="UVES" then
{
  REFLEX.CATG = "CORVEL_MASK";
}

if PRO.CATG=="LINE_INTMON_TABLE" and INSTRUME=="UVES" then
{
  REFLEX.CATG = "LINE_INTMON_TABLE";
}


//Selection of actions and grouping

select execute(ACTION_BIAS_RED) from inputFiles where RAW.TYPE=="BIAS_RED"
  group by 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.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.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,TPL.START as (TPL_A,tpl);


select execute(ACTION_FMTCHK_MOS_RED) from inputFiles where RAW.TYPE=="FMTCHK_MOS_RED"
  group by 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 DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.SLIT3.PLATE,INS.GRAT2.WLEN,ARCFILE;

minRet = 9;
select execute(ACTION_SFLAT_MOS_RED) from inputFiles where RAW.TYPE=="SFLAT_MOS_RED"
  group by 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.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.SLIT3.MODE,INS.GRAT2.WLEN,TPL.START as (TPL_A,tpl);

select execute(ACTION_FFLAT_MOS_RED) from inputFiles where RAW.TYPE=="FFLAT_MOS_RED"
  group by DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.SLIT3.MODE,INS.SLIT3.PLATE,INS.GRAT2.WLEN,TPL.START as (TPL_A,tpl);

//minRet = 3;
select execute(ACTION_WAVE_MOS_RED) from inputFiles where RAW.TYPE=="WAVE_MOS_RED"
  group by DET.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.SLIT3.MODE,INS.SLIT3.PLATE,INS.GRAT2.WLEN,ARCFILE;


select execute(ACTION_SCIENCE_MOS_RED) from inputFiles where RAW.TYPE=="SCIENCE_MOS_RED"
  group by 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.WIN1.BINX,DET.WIN1.BINY,DET.READ.SPEED,INS.SLIT3.MODE,INS.SLIT3.PLATE,INS.GRAT2.WLEN,ARCFILE;

//Definitions of actions 

action ACTION_BIAS_RED
{
  recipe uves_cal_mbias;
  product MASTER_BIAS_REDL_WKF { PRO.CATG="MASTER_BIAS_REDL_WKF"; PRO.EXT="tpl_0000.fits";}
  product MASTER_BIAS_REDU_WKF { PRO.CATG="MASTER_BIAS_REDU_WKF"; PRO.EXT="tpl_0001.fits";}
}

action ACTION_DARK_RED
{
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL_WKF from calibFiles where PRO.CATG=="MASTER_BIAS_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="MASTER_BIAS_REDU_WKF" 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_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.MODE==INS.MODE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE
  ;
  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.MODE==INS.MODE and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN and inputFile.INS.SLIT3.PLATE==INS.SLIT3.PLATE
  ;
  recipe flames_cal_predict {
  }
  product FIB_LIN_GUE_REDL_WKF { PRO.CATG="FIB_LIN_GUE_REDL_WKF"; PRO.EXT="0000.fits";}
  product FIB_LIN_GUE_REDU_WKF { PRO.CATG="FIB_LIN_GUE_REDU_WKF"; PRO.EXT="0001.fits";}
  product FIB_ORD_GUE_REDL_WKF { PRO.CATG="FIB_ORD_GUE_REDL_WKF"; PRO.EXT="0002.fits";}
  product FIB_ORD_GUE_REDU_WKF { PRO.CATG="FIB_ORD_GUE_REDU_WKF"; PRO.EXT="0003.fits";}
}

action ACTION_ORDERDEF_MOS_RED
{
  minRet = 1; maxRet = 1;
  select file as FIB_ORD_GUE_REDL_WKF from calibFiles where PRO.CATG=="FIB_ORD_GUE_REDL_WKF" and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as FIB_ORD_GUE_REDU_WKF from calibFiles where PRO.CATG=="FIB_ORD_GUE_REDU_WKF" and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe flames_cal_orderpos {
  }
  product FIB_ORDEF_REDL_WKF { PRO.CATG="FIB_ORDEF_REDL_WKF"; PRO.EXT="0000.fits";}
  product FIB_ORD_TAB_REDL_WKF { PRO.CATG="FIB_ORD_TAB_REDL_WKF"; PRO.EXT="0001.fits";}
  product FIB_ORDEF_REDU_WKF { PRO.CATG="FIB_ORDEF_REDU_WKF"; PRO.EXT="0002.fits";}
  product FIB_ORD_TAB_REDU_WKF { PRO.CATG="FIB_ORD_TAB_REDU_WKF"; PRO.EXT="0003.fits";}
}

action ACTION_SFLAT_MOS_RED
{
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL_WKF from calibFiles where PRO.CATG=="MASTER_BIAS_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_ORD_TAB_REDL_WKF" and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU_WKF from calibFiles where PRO.CATG=="MASTER_BIAS_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_ORD_TAB_REDU_WKF" and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe flames_cal_mkmaster {
  }
  product MASTER_SFLAT_REDL_WKF { PRO.CATG="MASTER_SFLAT_REDL_WKF"; PRO.EXT="tpl_0000.fits";}
  product MASTER_SFLAT_REDU_WKF { PRO.CATG="MASTER_SFLAT_REDU_WKF"; PRO.EXT="tpl_0001.fits";}
  product MASTER_SFLAT_REDL_WKF { PRO.CATG="MASTER_SFLAT_REDL_WKF"; PRO.EXT="tpl_0002.fits";}
  product MASTER_SFLAT_REDU_WKF { PRO.CATG="MASTER_SFLAT_REDU_WKF"; PRO.EXT="tpl_0003.fits";}
  product MASTER_SFLAT_REDL_WKF { PRO.CATG="MASTER_SFLAT_REDL_WKF"; PRO.EXT="tpl_0004.fits";}
  product MASTER_SFLAT_REDU_WKF { PRO.CATG="MASTER_SFLAT_REDU_WKF"; PRO.EXT="tpl_0005.fits";}
}

action ACTION_FFLAT_MOS_RED
{
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL_WKF from calibFiles where PRO.CATG=="MASTER_BIAS_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_ORDEF_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_ORD_TAB_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="MASTER_SFLAT_REDL_WKF" and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU_WKF from calibFiles where PRO.CATG=="MASTER_BIAS_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_ORDEF_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_ORD_TAB_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="MASTER_SFLAT_REDU_WKF" and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe flames_cal_prep_sff_ofpos;
  product SLIT_FF_COM_REDL_WKF { PRO.CATG="SLIT_FF_COM_REDL_WKF"; PRO.EXT="tpl_0003.fits";}
  product SLIT_FF_NOR_REDL_WKF { PRO.CATG="SLIT_FF_NOR_REDL_WKF"; PRO.EXT="tpl_0004.fits";}
  product SLIT_FF_DTC_REDL_WKF { PRO.CATG="SLIT_FF_DTC_REDL_WKF"; PRO.EXT="tpl_0005.fits";}
  product SLIT_FF_SGC_REDL_WKF { PRO.CATG="SLIT_FF_SGC_REDL_WKF"; PRO.EXT="tpl_0006.fits";}
  product SLIT_FF_BPC_REDL_WKF { PRO.CATG="SLIT_FF_BPC_REDL_WKF"; PRO.EXT="tpl_0007.fits";}
  product SLIT_FF_BNC_REDL_WKF { PRO.CATG="SLIT_FF_BNC_REDL_WKF"; PRO.EXT="tpl_0008.fits";}
  product FIB_ORDEF_TABLE_REDL_WKF { PRO.CATG="FIB_ORDEF_TABLE_REDL_WKF"; PRO.EXT="tpl_0009.fits";}
  product FIB_FF_COM_REDL_WKF { PRO.CATG="FIB_FF_COM_REDL_WKF"; PRO.EXT="tpl_0010.fits";}
  product FIB_FF_NOR_REDL_WKF { PRO.CATG="FIB_FF_NOR_REDL_WKF"; PRO.EXT="tpl_0011.fits";}
  product FIB_FF_NSG_REDL_WKF { PRO.CATG="FIB_FF_NSG_REDL_WKF"; PRO.EXT="tpl_0012.fits";}
  product FIB_FF_DTC_REDL_WKF { PRO.CATG="FIB_FF_DTC_REDL_WKF"; PRO.EXT="tpl_0013.fits";}
  product FIB_FF_SGC_REDL_WKF { PRO.CATG="FIB_FF_SGC_REDL_WKF"; PRO.EXT="tpl_0014.fits";}
  product FIB_FF_BPC_REDL_WKF { PRO.CATG="FIB_FF_BPC_REDL_WKF"; PRO.EXT="tpl_0015.fits";}
  product SLIT_FF_COM_REDU_WKF { PRO.CATG="SLIT_FF_COM_REDU_WKF"; PRO.EXT="tpl_0016.fits";}
  product SLIT_FF_NOR_REDU_WKF { PRO.CATG="SLIT_FF_NOR_REDU_WKF"; PRO.EXT="tpl_0017.fits";}
  product SLIT_FF_DTC_REDU_WKF { PRO.CATG="SLIT_FF_DTC_REDU_WKF"; PRO.EXT="tpl_0018.fits";}
  product SLIT_FF_SGC_REDU_WKF { PRO.CATG="SLIT_FF_SGC_REDU_WKF"; PRO.EXT="tpl_0019.fits";}
  product SLIT_FF_BPC_REDU_WKF { PRO.CATG="SLIT_FF_BPC_REDU_WKF"; PRO.EXT="tpl_0020.fits";}
  product SLIT_FF_BNC_REDU_WKF { PRO.CATG="SLIT_FF_BNC_REDU_WKF"; PRO.EXT="tpl_0021.fits";}
  product FIB_ORDEF_TABLE_REDU_WKF { PRO.CATG="FIB_ORDEF_TABLE_REDU_WKF"; PRO.EXT="tpl_0022.fits";}
  product FIB_FF_COM_REDU_WKF { PRO.CATG="FIB_FF_COM_REDU_WKF"; PRO.EXT="tpl_0023.fits";}
  product FIB_FF_NOR_REDU_WKF { PRO.CATG="FIB_FF_NOR_REDU_WKF"; PRO.EXT="tpl_0024.fits";}
  product FIB_FF_NSG_REDU_WKF { PRO.CATG="FIB_FF_NSG_REDU_WKF"; PRO.EXT="tpl_0025.fits";}
  product FIB_FF_DTC_REDU_WKF { PRO.CATG="FIB_FF_DTC_REDU_WKF"; PRO.EXT="tpl_0026.fits";}
  product FIB_FF_SGC_REDU_WKF { PRO.CATG="FIB_FF_SGC_REDU_WKF"; PRO.EXT="tpl_0027.fits";}
  product FIB_FF_BPC_REDU_WKF { PRO.CATG="FIB_FF_BPC_REDU_WKF"; 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_WKF from calibFiles where PRO.CATG=="FIB_LIN_GUE_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_ORDEF_TABLE_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_LIN_GUE_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_ORDEF_TABLE_REDU_WKF" 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=1.1";
  }
  product FIB_LINE_TABLE_REDL_WKF { PRO.CATG="FIB_LINE_TABLE_REDL_WKF"; PRO.EXT="0000.fits";}
  product FIB_LINE_TABLE_REDU_WKF { PRO.CATG="FIB_LINE_TABLE_REDU_WKF"; 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_WKF from calibFiles where PRO.CATG=="MASTER_BIAS_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_LINE_TABLE_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_ORDEF_TABLE_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_COM_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_NOR_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_DTC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_SGC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_BPC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_BNC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_COM_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_NOR_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_NSG_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_DTC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_SGC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_BPC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="MASTER_SFLAT_REDL_WKF" and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU_WKF from calibFiles where PRO.CATG=="MASTER_BIAS_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_LINE_TABLE_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_ORDEF_TABLE_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_COM_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_NOR_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_DTC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_SGC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_BPC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_BNC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_COM_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_NOR_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_NSG_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_DTC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_SGC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_BPC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="MASTER_SFLAT_REDU_WKF" and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  recipe flames_obs_scired {
  "--cubify_sw=Y";
  }
}

action ACTION_SCIENCE_MOS_SIM_RED
{
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDL_WKF from calibFiles where PRO.CATG=="MASTER_BIAS_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_LINE_TABLE_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_COM_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_NOR_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_ORDEF_TABLE_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_DTC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_SGC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_BPC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_BNC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_COM_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_NOR_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_NSG_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_DTC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_SGC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_BPC_REDL_WKF" 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_WKF from calibFiles where PRO.CATG=="MASTER_SFLAT_REDL_WKF" and inputFile.INS.GRAT2.WLEN==INS.GRAT2.WLEN
  ;
  minRet = 1; maxRet = 1;
  select file as MASTER_BIAS_REDU_WKF from calibFiles where PRO.CATG=="MASTER_BIAS_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_LINE_TABLE_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_COM_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_NOR_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_ORDEF_TABLE_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_DTC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_SGC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_BPC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="SLIT_FF_BNC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_COM_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_NOR_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_NSG_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_DTC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_SGC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="FIB_FF_BPC_REDU_WKF" 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_WKF from calibFiles where PRO.CATG=="MASTER_SFLAT_REDU_WKF" 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 {
  "--cubify_sw=Y";
  }
}
