include "vpthit.h" include # vpthit -- Remove particle events for high speed photometer files # # Description: # ------------ # # Input CL parameters: # ----------------- # # Date Author Description # ---- ------ ----------- # 29-Oct-1990 J.-C. Hsu rewrite in SPP #------------------------------------------------------------------------------ procedure vpthit () pointer fin, fout # file template pointer char outfile[SZ_FNAME], outtbl[SZ_FNAME], scheme[SZ_SCHEME] char outdir[SZ_PATHNAME] char root[SZ_ROOT], oldroot[SZ_ROOT] int idroot real dthresh, athresh, sigmas, hitval bool lowflag real mean, rate[NFILES], err, drate[NFILES] pointer tp int type int remove, exclude[NFILES] int nfin, nrows, i, j int outflag real samptm, smpltm[2] double epoch bool initial pointer imtopen() int imtlen() int strcmp() int isdirectory() #============================================================================== begin # read CL parameters call vpt_in (fin, outfile, outtbl, scheme, sigmas, dthresh, athresh, hitval, lowflag) nfin = imtlen (fin) if (nfin < 1) call error (1, "no input file exists") # find out if the outfile is a directory name or a file template or # unspecified if (outfile[1] == EOS) outflag = NULL else if (isdirectory(outfile, outdir, SZ_PATHNAME) > 0) outflag = DIR else { fout = imtopen (outfile) if (imtlen(fout) == nfin) outflag = TEMPL else call error (1, "number of files in input and output do not match") } initial = true # reset output quantities do j = 1, NFILES { rate[j] = 0. drate[j] = 0. exclude[j] = 0 if (j < 3) smpltm[j] = 0. } # remove particle events for each file do i = 1, nfin { call vpt_do (fin, outflag, fout, outdir, scheme, sigmas, dthresh, athresh, lowflag, hitval, root, mean, err, remove, samptm, type, idroot, epoch) if (i == 1) call strcpy (root, oldroot, SZ_ROOT) # if encounter a new root name, write results of previous files # to the output table if (strcmp (root, oldroot) != 0) { call vpt_out (outtbl, oldroot, scheme, rate, drate, exclude, sigmas, dthresh, athresh, smpltm, epoch, tp, nrows, initial) # reset output quantities do j = 1, NFILES { rate[j] = 0. drate[j] = 0. exclude[j] = 0 if (j < 3) smpltm[j] = 0. } call strcpy (root, oldroot, SZ_ROOT) nrows = nrows + 1 initial = false } # assign count rate etc. according to data type and source type rate[idroot+1] = mean drate[idroot+1] = err exclude[idroot+1] = remove if (idroot < 2) smpltm[idroot+1] = samptm # if last file, also write results to the output table if (i == nfin) call vpt_out (outtbl, root, scheme, rate, drate, exclude, sigmas, dthresh, athresh, smpltm, epoch, tp, nrows, initial) } # close file templates call imtclose (fin) if (outflag == TEMPL) call imtclose (fout) # close the output table call tbtclo (tp) end