SUBROUTINE VDTPT ( * * inputs * : OFILE, NPTS, WTFLAG, COEFF, DCOEFF, CHISQ, : TMPMIN, TMPMAX, TMPAVE, EPMIN, EPMAX, EPAVE, : ITER, TOLERN, FRAC, HIVOLT, DISCR, DETID, * * outputs * : STATUS) * * Module Number: 15.5.2.4 * * Module Name: deadtimev * * Keyphrase: * ---------- * Write the result of dead time calibration to the output table * * Description: * ------------ * * FORTRAN name: VDTPT.FOR * * Keywords of accessed files and tables: * -------------------------------------- * Name I/O Description / Comments * * output table column names: * * 'DETECTOR' O detector ID * 'RATIO' O scaling factor between digital and * analog count rate * 'DEADTIME' O fitted dead time * 'CHISQ' O chi squared of the fit * 'TEMPMIN' O lower limit of temperature * 'TEMPMAX' O upper limit of temperature * 'TEMPAVE' O average temperature * 'VOLTAGE' O high voltage setting * 'THRESH' O discriminator threshold setting * 'EPOCHMIN' O lower limit of epoch * 'EPOCHMAX' O upper limit of epoch * 'EPOCHAVE' O average epoch * 'DIGITAL_WT' O digital count rate weighting scheme * 'ANALOG_WT' O analog count rate weighting scheme * 'NPOINTS' O number of data points * 'ITERMAX' O maximum number of least square iterations * 'TOLERN' O tolerance of sigma-squared difference * during least square iterations * 'FRAC' O specified fraction applied to the * coefficients modification * * Subroutines Called: * ------------------- * CDBS: * CDTOUT * SDAS: * UTRPTR, UTRPTI, UTRPTD, UTRPTT, UTTCLO, UMSPUT * Others: * None * * History: * -------- * Version Date Author Description * 1 10-15-85 J.-C. HSU design and coding * 2 08-20-87 J.-C. HSU F77 standard * 3 10-20-89 J.-C. HSU error propagation *------------------------------------------------------------------------------- * *== input: * --output table name CHARACTER*(*) OFILE * --weighting scheme REAL WTFLAG(*), * --minimum, maximum, and average temperature : TMPMIN, TMPMAX, TMPAVE, * --tolerance of sigma-squared differnce * --during least square iterations : TOLERN, * --specified fraction applied to * --coefficients modification : FRAC, * --high volatge, discriminator threshold * --setting : HIVOLT, DISCR * --minimum, maximum and mean epoch DOUBLE PRECISION EPMIN, EPMAX, EPAVE, * --result of the least square fitting : COEFF(*), * --error of the fitting coefficients : DCOEFF(*), * --chi-squared of the fit : CHISQ * --number of input data points INTEGER NPTS, * --number of iteration in least square : ITER, * --detector ID : DETID * *== output: * --error status INTEGER STATUS * *== local: * --loop index INTEGER I, * --number of existed rows of the output * --table : NROWS, * --number of columns : NCOLS, * --pointer to table descripter : TP, * --column identifiers : COLIDN(40), * --data type : DTYPE(40), * --data buffer : CBUFFI(10), * --error status : STAT(20) * --data buffer REAL CBUFFR(40) DOUBLE PRECISION CBUFFD(20) * --column display format CHARACTER*8 COLFMT(40) * --output table column names CHARACTER*16 CNAME(40), * --column units : UNIT(40) * --error message context CHARACTER*130 CONTXT, MESS *==========================begin iraf77.inc (without INTEGER*2)================= * Include file for the iraf77 FORTRAN interface to the IRAF VOS * Get IRAF common into main program * LOGICAL MEMB(1) INTEGER MEMI(1) INTEGER MEML(1) REAL MEMR(1) DOUBLE PRECISION MEMD(1) COMPLEX MEMX(1) EQUIVALENCE (MEMB, MEMI, MEML, MEMR, MEMD, MEMX) COMMON /MEM/ MEMD * * File I/O access modes * INTEGER RDONLY PARAMETER (RDONLY = 1) INTEGER RDWRIT PARAMETER (RDWRIT = 2) INTEGER WRONLY PARAMETER (WRONLY = 3) INTEGER APPEND PARAMETER (APPEND = 4) INTEGER NEWFIL PARAMETER (NEWFIL = 5) INTEGER TMPFIL PARAMETER (TMPFIL = 6) INTEGER NEWCPY PARAMETER (NEWCPY = 7) INTEGER NEWIMG PARAMETER (NEWIMG = 5) * * codes for data types * INTEGER TYBOOL PARAMETER (TYBOOL = 1) INTEGER TYCHAR PARAMETER (TYCHAR = 2) INTEGER TYSHOR PARAMETER (TYSHOR = 3) INTEGER TYINT PARAMETER (TYINT = 4) INTEGER TYLONG PARAMETER (TYLONG = 5) INTEGER TYREAL PARAMETER (TYREAL = 6) INTEGER TYDOUB PARAMETER (TYDOUB = 7) INTEGER TYCPLX PARAMETER (TYCPLX = 8) INTEGER TYUSHT PARAMETER (TYUSHT = 11) INTEGER TYUBYT PARAMETER (TYUBYT = 12) * * TYTEXT is a special code for the iraf77 interface; it is not in the VOS * INTEGER TYTEXT PARAMETER (TYTEXT = 13) *========================end iraf77.inc========================================= *=========================begin hsp.inc========================================= * --status return code INTEGER OK, ERRNUM(20) * --message destination and priority INTEGER DEST, PRIO DATA OK /0/ DATA ERRNUM /701, 702, 703, 704, 705, 706, 707, 708, 709, 710, : 711, 712, 713, 714, 715, 716, 717, 718, 719, 720/ DATA DEST, PRIO /1, 0/ *=========================end hsp.inc=========================================== *------------------------------------------------------------------------------ * * specify output column names * CNAME(1) = 'DETECTOR' CNAME(2) = 'NPOINTS' CNAME(3) = 'ITERMAX' * CNAME(4) = 'DEADTIME' CNAME(5) = 'RATIO' CNAME(6) = 'DEADTIME_ERR' CNAME(7) = 'RATIO_ERR' CNAME(8) = 'CHISQ' CNAME(9) = 'TEMPMIN' CNAME(10) = 'TEMPMAX' CNAME(11) = 'TEMPAVE' CNAME(12) = 'VOLTAGE' CNAME(13) = 'THRESH' CNAME(14) = 'DIGITAL_WT' CNAME(15) = 'ANALOG_WT' CNAME(16) = 'TOLERN' CNAME(17) = 'FRAC' * CNAME(18) = 'EPOCHMIN' CNAME(19) = 'EPOCHMAX' CNAME(20) = 'EPOCHAVE' * NCOLS = 20 * * define column data types * DO 10 I = 1, 3 DTYPE(I) = TYINT 10 CONTINUE * DO 20 I = 4, 17 DTYPE(I) = TYREAL 20 CONTINUE * DO 30 I = 18, 20 DTYPE(I) = TYDOUB 30 CONTINUE * * define column units and display formats * DO 40 I = 1, NCOLS UNIT(I) = ' ' COLFMT(I) = ' ' 40 CONTINUE * * assign buffer contents * CBUFFI(1) = DETID CBUFFI(2) = NPTS CBUFFI(3) = ITER * CBUFFR(1) = REAL(COEFF(1)) CBUFFR(2) = REAL(COEFF(2)) CBUFFR(3) = REAL(DCOEFF(1)) CBUFFR(4) = REAL(DCOEFF(2)) CBUFFR(5) = REAL(CHISQ) CBUFFR(6) = TMPMIN CBUFFR(7) = TMPMAX CBUFFR(8) = TMPAVE CBUFFR(9) = HIVOLT CBUFFR(10) = DISCR CBUFFR(11) = WTFLAG(2) CBUFFR(12) = WTFLAG(1) CBUFFR(13) = TOLERN CBUFFR(14) = FRAC * CBUFFD(1) = EPMIN CBUFFD(2) = EPMAX CBUFFD(3) = EPAVE * * set up the output table * CALL CDTOUT (OFILE, CNAME, UNIT, COLFMT, DTYPE, NCOLS, TP, : COLIDN, NROWS, STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'error setting up output table' GO TO 999 END IF * * write results to the output table * CALL UTRPTI (TP, COLIDN(1), 3, NROWS+1, CBUFFI, STAT(1)) CALL UTRPTR (TP, COLIDN(4), 14, NROWS+1, CBUFFR, STAT(2)) CALL UTRPTD (TP, COLIDN(18), 3, NROWS+1, CBUFFD, STAT(3)) * DO 50 I = 1, 3 IF (STAT(I) .NE. OK) THEN STATUS = ERRNUM(1) CONTXT = 'cannot write a row to output table' GO TO 999 END IF 50 CONTINUE * * close the output table * CALL UTTCLO (TP, STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'cannot close output table' GO TO 999 END IF * STATUS = OK GO TO 1000 * * write error message * 999 MESS = 'VDTPT: ' // CONTXT CALL UMSPUT (MESS, DEST, PRIO, STAT(1)) * 1000 RETURN END