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().

Referenced by latfit().

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, 4, nregion)
62 
63  integer i
64  integer n1, n2, region
65  real*8 xx, f, xb
66 
67 ! fitting at region
68  do region=1, nregion
69 ! if(tcode .eq. 3 .and. region .eq. 4) then
70 ! pw = 0.5 ! %pw% <--this %pw% is needed blanks/ = /
71  ! Used by mkLDD/Util/Lat/
72 ! else
73 ! pw = 0.5
74 ! 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 !////////////
85 ! write(0,*) ' region=',region, ' points=', n1
86 ! write(0,*) ' param(1,region)=', param(1, region)
87 ! write(0,*) ' param(2,region)=', param(2, region)
88 ! write(0,*) ' param(3,region)=', param(3, region)
89 !//////////
90 ! region, x, y, #, output param
91  call fitlat1(region, code, xuse, yuse, n1,
92  * param(1, code, region), prmout(1, code,region))
93 
94  if(cond .eq. 1) then
95 ! only coeff. is put on stdout
96  write(*,'(5g12.4)') prmout(1, code,region),
97  * prmout(2,code, region),
98  * prmout(3, code, region), prmout(4,code, region),
99  * maxdiff
100 ! if(code .eq. 2) then
101 !c for hadron, region 1 is mssing so we repeat region 2 data
102 ! write(*,'(3g12.4)')
103 ! * prmout(1, region), prmout(2, region), prmout(3, region)
104 ! endif
105  else
106 ! coeff is put on stderr
107  write(0,'(5g12.4)') prmout(1,code, region),
108  * prmout(2, code, region),
109  * prmout(3, code, region), prmout(4, code,region),
110  * maxdiff
111  endif
112  if(cond .eq. 0) then
113 ! to see fitted result (r, t) is put on stdout
114  xx = drx1( 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) +
119 ! * prmout(3,region)* log(xx) )
120  * prmout(3,code, region)* xx**pw )
121  write(*,*) xx, f
122  xx = xx*10.0**0.02
123  enddo
124  endif
125  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:
Here is the caller 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 129 of file latFit.f.

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

Referenced by fitlat0().

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