COSMOS v7.655  COSMOSv7655
(AirShowerMC)
mnpfit.f
Go to the documentation of this file.
1 *
2 * $Id: mnpfit.F,v 1.1.1.1 1996/03/07 14:31:31 mclareni Exp $
3 *
4 * $Log: mnpfit.F,v $
5 * Revision 1.1.1.1 1996/03/07 14:31:31 mclareni
6 * Minuit
7 *
8 *
9  SUBROUTINE mnpfit(PARX2P,PARY2P,NPAR2P,COEF2P,SDEV2P)
10 *
11 * $Id: d506dp.inc,v 1.1.1.1 1996/03/07 14:31:32 mclareni Exp $
12 *
13 * $Log: d506dp.inc,v $
14 * Revision 1.1.1.1 1996/03/07 14:31:32 mclareni
15 * Minuit
16 *
17 *
18 *
19 *
20 * d506dp.inc
21 *
22 C ************ DOUBLE PRECISION VERSION *************
23  IMPLICIT DOUBLE PRECISION (a-h,o-z)
24 C
25 C to fit a parabola to npar2p points
26 C
27 C npar2p no. of points
28 C parx2p(i) x value of point i
29 C pary2p(i) y value of point i
30 C
31 C coef2p(1...3) coefficients of the fitted parabola
32 C y=coef2p(1) + coef2p(2)*x + coef2p(3)*x**2
33 C sdev2p= variance
34 C method : chi**2 = min equation solved explicitly
35  dimension parx2p(npar2p),pary2p(npar2p),coef2p(npar2p)
36  dimension cz(3)
37 C
38  DO 3 i=1,3
39  3 cz(i)=0.
40  sdev2p=0.
41  IF(npar2p.LT.3) GO TO 10
42  f=npar2p
43 C--- center x values for reasons of machine precision
44  xm=0.
45  DO 2 i=1,npar2p
46  2 xm=xm+parx2p(i)
47  xm=xm/f
48  x2=0.
49  x3=0.
50  x4=0.
51  y=0.
52  y2=0.
53  xy=0.
54  x2y=0.
55  DO 1 i=1,npar2p
56  s=parx2p(i)-xm
57  t=pary2p(i)
58  s2=s*s
59  x2=x2+s2
60  x3=x3+s*s2
61  x4=x4+s2*s2
62  y=y+t
63  y2=y2+t*t
64  xy=xy+s*t
65  x2y=x2y+s2*t
66  1 CONTINUE
67  a=(f*x4-x2**2)*x2-f*x3**2
68  IF(a.EQ.0.) GOTO 10
69  cz(3)=(x2*(f*x2y-x2*y)-f*x3*xy)/a
70  cz(2)=(xy-x3*cz(3))/x2
71  cz(1)=(y-x2*cz(3))/f
72  IF(npar2p.EQ.3) GOTO 6
73  sdev2p=y2-(cz(1)*y+cz(2)*xy+cz(3)*x2y)
74  IF(sdev2p.LT.0.) sdev2p=0.
75  sdev2p=sdev2p/(f-3.)
76  6 cz(1)=cz(1)+xm*(xm*cz(3)-cz(2))
77  cz(2)=cz(2)-2.*xm*cz(3)
78  10 CONTINUE
79  DO 11 i=1,3
80  11 coef2p(i)=cz(i)
81  RETURN
82  END
nodes z
nodes i
struct ob o[NpMax]
Definition: Zprivate.h:34
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
nodes a
subroutine mnpfit(PARX2P, PARY2P, NPAR2P, COEF2P, SDEV2P)
Definition: mnpfit.f:10
dE dx *! Nuc Int sampling table h
Definition: cblkMuInt.h:130
nodes t
block data include Zlatfit h c fitting region data x2(1)/0.5/data x1(2)/0.3/
dE dx *! Nuc Int sampling table f
Definition: cblkMuInt.h:130