1 SUBROUTINE dmatch (DANGTL, DMAGTL, IFXCLM, NUMCAT,
2 I IDNCAT, DATCAT, NUMSTR, KLMSTR,
3 I NUMCLM, LBLCLM, GCICLM, BRICLM, NOBCLM,
4 O MRKCLM, MRKSTR, IDFCLM, NRFCLM,
5 O MAPCLM, SKYCLM, IRCODE)
50 INTEGER*4 LEVDBG(8),LUDBUG
51 COMMON /CMDEBG/LEVDBG,LUDBUG
52 REAL*8 PI,RADEG,RE,REM,F,OMF2,OMEGAE
53 COMMON /GCONST/PI,RADEG,RE,REM,F,OMF2,OMEGAE
151 real*8 dangtl , dmagtl
153 real*4 datcat(7,*) , gciclm(3,*), briclm(*), skyclm(10,3,*)
155 INTEGER*4 IFXCLM , NUMCAT , IDNCAT(*)
156 INTEGER*4 NUMSTR , KLMSTR(*) , MRKSTR(*)
157 INTEGER*4 NUMCLM , LBLCLM(*) , NOBCLM(*)
158 INTEGER*4 MRKCLM(*) , IDFCLM(*) , NRFCLM(*)
159 INTEGER*4 MAPCLM(10,*), IRCODE
162 real*8 angsep , angdif , toler ,
dangle, besta
163 real*8 e2clm(3), e2ref(3) , ue2ref(3), rangtl, rmagdf, rmax
164 INTEGER*4 ICLM , ISTAR , IOBS , IBEST , ITEMP , IMATCH
167 DATA rmax /999999.0d0/
171 IF (levdbg(7) .NE. 0)
WRITE (ludbug,1000)
174 CALL dirini (numstr, numclm, ifxclm,
175 1 mrkclm, idfclm, nrfclm, mapclm, skyclm, mrkstr)
181 rangtl = dangtl / radeg
182 IF (levdbg(7) .GE. 1)
WRITE (ludbug,4000) rangtl, dmagtl
186 DO 200 iclm = 1,numclm
187 IF (mrkclm(iclm) .EQ. 0)
THEN
190 IF (levdbg(7) .GE. 4)
THEN
191 WRITE (ludbug,4010) lblclm(iclm),(gciclm(i,iclm),i=1,3),
196 DO 100 istar = 1,numcat
199 e2clm(1) = dble(gciclm(1,iclm))
200 e2clm(2) = dble(gciclm(2,iclm))
201 e2clm(3) = dble(gciclm(3,iclm))
202 e2ref(1) = dble(datcat(1,istar))
203 e2ref(2) = dble(datcat(2,istar))
204 e2ref(3) = dble(datcat(3,istar))
205 angsep =
dangle(e2clm, e2ref, toler, angdif)
208 rmagdf = dble(
abs(briclm(iclm)-datcat(4,istar)))
211 IF ((angsep .LT. rangtl).AND.(rmagdf .LT. dmagtl))
THEN
212 nrfclm(iclm) = nrfclm(iclm) + 1
215 IF (levdbg(7) .GE. 4)
THEN
216 WRITE (ludbug,4020) nrfclm(iclm), istar, idncat(istar),
219 IF (nrfclm(iclm) .GT. ifxclm)
THEN
223 mapclm(nrfclm(iclm),iclm) = istar
233 DO 500 iclm = 1,numclm
234 IF (nrfclm(iclm) .EQ. 0)
THEN
239 DO 300 iobs = 1,numstr
240 IF ((klmstr(iobs).EQ. iclm).AND.(mrkstr(iobs).EQ. 0))
THEN
244 ELSE IF (nrfclm(iclm) .EQ. 1)
THEN
251 e2clm(1) = dble(gciclm(1,iclm))
252 e2clm(2) = dble(gciclm(2,iclm))
253 e2clm(3) = dble(gciclm(3,iclm))
259 DO 400 imatch = 1,nrfclm(iclm)
260 istar = mapclm(imatch,iclm)
261 e2ref(1) = dble(datcat(1,istar))
262 e2ref(2) = dble(datcat(2,istar))
263 e2ref(3) = dble(datcat(3,istar))
264 angsep =
dangle(e2clm, e2ref, toler, angdif)
265 IF (angsep .LT. besta)
THEN
272 itemp = mapclm(1,iclm)
273 mapclm(1,iclm) = mapclm(ibest,iclm)
274 mapclm(ibest,iclm) = itemp
280 IF (levdbg(7) .NE. 0)
WRITE (ludbug,2000)
285 IF (levdbg(7) .NE. 0)
WRITE (ludbug,3000)
286 IF (ircode .EQ. 1)
THEN
290 IF (levdbg(7) .GE. 4)
WRITE (ludbug,6000) iclm
295 1000
FORMAT(
' *** ENTER DMATCH ***')
296 2000
FORMAT(
' *** EXIT DMATCH ***')
297 3000
FORMAT(
' *** ABEND DMATCH ***')
298 4000
FORMAT(
' DIRECT MATCH MAX ANGSEP=',d14.6,
' RADIANS AND',
299 1
' MAGDIF MAX=',d14.6)
300 4010
FORMAT(
' WORKING ON CLUMP ',i6,
' GCI=',3(f14.6,1x),
' MAG=',f14.6)
301 4020
FORMAT(
' MATCH ',i4,
' STARINDEX=',i6,
' SKYMAP#=',i10,
302 1
' ANGSEP=',d14.6,
' MAGDIF=',d14.6)
303 6000
FORMAT(
' DIRECT: MATCH TABLE OVERFILL WHILE MATCHING CLUMP ',i6)