1 #include "BlockData/cblkGene.h" 7 real*8 xin(maxbin), yin(maxbin)
9 integer nbin0, icon, code, tcode
10 integer count, status, cond
13 if(count .eq. 3) cond=1
14 if(count .eq. 2) cond=0
15 if( count .ne. 2 .and. count .ne. 3 )
then 16 write(0,*)
'Usage: latFit.. code [c] < inputfile > outfile' 17 write(0,*)
' code = particle code,',
18 *
' inputfile is output from splitLat%csh ' 19 write(0,*)
' c: if exists, write only coeff. on stdout ' 20 write(0,*)
' if omitted, coeff. is output on stderr,',
21 *
' fitted (x,y) on stdout' 24 call getarg(1, buf, status)
37 read(*,*,end=100) xin(nbin0+1), yin(nbin0+1)
41 if(nbin0 .gt. maxbin)
then 42 write(0,*)
' too many lat data> ', maxbin
47 call copenfw2(minout,
"/dev/null", 1, icon)
51 call fitlat0(cond, tcode, code, xin, yin, nbin0)
54 subroutine fitlat0(cond, tcode, code, xin, yin, nbin)
58 integer nbin, code, tcode
59 real*8 xin(nbin), yin(nbin)
60 real*8 xuse(nbin), yuse(nbin)
61 real*8 prmout(nparam, 4, nregion)
64 integer n1, n2, region
78 if(xin(i) .gt.
x2(region) )
exit 79 if(xin(i) .lt.
x1(region) ) cycle
91 call fitlat1(region, code, xuse, yuse, n1,
92 *
param(1, code, region), prmout(1, code,region))
96 write(*,
'(5g12.4)') prmout(1, code,region),
97 * prmout(2,code, region),
98 * prmout(3, code, region), prmout(4,code, region),
107 write(0,
'(5g12.4)') prmout(1,code, region),
108 * prmout(2, code, region),
109 * prmout(3, code, region), prmout(4, code,region),
115 pw = prmout(4,code, region)
116 do while ( xx .le.
drx2(region) )
117 f=prmout(1,code,region)/
118 * xx**(prmout(2,code, region) +
120 * prmout(3,code, region)* xx**
pw )
128 subroutine fitlat1(region, code, xin, yin, n, prmin, prmout )
132 real*8 prmin(nparam), prmout(nparam)
134 real*8 xin(n), yin(n)
136 integer nlabel(nparam)
137 character*10 pname(nparam)
138 real*8 initval(nparam)
141 data nlabel/ 1, 2, 3, 4/
142 data pname/
'p',
'q',
'r',
'pw'/
143 data step/ 1., 0.001
d0, 0.0001
d0, 0.1
d0/
144 real*8 zero, one, three, four, five
145 data zero,one,three,four, five / 0., 1., 3.,4., 5. /
164 initval(i) = prmin(i)
167 call mninit( 5, minout, minsave)
177 call mnparm(nlabel(i), pname(i), initval(i), step(i),
178 *
low(i, code,region),
up(i, code,region), ierflg)
180 if (ierflg .ne. 0)
then 181 write (0,
'(a,i3)')
' unable to define parameter no.',i
186 call mnseti(
'lat as a function of core distance')
208 if(region .eq. 4 )
then 211 if(maxdiff .gt. 0.01)
then 212 badindex(maxindex)= -maxindex
217 if(maxdiff .gt. 0.033)
then 220 badindex(maxindex)= -maxindex
block data include Zlatfit h c fitting region data x1(1)/0.03/
block data include Zlatfit h c fitting region data data data data data d0 data data d0 data data h g *is for param c g data up(2, 1)/7.0d0/
subroutine mnexcm(FCN, COMAND, PLIST, LLIST, IERFLG, FUTIL)
subroutine fitlat1(region, code, xin, yin, n, prmin, prmout)
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon true
subroutine copenfw2(io, fnin, form, icon)
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc * param
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc drx1
block data include Zlatfit h c fitting region data data data data data d0 data data d0 data data h g *is for param c g data low(1, 1)/1.d-5/
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer npoint
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
subroutine mnparm(K, CNAMJ, UK, WK, A, B, IERFLG)
block data include Zlatfit h c fitting region data x2(1)/0.5/data x1(2)/0.3/
subroutine mninit(I1, I2, I3)
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc * oparam
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc drx2
subroutine latfnc(npar, gin, f, paramx, iflag)
! structure defining a particle at production ! Basic idea of what is to be contained in ! the particle structue is that dynamical ones should be included those derivable from the particle code ! is not included ******************************************************type fmom momentum sequence union map real e endmap map real * x
subroutine fitlat0(cond, tcode, code, xin, yin, nbin)