*-- Author : Stephen Burke SUBROUTINE FFRHNT(ICELL,DRIFT,IWEDGE,JMIN) *-----------------------------------------Updates 07/09/93------- **: FFRHNT 40000 SB. New definition of dead wire flag. *-----------------------------------------Updates 27/07/93------- **: FFRHNT 30907 RP. Farm changes. **---------------------------------------------------------------------- **: FFRHNT 30907 SB. Check for bad hits (again). **---------------------------------------------------------------------- **: FFRHNT 30104 SM. Check for bad hits. **---------------------------------------------------------------------- ********************************************************************** * * * Look for a radial digi near a specified point * * * * NB The FRRE bank must have been unpacked into FRLC and FRHC, with * * a pointer to FRLC in INDLC(2) in /FFGEO/ * * * ********************************************************************** *KEEP,FKNPL. CHARACTER*5 CKDBG PARAMETER (CKDBG='FKDBG') PARAMETER (NPL=72) LOGICAL LTRUE,LFIRST,LTRPL,LTRPLD DOUBLE PRECISION TRUE,RTRUE,CHITRU,SPRO,CPRO,SFIL,CFIL &, SSMT,CSMT,SSMTR,CSMTR,DPRO,CBPRO,QPRO,QGAIN &, RPRO,CRPRO,RFIL,CRFIL,RSMT,CRSMT,CHIFIL,CHISMT * * Per-track values can go in H1WORK; note that LTRUE and LFIRST must * be set at least per event. * * This is about 36k words long; the remaining common blocks are * about 3.6k in total. Some of this could be in /H1WORK/, but the * blocks would have to be reorganised. * COMMON /H1WORK/ * /FKPROJ/ & SPRO(5,NPL),CPRO(5,5,NPL) * /FKFILT/ &, SFIL(5,NPL),CFIL(5,5,NPL) * /FKSMTH/ &, SSMT(5,NPL),CSMT(5,5,NPL) &, SSMTR(5,NPL),CSMTR(5,5,NPL) * /FKINT/ &, DPRO(5,5,NPL),CBPRO(5,5,NPL),QPRO(5,5,NPL) &, QGAIN(5,5,NPL),IAPROX,LFIRST * /FKRSID/ &, RPRO(2,NPL),CRPRO(2,2,NPL),RFIL(2,NPL) &, CRFIL(2,2,NPL),RSMT(2,NPL),CRSMT(2,2,NPL) &, CHIFIL(NPL),CHISMT(NPL) * /FKTRUE/ &, TRUE(5,NPL),RTRUE(5,NPL),CHITRU(NPL),LTRUE * /FKDBG/ &, LTRPL(NPL),LTRPLD(NPL) *KEEP,FFGEO. COMMON /FFGEO/ INDG1(2),INDLC(2),IDIGI(NPL) *KEEP,BCS. INTEGER NHROW,NHCOL,NHLEN PARAMETER (NHROW = 2, NHCOL = 1, NHLEN=2) INTEGER NBOSIW PARAMETER (NBOSIW=1000000) INTEGER IW(NBOSIW) REAL RW(NBOSIW) COMMON /BCS/ IW EQUIVALENCE (RW(1),IW(1)) SAVE /BCS/ *KEEP,CNSTBF. INTEGER LW(NBOSIW) REAL SW(NBOSIW) EQUIVALENCE (RW(1),IW(1),LW(1),SW(1)) *KEEP,STFUNCT. * index of element before row number IROW INDR(IND,IROW)=IND+2+IW(IND+1)*(IROW-1) * index of L'th element of row number IROW INDCR(IND,L,IROW)=INDR(IND,IROW) + L * L'th integer element of the IROW'th row of bank with index IND IBTAB(IND,L,IROW)=IW(INDCR(IND,L,IROW)) * L'th real element of the IROW'th row of bank with index IND RBTAB(IND,L,IROW)=RW(INDCR(IND,L,IROW)) *KEEP,STFCLW. * statement functions acting on the BOS COMMON LW * index of element before row number LWROW LNDR(LND,LWROW) = LND + 2 + LW(LND+1)*(LWROW-1) * index of L-th element of row number LWROW LNDCR(LND,L,LWROW)=LNDR(LND,LWROW)+L * L-th integer element of the LWROW'th row in bank with index LND LBTAB(LND,L,LWROW)=LW(LNDCR(LND,L,LWROW)) * L-th real element of the LWROW'th row in bank with index LND SBTAB(LND,L,LWROW)=SW(LNDCR(LND,L,LWROW)) * *KEND. ********************************************************************** JMIN = 0 INDHC = NLINK('FRHC',0) IF (INDHC.LE.0 .OR. INDG1(2).LE.0 .OR. INDLC(2).LE.0) RETURN * Check for dead wires IDEAD = LBTAB(INDG1(2),1,ICELL+1) IF (IDEAD.EQ.1 .OR. IDEAD.EQ.IWEDGE+2) RETURN NHIT = IBTAB(INDHC,1,ICELL+1) J1 = IBTAB(INDHC,2,ICELL+1) * * Find the hit with the minimum difference between its drift and * the target drift. Since the resolution is 150 um and the two-track * resolution is 2 mm there is never any ambiguity; also no need to * look at the radius. * DDMIN = 1.E10 DO 100 JDIG=J1,J1+NHIT-1 DD = RBTAB(INDLC(2),2,JDIG) DDD = ABS(ABS(DD) - ABS(DRIFT)) IF (DDD.LT.DDMIN) THEN DDMIN = DDD JMIN = JDIG ENDIF 100 CONTINUE * Check that it's the right wedge, and the hit is OK ISGNW = IBTAB(INDLC(2),6,JMIN) IF (JBIT(ISGNW,1).NE.IWEDGE) JMIN = 0 IF (JBIT(ISGNW,8).EQ.1) JMIN = 0 RETURN END *