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

Go to the source code of this file.

Functions/Subroutines

subroutine timefnc (npar, gin, f, paramx, iflag)
 

Function/Subroutine Documentation

◆ timefnc()

subroutine timefnc ( integer  npar,
real*8, dimension(*)  gin,
real*8  f,
real*8, dimension(*)  paramx,
integer  iflag 
)

Definition at line 2 of file timefnc.f.

References chisq, npoint, oparam, x, and y.

Referenced by fittime1().

2  implicit none
3  include "Zfit.h"
4 * npar: input. number of current variable parameters
5 * gin: optional output of gradient
6 * f: output. function value to be minimized
7 * paramx: input. vector of const and variable parameters
8 * iflag: input. depending on this value, what to do
9 * is determined.
10 * 1--> some preparation for computing f
11 * 2--> compute gin
12 * 3--> fittng finished
13 * for all other cases: we must compute f
14 *
15  integer npar
16  real*8 gin(*)
17  real*8 f
18  real*8 paramx(*)
19  integer iflag
20 c
21  integer i
22  real*8 fval, xx
23  save
24  if (iflag .eq. 1) then
25 c write(0,*) 'current npar=',npar, ' npoint=',npoint
26 c write(0,*) ' param=',(paramx(i), i=1,npar)
27  endif
28  if(iflag .eq. 2 ) then
29  write(0,*) ' no grad computed'
30  stop
31  endif
32 c compute f
33 
34  chisq = 0.
35  do i= 1, npoint
36  fval = paramx(1)*
37  * x(i)**(paramx(2) + paramx(3)*log(x(i)))
38 c chisq= chisq + (fval-y(i))**2
39 c if(y(i) .lt. 3.) then
40 c chisq= chisq + ( fval/y(i) - 1.0 )**2
41 c else
42 c chisq= chisq + ( y(i)/fval - 1.0 )**2
43 c chisq= chisq + ( fval/y(i) - 1.0 )**2
44  chisq= chisq + (fval-y(i))**2/y(i)
45 c endif
46  enddo
47  f = chisq
48 
49  if(iflag .eq. 3) then
50 c do i = 1, npoint
51 c fval = paramx(1)*x(i)**(paramx(2) +
52 c write(*,*) x(i), y(i), fval
53 c enddo
54  do i = 1, npar
55  oparam(i) = paramx(i)
56  enddo
57  endif
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real * chisq
Definition: Zfit.h:15
nodes i
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
integer maxbin nregion c minsave drx2 ! drawing region real maxdep integer maxpos integer op real x1h common Zfitc * oparam
Definition: Zfit.h:15
! 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
dE dx *! Nuc Int sampling table f
Definition: cblkMuInt.h:130
Here is the caller graph for this function: