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

Go to the source code of this file.

Functions/Subroutines

program tranfit
 
subroutine fittran0 (xin, yin, nbin)
 
subroutine fittran (xin, yin, n, prmin, prmout)
 

Function/Subroutine Documentation

◆ fittran()

subroutine fittran ( 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 156 of file tranFit.f.

References d0, mnexcm(), mninit(), mnparm(), mnseti(), npoint, oparam, tranfnc(), x, and y.

156  implicit none
157  include "Zfit.h"
158  real*8 prmin(nparam), prmout(nparam)
159  integer n
160  real*8 xin(n), yin(n)
161 
162  integer nlabel(nparam)
163  character*10 pname(nparam)
164  real*8 initval(nparam)
165  real*8 step(nparam)
166 
167  data nlabel/ 1, 2, 3, 4, 5/
168  data pname/ 'a', 'x0', 'b', 'c', 'd'/
169  data step/ 1., 0.01d0, 0.1d0, 0.1d0, 0.1d0/
170  real*8 zero, one, three, four, five
171  data zero,one,three,four, five / 0., 1., 3.,4., 5. /
172  real*8 low(nparam), high(nparam)
173  real*8 fval, xx
174  integer i, ierflg
175 
176  external tranfnc
177 
178 c
179 c in fortran mode, this must be called for a new fnc
180 c
181  npoint = n
182  do i = 1, npoint
183  x(i) = xin(i)
184  y(i) = yin(i)
185  enddo
186 
187  do i = 1, nparam
188  initval(i) = prmin(i)
189  enddo
190  low(1) = prmin(1)
191  high(1) = prmin(1)*1.d7
192  low(2) = prmin(2)*0.9
193  high(2) = prmin(2)*1.1
194  low(3) = prmin(3)*0.5
195  high(3) = prmin(3)*2.
196  low(4) = prmin(4)*0.5
197  high(4) = prmin(4)*2.
198  low(5) = prmin(5)*0.5
199  high(5) = prmin(5)*2.
200 
201  call mninit( 5, minout, minsave)
202 
203  do i= 1, nparam
204 c nprm: a number given to a parameter: (label)
205 c pnam: name of the parameer
206 c vstrt: initial value of the parameter
207 c stp: initial step size of the //
208 c next two: zero-->the parameter is not bounded (lower or upper)
209 c ierflg: retrun value; cond code. 0--> ok
210 
211  call mnparm(nlabel(i), pname(i), initval(i), step(i),
212 c * low(i, code), up(i, code), ierflg)
213  * low(i), high(i), ierflg)
214 
215  if (ierflg .ne. 0) then
216  write (0,'(a,i3)') ' unable to define parameter no.',i
217  stop
218  endif
219  enddo
220 c
221  call mnseti('tranfit')
222 c request fcn to read in (or generate random) data (iflag=1)
223 c fcnk0: function to be minimuzed is calculated. also
224 c there are other funcitons
225 c one is the argument to fcnk0. seems to be converted to
226 c integer inside.
227 c 1 number of argument in one (one could be array)
228 c ierflf: ouptut. 0-->ok
229 c 0: no external function is used in fcnk0
230 
231  call mnexcm(tranfnc, 'call fcn', one ,1,ierflg, 0)
232 c fix the 3,4,5-th parameters,
233 c call mnexcm(timefnc,'fix', fixlist ,3, ierflg,0)
234 c print minumum things
235  call mnexcm(tranfnc,'set print', zero ,1,ierflg,0)
236 c use migrad method for minimization
237 c with default condtions
238  call mnexcm(tranfnc,'migrad', zero ,0,ierflg,0)
239 c analysis of errors for all parameters
240  call mnexcm(tranfnc,'minos', zero ,0,ierflg,0)
241 c call fcn with 3. i.e, ouput etc.
242  call mnexcm(tranfnc,'call fcn', three , 1,ierflg, 0)
243 
244  do i = 1, nparam
245  prmout(i) = oparam(i)
246  enddo
247 
subroutine mnexcm(FCN, COMAND, PLIST, LLIST, IERFLG, FUTIL)
Definition: mnexcm.f:25
nodes i
subroutine mnseti(TIT)
Definition: mnseti.f:10
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 tranfnc(npar, gin, f, paramx, iflag)
Definition: tranfnc.f:2
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
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:

◆ fittran0()

subroutine fittran0 ( real*8, dimension(nbin)  xin,
real*8, dimension(nbin)  yin,
integer  nbin 
)

Definition at line 68 of file tranFit.f.

References drx1, drx2, e10, fittran(), from, maxdep, maxleft, maxpos, maxval, op, param, and to.

68  implicit none
69  include "Zfit.h"
70  integer nbin
71  real*8 xin(nbin), yin(nbin)
72  real*8 xuse(nbin), yuse(nbin)
73  real*8 prmout(nparam)
74 
75  integer i
76  integer n1
77  real*8 xx, f, xb, xmax
78  real*8 a, b, c, d, x0
79 
80 
81 
82 
83 c find max pos and use max of
84 c maleft+maxright+1 points
85 c around max.
86 c
87  maxval = yin(1)-1.0e10
88  do i = 1, nbin
89  if(maxval .lt. yin(i)) then
90  maxpos = i
91  maxval = yin(maxpos)
92  endif
93  enddo
94 
95  maxdep = xin(maxpos)
96  from = max(maxpos-maxleft, 1)
97  to = min(maxpos+maxright, nbin)
98 c
99  write(0,*) ' max depth index and depth=', maxpos, maxdep
100  write(0,*) ' layers for fitting are from', from, ' to ', to
101 c a*z**b * exp(-c z **d); z = x/x0
102 c
103  param(1) = yin(maxpos) ! a
104  param(2) = maxdep ! x0
105  param(3) = 10. ! b
106  param(4) = 10. ! c
107  param(5) = 1.0 ! d
108  n1 = 0
109  do i = from, to
110  n1 = n1 + 1
111  xuse(n1) = xin(i)
112  yuse(n1) = yin(i)
113  enddo
114 c
115  call fittran( xuse, yuse, n1, param, prmout)
116 c
117 
118 c to see fitted result
119 
120  a = prmout(1)
121  x0 = prmout(2)
122  b = prmout(3)
123  c = prmout(4)
124  d = prmout(5)
125 
126 c coeff is put on stderr
127  write(0,'(5g12.4)') prmout
128  xmax = x0* (b/c/d)**(1./d)
129  write(0,'("max dep=",g12.3)') xmax
130 
131  if(op .eq. 1) then
132  xx = drx1
133  do while ( xx .le. drx2 )
134  f= a*xx**b *exp(-c*xx**d)
135  write(*,*) xx*x0, f
136  xx = xx*10.0**0.002
137  enddo
138  elseif(op .eq. 2) then
139  write(*,'(5G14.4)') a, b, c, d, x0
140  elseif(op .eq. 3) then
141  write(*,*) xmax, maxdep
142  elseif(op .eq. 4) then
143  write(*,'(7g14.4)') xmax, maxdep, a,b,c,d,x0
144  elseif(op .eq. 5) then
145  write(*,'(7g14.4)') xmax, maxdep, a,b,c,d,x0
146  xx = drx1
147  do while ( xx .le. drx2 )
148  f= a*xx**b *exp(-c*xx**d)
149  write(*,*) xx*x0, f
150  xx = xx*10.0**0.002
151  enddo
152  endif
subroutine fittran(xin, yin, n, prmin, prmout)
Definition: tranFit.f:129
nodes i
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc * maxval
Definition: Zfit.h:15
integer maxright integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc op
Definition: Zfit.h:16
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc maxpos
Definition: Zfit.h:15
integer maxleft
Definition: Zfit.h:1
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc maxdep
Definition: Zfit.h:15
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
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer to
Definition: Zfit.h:15
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
real(4), save a
Definition: cNRLAtmos.f:20
*************************block data cblkTracking *************************implicit none data *ExactThick *Freec *RatioToE0 *MagChgDist *TimeStructure *Truncn *Truncx data *IncMuonPolari *KEminObs *ThinSampling *EthinRatio *Generate *LpmEffect *MagPairEmin e10
Definition: cblkTracking.h:9
real(4), save b
Definition: cNRLAtmos.f:21
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc drx2
Definition: Zfit.h:15
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer from
Definition: Zfit.h:15
dE dx *! Nuc Int sampling table f
Definition: cblkMuInt.h:130
dE dx *! Nuc Int sampling table c
Definition: cblkMuInt.h:130
Here is the call graph for this function:

◆ tranfit()

program tranfit ( )

Definition at line 3 of file tranFit.f.

References copenfw2(), fittran0(), maxleft, op, and true.

Here is the call graph for this function: