*-- Author : R. Henderson 24/10/94 SUBROUTINE FPFTSG(NSMLS) C----------------------------------------------------------------------- C C--- Routine finds 'TERTIARY' segments from two Clusters/Planes C--- + nothing. C--- Firstly arrays are calculated which C--- flag clusters which have not already been used in segments. C--- (IUCLU(IPLANE,MAXCLU) = 0 if unused) C--- Then for unused digits that have not yet been placed in a cluster. C--- (IUD(MAXHTS,NUMWPL) = 0 if not used) C--- C--- The new segments are fitted using FPFSTS. A count of the new C--- tertiary segments is kept in COMMON/FPSTSG/ as NFTSEG(9) but C--- otherwise the normal counter NFSEG(9) is incremented to include C--- these new segments. C--- C--- A new disconnected set is found for all segments by FPSSGF. C--- C--- COMMON/FPSTSG/NSTC(9) --- Number of secondary clusters formed. C--- NFSSEG(3) --- Number of secondary Segments formed. C--- NFTSEG(3) --- Number of Tertiary segments formed. C--- C--- The segments are ordered so all primary segments preceed C--- secondary and finary secondary preceed Tertiary) C--- C----------------------------------------------------------------------- C *KEEP,FPPRAM. C C--- MAXSEG is maximum number of segments per supermodule C--- MAXCON is maximum number of amibiguous segments associatable with C--- one segment C--- LIMSTO is maximum number of 2 cluster planes intersections to be C--- stored per supermodule C--- MSEGLM is maximum number of clusters that can be found before C--- connectivity considered C--- MAXCLU is maximum number of clusters that can be found after C--- forming non-connected set MUST BE 50 IF RUN WITH OLD RCW C--- (cluster = 3/4 digits found in a straight line in one C--- 4-wire orientation) C C--- *KEEP,FPH1WRK. C-- *KEEP,FPCSEG. C--- C--- C-- *KEEP,FPDIGI. C--- C-- *KEEP,FPDGI. C--- C-- *KEEP,FPSTID. C--- C-- *interface to real data C---. *KEEP,FPLSEG. C--- C--- *KEEP,FPLGEO. C--- C--- *KEEP,FPSTSG. C--- *KEEP,FPCLUS. C--- *KEND. C C C C C--- Initialize arrays C CALL VZERO(IUD,MAXHTS*NUMWPL) C C--- Establish a list of clusters and digits available C--- to form secondary segments C C C--- Firstly Digits C C--- Loop over supermodules C C C--- Loop over candidate line segments C C C--- Loop on clusters that form CANDIDATE line segments C C C--- Find the planes.clusters numbers that make them up C C C--- Loop on four wires in cluster C C C--- Set flag in IUD (Used Digits) to +/-1 from 0 C (SIGN = DRIFT DIRECTION) C C--- C C C C C C--- Create list of used/unused clusters C CALL VZERO(IUCLU,9*MAXCLU) C C--- Loop over supermodules C C C--- Loop over segments C C--- Remove those outside disconnected set C C C--- C C C--- Set IUCLU to 1 if used C C--- C C--- Having established the unused CLS and Digits find all C--- distances of closest approach C CALL VZERO(NFTSEG,3) C C--- Loop over supermodule C C C--- Loop on candidate line segments C * * SB mod to help with large events * CALL ERRLOG(216,'W:FPFTSG: .GT. MAXSEG segments found') C C--- Calculate the angle wrt to axis of candidate line segment C C C--- C C C--- Check that neither plane in candidate line segment used C C C--- Calculate which wires are to be searched for digits C--- They must be the wires which have not contributed to CLS C C C C--- Fit newly created cluster with candidate line segment C--- to form new (secondary segment) C CALL FPFSTS(ID1,ID2,ID3,ISM,PCHI,CHISQ,NDF,PARSGN,ERRSGN) C C--- Reform disconnected segment sets C CALL FPSSGF(.FALSE.) *