43 INTEGER,
PARAMETER :: nlyr=10
44 INTEGER,
PARAMETER :: nmlyr=14
45 INTEGER,
PARAMETER :: nmx=10
46 INTEGER,
PARAMETER :: nmy=5
47 INTEGER,
PARAMETER :: ntot=nlyr*nmx*nmy
49 REAL,
PARAMETER :: dets= 10.0
50 REAL,
PARAMETER :: diss= 10.0
51 REAL,
PARAMETER :: thck= 0.02
52 REAL,
PARAMETER :: offs= 0.5
53 REAL,
PARAMETER :: stereo=0.08727
54 REAL,
PARAMETER :: sizel= 20.0
55 REAL,
PARAMETER :: sigl =0.002
59 INTEGER,
DIMENSION(nmlyr) :: islyr
60 INTEGER,
DIMENSION(nmlyr) :: ihits
61 REAL,
DIMENSION(ntot) :: sdevx
62 REAL,
DIMENSION(ntot) :: sdevy
63 REAL,
DIMENSION(nmlyr) :: sarc
64 REAL,
DIMENSION(nmlyr) :: ssig
65 REAL,
DIMENSION(2,nmlyr) :: spro
66 REAL,
DIMENSION(nmlyr) :: xhits
67 REAL,
DIMENSION(nmlyr) :: yhits
68 REAL,
DIMENSION(nmlyr) :: sigma
90 SUBROUTINE mptst2(imodel) ! generate test files
131 INTEGER,
INTENT(IN) :: imodel
133 REAL :: derlc(nmlyr*2+3)
134 REAL :: dergl(nmlyr*2+3)
140 dimension nbrl(2),lbrl(nmlyr,2),sbrl(nmlyr,2),wbrl(nmlyr,2), cmbbrl(2)
141 DATA cmbbrl / 0.0, 1.0 /
144 INQUIRE(file=
'mp2str.txt',iostat=ios,exist=ex1)
145 INQUIRE(file=
'mp2con.txt',iostat=ios,exist=ex2)
147 INQUIRE(file=
'mp2tst.bin',iostat=ios,exist=ex3)
150 WRITE(*,*)
'Generating test data for mp II...'
153 IF(ex3) CALL system(
'rm mp2tst.bin')
155 IF(.NOT.ex1)
OPEN(unit=7,access=
'SEQUENTIAL',form=
'FORMATTED', &
157 IF(.NOT.ex2)
OPEN(unit=9,access=
'SEQUENTIAL',form=
'FORMATTED', &
159 OPEN(unit=51,access=
'SEQUENTIAL',form=
'UNFORMATTED', file=
'mp2tst.bin')
171 IF (mod(layer,3) == 1)
THEN
176 spro(1,i)=sqrt(1.0-stereo**2)
189 IF (abs(sarc(i)-sold) > cmbbrl(k)) nbrl(k)=nbrl(k)+1
192 sbrl(lb,k)=sbrl(lb,k)+sarc(i)
193 wbrl(lb,k)=wbrl(lb,k)+1.0
197 sbrl(i,k)=sbrl(i,k)/wbrl(i,k)
198 wbrl(i,k)=sqrt(wbrl(i,k))
211 sdevx(((i*nmy+k)*nmx+l))=dispxm*
gran()
212 sdevy(((i*nmy+k)*nmx+l))=dispym*
gran()
220 WRITE(luns,101)
'* Default test steering file'
221 WRITE(luns,101)
'fortranfiles ! following bin files are fortran'
222 WRITE(luns,101)
'mp2con.txt ! constraints text file '
223 WRITE(luns,101)
'mp2tst.bin ! binary data file'
224 WRITE(luns,101)
'Cfiles ! following bin files are Cfiles'
228 WRITE(luns,101)
'*hugecut 50.0 !cut factor in iteration 0'
229 WRITE(luns,101)
'*chisqcut 1.0 1.0 ! cut factor in iterations 1 and 2'
230 WRITE(luns,101)
'*entries 10 ! lower limit on number of entries/parameter'
232 '*pairentries 10 ! lower limit on number of parameter pairs', &
234 WRITE(luns,101)
'*printrecord 1 2 ! debug printout for records'
236 '*printrecord -1 -1 ! debug printout for bad data records'
238 '*outlierdownweighting 2 ! number of internal iterations (> 1)'
239 WRITE(luns,101)
'*dwfractioncut 0.2 ! 0 < value < 0.5'
240 WRITE(luns,101)
'*presigma 0.01 ! default value for presigma'
241 WRITE(luns,101)
'*regularisation 1.0 ! regularisation factor'
242 WRITE(luns,101)
'*regularisation 1.0 0.01 ! regularisation factor, pre-sigma'
245 WRITE(luns,101)
'*bandwidth 0 ! width of precond. band matrix'
246 WRITE(luns,101)
'method diagonalization 3 0.001 ! diagonalization '
247 WRITE(luns,101)
'method fullMINRES 3 0.01 ! minimal residual '
248 WRITE(luns,101)
'method sparseMINRES 3 0.01 ! minimal residual '
249 WRITE(luns,101)
'*mrestol 1.0D-8 ! epsilon for MINRES'
250 WRITE(luns,101)
'method inversion 3 0.001 ! Gauss matrix inversion'
251 WRITE(luns,101)
'* last method is applied'
252 WRITE(luns,101)
'*matiter 3 ! recalculate matrix in iterations'
254 WRITE(luns,101)
'end ! optional for end-of-data'
264 IF(.NOT.ex2)
WRITE(lunt,*)
'Constraint 0.0'
266 labelt=(i*nmy+k)*nmx+ncx-1
267 IF(.NOT.ex2)
WRITE(lunt,103) labelt,one
268 sdevx(((i-1)*nmy+k)*nmx+ncx)=0.0
270 IF(.NOT.ex2)
WRITE(lunt,*)
'Constraint 0.0'
272 labelt=(i*nmy+k)*nmx+ncx+1000-1
273 IF(.NOT.ex2)
WRITE(lunt,103) labelt,one
274 sdevy(((i-1)*nmy+k)*nmx+ncx)=0.0
287 the0=sqrt(thck)*0.014/p
296 im =mod(ihits(i),nmxy)
300 derlc(3)=xhits(i)*spro(1,lyr)
301 derlc(4)=xhits(i)*spro(2,lyr)
304 label(1)=im+nmxy*islyr(lyr)
305 label(2)=im+nmxy*islyr(lyr)+1000
307 IF (imodel == 1)
THEN
309 sigma(j)=sqrt(sigma(j)**2+((xhits(j)-xhits(i))*the0)**2)
313 IF (imodel == 2.AND.i > 1)
THEN
317 derlc(nalc)=(xhits(i)-xhits(j))*spro(1,lyr)
319 derlc(nalc)=(xhits(i)-xhits(j))*spro(2,lyr)
323 IF (imodel >= 3)
THEN
330 derlc(lb*2-1)=spro(1,lyr)
331 derlc(lb*2 )=spro(2,lyr)
334 CALL
mille(nalc,derlc,2,dergl,label,yhits(i),sigma(i))
338 IF (imodel == 2)
THEN
345 CALL
mille(nalc,derlc,0,dergl,label,0.0,the0)
349 IF (imodel >= 3)
THEN
351 dp=1.0/(sbrl(i,ibrl)-sbrl(i-1,ibrl))
352 dn=1.0/(sbrl(i+1,ibrl)-sbrl(i,ibrl))
359 derlc(2* i +l)=-dp-dn
361 CALL
mille(nalc,derlc,0,dergl,label,0.0,the0*wbrl(i,ibrl))
391 WRITE(*,*) ncount,
' tracks generated with ',nthits,
' hits.'
392 WRITE(*,*) nrecds,
' records written.'
432 INTEGER,
INTENT(IN) :: ip
435 xnull=sizel*(
uran()-0.5)
436 ynull=sizel*(
uran()-0.5)
437 xexit=sizel*(
uran()-0.5)
438 yexit=sizel*(
uran()-0.5)
439 xslop=(xexit-xnull)/sarc(nmlyr)
440 yslop=(yexit-ynull)/sarc(nmlyr)
443 WRITE(*,*)
' Track ', xnull, ynull, xslop, yslop
457 xs=xnull+sarc(i)*xslop
458 ys=ynull+sarc(i)*yslop
466 imx=ifix((x+sizel*0.5)/sizel*float(nmx))
467 IF (imx < 0.OR.imx >= nmx) cycle
468 imy=ifix((y+sizel*0.5)/sizel*float(nmy))
469 IF (imy < 0.OR.imy >= nmy) cycle
471 ihit=((i-1)*nmy+imy)*nmx+imx
472 ioff=((islyr(i)-1)*nmy+imy)*nmx+imx+1
478 yhits(nhits)=(xl-xs)*spro(1,i)+(yl-ys)*spro(2,i)+
gran()*ssig(i)
482 WRITE(*,101) nhits,i,ihit,x,y,xhits(nhits), yhits(nhits),sigma(nhits)
485 101 format(3i3,5f8.4)