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 56 of file latFit.f.

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

56  implicit none
57  include "Zlatfit.h"
58  integer cond
59  integer nbin, code, tcode
60  real*8 xin(nbin), yin(nbin)
61  real*8 xuse(nbin), yuse(nbin)
62  real*8 prmout(nparam, 4, nregion)
63 
64  integer i
65  integer n1, n2, region
66  real*8 xx, f, xb
67 
68 c fitting at region
69  do region=1, nregion
70 c if(tcode .eq. 3 .and. region .eq. 4) then
71 c pw = 0.5 ! %pw% <--this %pw% is needed blanks/ = /
72  ! Used by mkLDD/Util/Lat/
73 c else
74 c pw = 0.5
75 c endif
76 
77  n1 =0
78  do i = 1, nbin
79  if(xin(i) .gt. x2(region) ) exit
80  if(xin(i) .lt. x1(region) ) cycle
81  n1 = n1 +1
82  xuse(n1) = xin(i)
83  yuse(n1) = yin(i)
84  enddo
85 c////////////
86 c write(0,*) ' region=',region, ' points=', n1
87 c write(0,*) ' param(1,region)=', param(1, region)
88 c write(0,*) ' param(2,region)=', param(2, region)
89 c write(0,*) ' param(3,region)=', param(3, region)
90 c//////////
91 c region, x, y, #, output param
92  call fitlat1(region, code, xuse, yuse, n1,
93  * param(1, code, region), prmout(1, code,region))
94 
95  if(cond .eq. 1) then
96 c only coeff. is put on stdout
97  write(*,'(5g12.4)') prmout(1, code,region),
98  * prmout(2,code, region),
99  * prmout(3, code, region), prmout(4,code, region),
100  * maxdiff
101 c if(code .eq. 2) then
102 cc for hadron, region 1 is mssing so we repeat region 2 data
103 c write(*,'(3g12.4)')
104 c * prmout(1, region), prmout(2, region), prmout(3, region)
105 c endif
106  else
107 c coeff is put on stderr
108  write(0,'(5g12.4)') prmout(1,code, region),
109  * prmout(2, code, region),
110  * prmout(3, code, region), prmout(4, code,region),
111  * maxdiff
112  endif
113  if(cond .eq. 0) then
114 c to see fitted result (r, t) is put on stdout
115  xx = drx1( region)
116  pw = prmout(4,code, region)
117  do while ( xx .le. drx2(region) )
118  f=prmout(1,code,region)/
119  * xx**(prmout(2,code, region) +
120 c * prmout(3,region)* log(xx) )
121  * prmout(3,code, region)* xx**pw )
122  write(*,*) xx, f
123  xx = xx*10.0**0.02
124  enddo
125  endif
126  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 130 of file latFit.f.

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

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