COSMOS v7.655  COSMOSv7655
(AirShowerMC)
latFit.f File Reference

Go to the source code of this file.

Functions/Subroutines

program latfit
 
subroutine fitlat0 (cond, tcode, code, xin, yin, nbin)
 
subroutine fitlat1 (region, code, xin, yin, n, prmin, prmout)
 

Function/Subroutine Documentation

◆ fitlat0()

subroutine fitlat0 ( integer  cond,
integer  tcode,
integer  code,
real*8, dimension(nbin)  xin,
real*8, dimension(nbin)  yin,
integer  nbin 
)

Definition at line 55 of file latFit.f.

References drx1, drx2, fitlat1(), param, softenpik::pw, x1(), and x2().

55  implicit none
56  include "Zlatfit.h"
57  integer cond
58  integer nbin, code, tcode
59  real*8 xin(nbin), yin(nbin)
60  real*8 xuse(nbin), yuse(nbin)
61  real*8 prmout(nparam, nregion)
62 
63  integer i
64  integer n1, n2, region
65  real*8 xx, f, xb
66 
67 c fitting at region
68  do region=1, nregion
69 c if(tcode .eq. 3 .and. region .eq. 4) then
70 c pw = 0.5 ! %pw% <--this %pw% is needed blanks/ = /
71  ! Used by mkLDD/Util/Lat/
72 c else
73 c pw = 0.5
74 c endif
75 
76  n1 =0
77  do i = 1, nbin
78  if(xin(i) .gt. x2(region) ) exit
79  if(xin(i) .lt. x1(region) ) cycle
80  n1 = n1 +1
81  xuse(n1) = xin(i)
82  yuse(n1) = yin(i)
83  enddo
84 c////////////
85 c write(0,*) ' region=',region, ' points=', n1
86 c write(0,*) ' param(1,region)=', param(1, region)
87 c write(0,*) ' param(2,region)=', param(2, region)
88 c write(0,*) ' param(3,region)=', param(3, region)
89 c//////////
90 c region, x, y, #, output param
91  call fitlat1(region, code, xuse, yuse, n1, param(1, region),
92  * prmout(1, region))
93 
94  if(cond .eq. 1) then
95 c only coeff. is put on stdout
96  write(*,'(4g12.4)') prmout(1, region), prmout(2, region),
97  * prmout(3, region), prmout(4, region)
98 c if(code .eq. 2) then
99 cc for hadron, region 1 is mssing so we repeat region 2 data
100 c write(*,'(3g12.4)')
101 c * prmout(1, region), prmout(2, region), prmout(3, region)
102 c endif
103  else
104 c coeff is put on stderr
105  write(0,'(4g12.4)') prmout(1, region), prmout(2, region),
106  * prmout(3, region), prmout(4,region)
107  endif
108  if(cond .eq. 0) then
109 c to see fitted result (r, t) is put on stdout
110  xx = drx1( region)
111  pw = prmout(4,region)
112  do while ( xx .le. drx2(region) )
113  f=prmout(1,region)/xx**(prmout(2,region) +
114 c * prmout(3,region)* log(xx) )
115  * prmout(3,region)* xx**pw )
116  write(*,*) xx, f
117  xx = xx*10.0**0.02
118  enddo
119  endif
120  enddo
block data include Zlatfit h c fitting region data x1(1)/0.03/
subroutine fitlat1(region, code, xin, yin, n, prmin, prmout)
Definition: latFit.f:129
nodes i
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc * param
Definition: Zfit.h:15
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc drx1
Definition: Zfit.h:15
*Zfirst p fm *Zfirst p Zfirst p code
Definition: ZavoidUnionMap.h:1
real(8), save pw
Definition: csoftenPiK.f:36
block data include Zlatfit h c fitting region data x2(1)/0.5/data x1(2)/0.3/
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc drx2
Definition: Zfit.h:15
dE dx *! Nuc Int sampling table f
Definition: cblkMuInt.h:130
Here is the call graph for this function:

◆ fitlat1()

subroutine fitlat1 ( integer  region,
integer  code,
real*8, dimension(n xin,
real*8, dimension(n yin,
integer  n,
real*8, dimension(nparam)  prmin,
real*8, dimension(nparam)  prmout 
)

Definition at line 124 of file latFit.f.

References d0, latfnc(), low(), mnexcm(), mninit(), mnparm(), mnseti(), npoint, oparam, up(), x, and y.

124  implicit none
125  include "Zlatfit.h"
126  integer region, code
127  real*8 prmin(nparam), prmout(nparam)
128  integer n
129  real*8 xin(n), yin(n)
130 
131  integer nlabel(nparam)
132  character*10 pname(nparam)
133  real*8 initval(nparam)
134  real*8 step(nparam)
135 
136  data nlabel/ 1, 2, 3, 4/
137  data pname/ 'p', 'q', 'r', 'pw'/
138  data step/ 1., 0.001d0, 0.0001d0, 0.1d0/
139  real*8 zero, one, three, four, five
140  data zero,one,three,four, five / 0., 1., 3.,4., 5. /
141  real*8 fval, xx
142  integer i, ierflg
143 
144  external latfnc
145 
146 c
147 c in fortran mode, this must be called for a new fnc
148 c
149  npoint = n
150  do i = 1, npoint
151  x(i) = xin(i)
152  y(i) = yin(i)
153 c*************
154  badindex(i)=i
155 c***************
156  enddo
157 
158  do i = 1, nparam
159  initval(i) = prmin(i)
160  enddo
161 
162  call mninit( 5, minout, minsave)
163 
164  do i= 1, nparam
165 c nprm: a number given to a parameter: (label)
166 c pnam: name of the parameer
167 c vstrt: initial value of the parameter
168 c stp: initial step size of the //
169 c next two: zero-->the parameter is not bounded (lower or upper)
170 c ierflg: retrun value; cond code. 0--> ok
171 
172  call mnparm(nlabel(i), pname(i), initval(i), step(i),
173  * low(i, code), up(i, code), ierflg)
174 
175  if (ierflg .ne. 0) then
176  write (0,'(a,i3)') ' unable to define parameter no.',i
177  stop
178  endif
179  enddo
180 c
181  call mnseti('lat as a function of core distance')
182 c request fcn to read in (or generate random) data (iflag=1)
183 c fcnk0: function to be minimuzed is calculated. also
184 c there are other funcitons
185 c one is the argument to fcnk0. seems to be converted to
186 c integer inside.
187 c 1 number of argument in one (one could be array)
188 c ierflf: ouptut. 0-->ok
189 c 0: no external function is used in fcnk0
190  limit = 0.
191  call mnexcm(latfnc, 'call fcn', one ,1,ierflg, 0)
192 c fix the 3,4,5-th parameters,
193 c call mnexcm(timefnc,'fix', fixlist ,3, ierflg,0)
194 c print minumum things
195  call mnexcm(latfnc,'set print', zero ,1,ierflg,0)
196 c use migrad method for minimization
197 c with default condtions
198  call mnexcm(latfnc,'migrad', zero ,0,ierflg,0)
199 c analysis of errors for all parameters
200  call mnexcm(latfnc,'minos', zero ,0,ierflg,0)
201 
202 
203  if(region .eq. 4 ) then
204 c if max diff is < 10% no more trial
205 c log(1.1)**2 = 0.009
206  if(maxdiff .gt. 0.01) then
207  badindex(maxindex)= -maxindex
208  call mnexcm(latfnc,'migrad', zero ,0,ierflg,0)
209 c analysis of errors for all parameters
210  call mnexcm(latfnc,'minos', zero ,0,ierflg,0)
211 c if there is still 20 % diff.. remove it
212  if(maxdiff .gt. 0.033) then
213 c write(0,*) ' maxdiff=',maxdiff,
214 c * ' idx=',maxindex
215  badindex(maxindex)= -maxindex
216  call mnexcm(latfnc,'migrad', zero ,0,ierflg,0)
217 c analysis of errors for all parameters
218  call mnexcm(latfnc,'minos', zero ,0,ierflg,0)
219  endif
220  endif
221  endif
222 
223 c
224 c call fcn with 3. i.e, ouput etc.
225  call mnexcm(latfnc,'call fcn', three , 1,ierflg, 0)
226 
227  do i = 1, nparam
228  prmout(i) = oparam(i)
229  enddo
230 
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)
Definition: mnexcm.f:25
nodes i
subroutine mnseti(TIT)
Definition: mnseti.f:10
*Zfirst p fm *Zfirst p Zfirst p code
Definition: ZavoidUnionMap.h:1
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
Definition: cblkEvhnp.h:5
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer npoint
Definition: Zfit.h:15
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
subroutine mnparm(K, CNAMJ, UK, WK, A, B, IERFLG)
Definition: mnparm.f:25
subroutine mninit(I1, I2, I3)
Definition: mninit.f:34
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc * oparam
Definition: Zfit.h:15
subroutine latfnc(npar, gin, f, paramx, iflag)
Definition: latfnc.f:2
integer n
Definition: Zcinippxc.h:1
! 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
Definition: Zptcl.h:21
Here is the call graph for this function:

◆ latfit()

program latfit ( )

Definition at line 3 of file latFit.f.

References copenfw2(), fitlat0(), and true.

Here is the call graph for this function: