subroutine srtrp2 (modblk, cts, ctss, ictn, is, ie, jflag, irpa, * ndif) c c----------------------------------------------------------------------- c c This subroutine sorts data for a given head and given mass in c terms of instrument rpa setting. c c NOTE *** this version for cespec program *** c c----------------------------------------------------------------------- c c input arguments are: c c modblk contains the data collection limits and parameters c is start sample index of data to be included c ie stop sample index. is, ie are in range [1,512] c irpa contains the ndif sorted unique rpa settings for this c mode c ndif number of irpa values c c output arguments are: c c ictn accumulated samples c cts accumulated counts c ctss accumulated counts**2 c jflag set to 0 if no data added to arrays, otherwise 1 c c the arrays cts(ndif), ctss(ndif) and ictn(ndif) are updated appropriately c c----------------------------------------------------------------------- c c note *** before this routine is called, the information in the c following common blocks must be defined c c common updated by calling c ------ ------------------ c rpamsh getmd1. contains instrument rpa, ims settings c i7flgs deffgs. contains instrument mode flags. c c----------------------------------------------------------------------- c integer*2 icde(512,2), idat(2812), jcr(512,2) c integer*4 i, iang, ic, ich, ictn(32), idcodc, idet, ie, igtzms, * irpa(ndif), is, isangl, jflag, jmsh(512), jrpa(512), * modblk(8), ndif c real cts(32), ctss(32) c common /maf1/idat, * /rpamsh/jrpa,jmsh c equivalence (icde(1,1), idat(1789)), (jcr(1,1), idat(253)) c c----------------------------------------------------------------------- c *** set the have data flag *** c----------------------------------------------------------------------- c jflag = 0 c c----------------------------------------------------------------------- c *** first call refang, to define phase angle reference *** c----------------------------------------------------------------------- c call refang (degsam, ramang) c c----------------------------------------------------------------------- c *** collect the data *** c----------------------------------------------------------------------- c if(modblk(1) .eq. 1) then c c----------------------------------------------------------------------- c *** radial head processing *** c----------------------------------------------------------------------- c c----------------------------------------------------------------------- c *** loop through the samples to process *** c----------------------------------------------------------------------- c do 100 i = is, ie c c----------------------------------------------------------------------- c *** scan the rpa setting table to determine index *** c----------------------------------------------------------------------- c do irp = 1, ndif if (jrpa(i) .eq. irpa(irp)) go to 50 end do go to 100 ! no value found 50 continue c c----------------------------------------------------------------------- c *** check this sample is in the angle range required *** c----------------------------------------------------------------------- c iang = isangl(degsam, ramang, i) if (iang.lt.modblk(7) .or. iang.gt.modblk(8)) go to 100 c c----------------------------------------------------------------------- c *** check that this mass is in the mass range required *** c----------------------------------------------------------------------- c if(jmsh(i).lt.modblk(3) .or. jmsh(i).gt.modblk(4)) go to 100 c c----------------------------------------------------------------------- c *** save the data *** c----------------------------------------------------------------------- c jflag = 1 cnt = idcodc(jcr(i,modblk(2)), ic) cts(irp) = cts(irp) + cnt ctss(irp) = ctss(irp) + cnt**2 ictn(irp) = ictn(irp) + ic 100 continue c c----------------------------------------------------------------------- c *** end radial head processing *** c----------------------------------------------------------------------- c else c c----------------------------------------------------------------------- c *** z head processing *** c----------------------------------------------------------------------- c c----------------------------------------------------------------------- c *** get the detector number *** c----------------------------------------------------------------------- c idet = ((modblk(1)-2) * 2) + modblk(2) c c----------------------------------------------------------------------- c *** loop through the samples to process *** c----------------------------------------------------------------------- c do 200 i = is, ie c c----------------------------------------------------------------------- c *** scan the rpa setting table to determine index *** c----------------------------------------------------------------------- c do irp = 1, ndif if (jrpa(i) .eq. irpa(irp)) go to 150 end do go to 200 ! no value found 150 continue c c----------------------------------------------------------------------- c *** check this sample is in the angle range required *** c----------------------------------------------------------------------- c iang = isangl( degsam, ramang, i) if (iang.lt.modblk(7) .or. iang.gt.modblk(8)) go to 200 c c----------------------------------------------------------------------- c *** check that this mass is in the mass range required *** c----------------------------------------------------------------------- c if(jmsh(i).lt.modblk(3) .or. jmsh(i).gt.modblk(4)) go to 200 c c----------------------------------------------------------------------- c *** check we have data for this z head detector *** c----------------------------------------------------------------------- c ich = igtzms(idet, i) if (ich .le. 0) go to 200 c c----------------------------------------------------------------------- c *** save the data *** c----------------------------------------------------------------------- c jflag = 1 cnt = idcodc(icde(i,ich), ic) cts(irp) = cts(irp) + cnt ctss(irp) = ctss(irp) + cnt**2 ictn(irp) = ictn(irp) + ic 200 continue c c----------------------------------------------------------------------- c *** end z head processing *** c----------------------------------------------------------------------- c end if c c----------------------------------------------------------------------- c----------------------------------------------------------------------- c return end