REAL FUNCTION echisterr(lunit,icoll,rc) * * Calculate statistical errors for exponential-weighted running sum of * collector charges for purposes of RC filtering. * These errors are very correlated point-to-point because * they sum over many of the same uncorrelated time bins. * * PAW imposes an output record length limit of 132 characters. * * 19 May 2014 2013 J.A.Crittenden * REAL +T ,DELT ,QDENS ,GRID ,COL1 ,COL2 , +COL3 ,COL4 ,COL5 ,COL6 ,COL7 ,COL8 , +COL9 ,COL10 ,COL11 ,COL12 ,COL13 ,COL14 , +COL15 ,COL16 ,COL17 * LOGICAL CHAIN CHARACTER*128 CFILE * COMMON /PAWCHN/ CHAIN, NCHEVT, ICHEVT COMMON /PAWCHC/ CFILE * COMMON/PAWIDN/IDNEVT,OBS(13), +T ,DELT ,QDENS ,GRID ,COL1 ,COL2 , +COL3 ,COL4 ,COL5 ,COL6 ,COL7 ,COL8 , +COL9 ,COL10 ,COL11 ,COL12 ,COL13 ,COL14 , +COL15 ,COL16 ,COL17 * * Unit number of output file integer lunit * RC time constant (seconds) real rc * Collector number integer icoll * Time range vector tlims * Filter weight real wt,wtsum * real tmin, tmax * real qe(500000,17) real t0(500000) real qqe(17) * tmin=tlims(1)*1e-9 tmax=tlims(2)*1e-9 * * Limit calculation to restricted time range * 23 July 2012 JAC if ( t .gt. tmax ) goto 900 * qe(idnevt,1)=col1 qe(idnevt,2)=col2 qe(idnevt,3)=col3 qe(idnevt,4)=col4 qe(idnevt,5)=col5 qe(idnevt,6)=col6 qe(idnevt,7)=col7 qe(idnevt,8)=col8 qe(idnevt,9)=col9 qe(idnevt,10)=col10 qe(idnevt,11)=col11 qe(idnevt,12)=col12 qe(idnevt,13)=col13 qe(idnevt,14)=col14 qe(idnevt,15)=col15 qe(idnevt,16)=col16 qe(idnevt,17)=col17 t0(idnevt) = t * Limit calculation to restricted time range * 23 July 2012 JAC if ( t .lt. tmin ) goto 900 * if(idnevt.gt.1) then do i=1,17 qqe(i)=0. enddo *--------------------------------------------------------- * Reduce summed time interval to five RC decay times * 12 July 2013 JAC i00=1 do ii=idnevt-1,1,-1 if ( t-t0(ii) .gt. 5*rc )then i00=ii goto 100 endif enddo 100 continue * if( t0(i00) .ge. (tmin-10*rc) ) then * print *,idnevt,t,i00,t0(i00),tmin,tmax * do i=1,17 do i=icoll,icoll * do j=1,idnevt-1 wtsum = 0. do j=i00,idnevt-1 if(j.eq.1)then * First-bin time value is its width wt=((t0(j))/rc)*exp(-(t-t0(j))/rc) qqe(i) = qqe(i) + wt*qe(j,i)**2 wtsum = wtsum+wt else * Protect against simultaneous entries. Exclude them from sum. if(t.gt.t0(j))then wt=((t0(j)-t0(j-1))/rc)*exp(-(t-t0(j))/rc) qqe(i) = qqe(i) + wt*qe(j,i)**2 wtsum = wtsum+wt * write(*,1100) * & j,i00,idnevt,t,t0(j),qe(j,i),wtsum,exp(-(t-t0(j))/rc) 1100 format(3i8,4(2x,e12.5)) endif endif enddo if (wtsum.gt.0)then qqe(i) = qqe(i) / wtsum qqe(i) = sqrt ( qqe(i) ) else qqe(i) = 0. endif enddo * Write output record * write(*,2000)t,delt,(qqe(k),k=1,1) write(lunit,2000)t,delt,(qqe(k),k=1,9) 2000 format(11(e12.5,1x)) * endif * if(idnevt.le.5) then * write(*,1000)'Rtn ECHISTERR event: ',idnevt, * & ' Collector ',icoll, * & ' RC = ',rc, * & ' TMIN,TMAX=',tmin,tmax 1000 format(a,i3,a,i3,a,e9.4,a,e9.4,1x,e9.4) * write(*,2000)t,delt,qdens,grid, * & (qqe(k),k=1,9) * endif endif 900 continue * echisterr=1. END