1
2
3
4
5
6
7
8
9 package org.lcsim.fit.line;
10
11
12
13
14 public class SlopeInterceptLineFit
15 {
16 private double _slope;
17 private double _intercept;
18 private double _sigA;
19 private double _sigB;
20 private double _sigAB;
21 private double _chisq;
22 private int _ndf;
23
24
25
26
27
28
29
30
31
32
33
34
35 public SlopeInterceptLineFit(double slope, double intercept, double slopeUncertainty, double interceptUncertainty, double sigAB, double chisq, int ndf)
36 {
37 _slope = slope;
38 _intercept = intercept;
39 _sigA = interceptUncertainty;
40 _sigB = slopeUncertainty;
41 _sigAB = sigAB;
42 _chisq = chisq;
43 _ndf = ndf;
44 }
45
46
47
48
49
50 public double slope()
51 {
52 return _slope;
53 }
54
55
56
57
58
59 public double slopeUncertainty()
60 {
61 return _sigB;
62 }
63
64
65
66
67
68 public double intercept()
69 {
70 return _intercept;
71 }
72
73
74
75
76
77 public double interceptUncertainty()
78 {
79 return _sigA;
80 }
81
82
83
84
85
86 public double covariance()
87 {
88 return _sigAB;
89 }
90
91
92
93
94
95 public double chisquared()
96 {
97 return _chisq;
98 }
99
100
101
102
103
104 public int ndf()
105 {
106 return _ndf;
107 }
108
109 public String toString()
110 {
111 StringBuffer sb = new StringBuffer("SlopeInterceptLineFit: \n");
112 sb.append("slope= "+_slope+" +/- "+_sigB+" intercept= "+_intercept+" +/- "+_sigA+" cov: "+_sigAB+ "\n");
113 sb.append("chi-squared for "+_ndf+" degrees of freedom is "+_chisq);
114 return sb.toString();
115 }
116 }