!--------------------------------------------------------------------
!
! Name: pcalcos.resource
!
! Description: A special pre-archive version of the CALCOS singleton 
!              resource file that calls a special version of the CALCOS wrapper
!              script. This version seeds the RANDSEED keyword in the input
!              RAW FITS files with value = 1, which allows reproducing of
!              matching calibrated output products.
!
!              Was originally put in as an override for Linux/Solaris
!              parallel test comparisons, but it was decided that it would
!              benefit pre-archive pipeline processing as well, when we
!              need to try and duplicate results found there, and has no
!              detrimental effect on archive catalog content.
!
!              OTFR still uses the "calcoa.resource" and original CALCOS
!              wrapper script that leave RANDSEED = -1, generating more
!              random (and not reproducible) calibration results.
!
! 05/23/11 68171   MSwam      calls special randseed wrapper script
! 02/21/13 73570   MSwam      special exit=16 allows CCI then quit
! 02/27/13 xxxxx   MSwam      Add USE_REPEATABLE_RANDSEED setting
!--------------------------------------------------------------------
PROCESS_NAME = pcalcos           ! Short name for process id
TASK = <xpoll -p $PATH_FILE -r pcalcos>
COMMAND = calcos_randseed.csh            ! Name of the command procedure
DESCRIPTION = 'COS Calibration'
SYSTEM = OPUS
CLASS = COS

OSF_RANK = 1                    ! First Trigger
OSF_TRIGGER1.CA = w             ! pick up singletons
OSF_TRIGGER1.DATA_ID = cos      ! 

OSF_TRIGGER2.CA = w             ! pick up associations
OSF_TRIGGER2.DATA_ID = coa      ! 

OSF_PROCESSING.CA  = p          ! Set flag while 'Processing'

XPOLL_STATE.00 = OSF_NORMAL     ! Normal: Completed calibration successfully
OSF_NORMAL.CA      = c          ! 
OSF_NORMAL.OM      = w          ! Wait for next stage

XPOLL_STATE.05 = OSF_NOCAL      ! Normal: no calibration required (eg ACQs)
OSF_NOCAL.CA       = n          ! 
OSF_NOCAL.OM       = w          ! Wait for next stage

XPOLL_STATE.16 = OSF_CCI_QUIT   ! Do the CCI processing then QUIT
OSF_CCI_QUIT.CA    = b          ! use a special failure code for this case
OSF_CCI_QUIT.OM    = s          ! it failed, but trigger CCI anyway (then stop)


XPOLL_STATE.01 = OSF_ERROR      ! Error during calibration
OSF_ERROR.CA       = e          ! 

XPOLL_ERROR.CA = x              ! Set osf to this if exit state is undefined.

POLLING_TIME       = 10         ! Wait (seconds) before polling for next 
MINBLOCKS            = 1000000  ! blocks required on output disk

ENV.INPATH         = COS_SIS_DIR  ! Where the .trx file is found
ENV.OUTPATH        = COS_CAL_DIR  ! Directory where output files are written
ENV.USE_CSUM       = use_cos_csum ! set FALSE in path to suppress csum files
ENV.CSUM_DIR       = COS_SUM_DIR  ! Directory in which to move the csum files 
ENV.USE_REPEATABLE_RANDSEED = USE_REPEATABLE_RANDSEED
                              ! path setting will determine whether to
                              ! perform optimum calibration, using
                              ! non-repeatable random number seed
