SUBROUTINE YDIFPH(N,INTPHD,TH,TMIN,TMAX,FWIDTH,DIFPHD,FIRST, * LAST) * * Module number: 14.4.2 * * Module name: YDIFPH * * Keyphrase: * ---------- * Compute differential pulse height distribution * Description: * ------------ * The differential pulse hieght distribution for each diode * is computed by convolution of the integral pulse height * distribution by a smoothing differential filter of user * specified width. The filter is computed to give the slope of * the least squares line through the number of points specified * by width. * * FORTRAN name: * * Keywords of accessed files and tables: * -------------------------------------- * none * Subroutines Called: * ------------------- * none * History: * -------- * Version Date Author Description * 1 Dec 88 D. Lindler Designed and coded *------------------------------------------------------------------------------- C C input parameters C C N - number of threshold levels (integer) C INTPHD - integral PHD C TH - vector of threshold levels C TMIN - minimum threshold level to be fit C TMAX - maximum threshold level to fit C FWIDTH - differential filter width C C output parameters C C DIFPHD - differential PHD C FIRST - first data point to fit C LAST - last data point to fit C C------------------------------------------------------------------------- INTEGER N,FWIDTH,FIRST,LAST DOUBLE PRECISION INTPHD(N,512),TH(N),TMIN,TMAX,DIFPHD(N,512) C C LOCAL VARIABLES C DOUBLE PRECISION FILTER(29),SUMSQ,DELT,SUM INTEGER HWIDTH,DIODE,I,J C C--------------------------------------------------------------------------- C C COMPUTE DIFF. FILTER C DELT=TH(2)-TH(1) HWIDTH=FWIDTH/2 FWIDTH=HWIDTH*2+1 C --->Make it odd SUMSQ=0.0 DO 10 I=1,FWIDTH 10 SUMSQ=SUMSQ+(I-HWIDTH-1)**2 DO 20 I=1,FWIDTH 20 FILTER(I)=(1+HWIDTH-I)/SUMSQ/DELT C C COMPUTE DIFF. PHD BY CONVOLUTION WITH FILTER C DO 500 DIODE=1,512 DO 100 I=1,HWIDTH DIFPHD(I,DIODE)=0.0 DIFPHD(N-I+1,DIODE)=0.0 100 CONTINUE FIRST=HWIDTH+1 LAST=N-HWIDTH DO 200 I=FIRST,LAST SUM=0.0 DO 150 J=1,FWIDTH SUM=SUM+INTPHD(I-HWIDTH+J-1,DIODE) * *FILTER(J) 150 CONTINUE DIFPHD(I,DIODE)=SUM 200 CONTINUE 500 CONTINUE C C COMPUTE RANGE TO FIT C 600 IF((TH(FIRST).GE.TMIN).OR.(FIRST.EQ.LAST))GO TO 700 FIRST=FIRST+1 GO TO 600 700 IF((TH(LAST).LE.TMAX).OR.(LAST.EQ.FIRST))GO TO 800 LAST=LAST-1 800 CONTINUE RETURN END