80{
81 double sumx, sumx2, sumx3, sumx4,sumy, sumyx, sumyx2, det;
82 float chi;
83
84
85
86
87 long i;
88
89 chi = 99999999.0;
90 *a = 0; *b = 0; *c = 0;
91 *half = 0;
92
93
95 {
96
97 return -1;
98 }
99
100
101 sumx = 0.0;
102 sumx2 = 0.0;
103 sumx3 = 0.0;
104 sumx4 = 0.0;
105 sumy = 0.0;
106 sumyx = 0.0;
107 sumyx2 = 0.0;
108
109
110
111 for (i = 0; i <
n; i++)
112 {
113 sumx = sumx + w[i] *
x[i];
114 sumx2 = sumx2 + w[i] *
x[i] *
x[i];
115 sumx3 = sumx3 + w[i] *
x[i] *
x[i] *
x[i];
116 sumx4 = sumx4 + w[i] *
x[i] *
x[i] *
x[i] *
x[i];
117 sumy = sumy + w[i] * y[i];
118 sumyx = sumyx + w[i] * y[i] *
x[i];
119 sumyx2 = sumyx2 + w[i] * y[i] *
x[i] *
x[i];
120
121
122 }
123
124
125
126
127
128 HepMatrix D(3,3,1);
129 HepMatrix
C(3,1),
ABC(3,1);
130 D(1,1) = sumx4; D(1,2) = D(2,1) = sumx3; D(1,3) = D(3,1) = D(2,2) = sumx2;
131 D(3,2) = D(2,3) = sumx; D(3,3) =
n;
132 C(1,1) = sumyx2;
C(2,1) = sumyx;
C(3,1) = sumy;
133
134 int ierr;
135 ABC = (D.inverse(ierr))*
C;
136
140
141
142 float center = *b/(-2*(*a));
143 float mean_x;
144 for(i = 0; i <
n; i++){
146 }
147
148 if(mean_x > center) *half = 2;
149 else *half = 1;
150
151
152
153
154 chi = 0.0;
156 {
157 chi = chi+(w[i])*((y[i])-*a*(x[i])-*b)*
158 ((y[i])-*a*(
x[i])-*b);
159 }
160
161
162
163
164 *chisq = chi;
165 return 1;
166}
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations C