subroutine readqspu(lunit,ntid,icoll,trange,rc) * * Read QSPU data files * This method of reading the files * gets read errors if the column fields * are not of equal width. * The nt/read method does not. * This loop method also suffers from * the 132-character record limit. * 31 March 2013 jac * integer lunit,nrec,ndata,icoll * Time range of trace in ns integer trange * RC time constant in seconds real rc * vector tt,vv,ped * real tbin real t,volts real vec(2) * print *,'Rtn READQSPU called with arguments ', & lunit,ntid,icoll,trange,rc * * Time bin size in ns, assuming scope trace is 1000 digitizations tbin=float(trange)/1000. * * Convert RC time constant to ns rc=rc*1e9 * nrec=0 ndata=0 ndtot=0 ncoll=1 t0=0. t=t0-tbin/2. 10 continue read(lunit,*,err=100,end=900)volts nrec=nrec+1 * if(nrec.gt.38)then if(nrec.gt.47)then ndata=ndata+1 ndtot=ndtot+1 t=t+tbin * if(ncoll.eq.1)print *, nrec, ndata, ncoll, vec if(ncoll.eq.icoll)then volts = volts -ped(ncoll) tt(ndata)=t vv(ndata)=volts if(rc.eq.0.)then vec(1)=t vec(2)=volts else * RC time constant convolution vconv=0. if(ndata.gt.1)then do j=1,ndata if(j.eq.1)then vconv = vconv + & vv(j)*((tt(j))/rc)*exp(-(t-tt(j))/rc) else vconv = vconv + & vv(j)*((tt(j)-tt(j-1))/rc)*exp(-(t-tt(j))/rc) endif enddo endif vec(1)=t vec(2)=vconv endif call hfn(ntid,vec) endif if(ndata.eq.1000) then * skip 9 records between collector traces do i=1,9 read(lunit,*,err=100,end=900) nrec=nrec+1 enddo ndata = 0 ncoll = ncoll+1 t=t0 goto 10 endif else goto 10 endif 100 continue nrec=nrec+1 2000 format(1x,a4) * print *, ' Error found in record ',nrec goto 10 900 continue * print *,' Rtn READQSPU found ',ndtot,' data lines in ', & nrec,' records' * end