67 for (
k = 0;
k <=
nbs;
k++) {
71 for (
k = sample_min;
k <= sample_max;
k++) {
114 double xki2, dif, difmx, deglib;
117 deglib = (double)nmxul - 4.;
118 for (
i = 0;
i < nmxul;
i++) {
126 for (
k = 0;
k < 4;
k++) {
127 for (
l = 0;
l < 4;
l++) {
129 for (
i = 0;
i < nmxul;
i++) {
135 for (
i = 0;
i < nmxul;
i++) {
142 for (
k = 0;
k < 4;
k++) {
144 for (
l = 0;
l < 4;
l++) {
150 if (parom[3] == 0.) {
159 for (
i = 0;
i < nmxul;
i++) {
161 h = parom[0] + parom[1] *
t[
i] + parom[2] *
t2 + parom[3] *
t2 *
t[
i];
162 dif = (
adc[
i] -
h) * mask[
i];
163 xki2 = xki2 + dif * dif *
errmat[
i][
i];
169 xki2 = xki2 / deglib;
171 delta = parom[2] * parom[2] - 3. * parom[3] * parom[1];
174 tm = -(
delta + parom[2]) / (3. * parom[3]);
175 tmp = (
delta - parom[2]) / (3. * parom[3]);
183 parom[5] = parom[0] + parom[1] * tm + parom[2] * tm * tm + parom[3] * tm * tm * tm;
197 printf(
"ERROR : trying to use TSFit::inverms with size %d( max allowed %d\n",
n,
matdim);
202 memset((
char *)
al, zero, 8 *
n *
n);
203 memset((
char *)
be, zero, 8 *
n *
n);
214 for (
i = 1;
i <
n;
i++) {
216 for (
j = 1;
j <=
i;
j++) {
218 for (
k = 0;
k <=
j - 1;
k++) {
229 be[0][0] = 1. /
al[0][0];
230 for (
i = 1;
i <
n;
i++) {
232 for (
j = 0;
j <
i;
j++) {
235 for (
k =
jj + 1;
k <=
i;
k++) {
242 for (
i = 0;
i <
n;
i++) {
243 for (
j = 0;
j <
n;
j++) {
245 for (
k = 0;
k <
n;
k++) {
280 for (
i = 0;
i <
nbs;
i++) {
283 if (bdc[
i] > val_max) {
289 if ((val_max * val_max) *
errmat[imax][imax] < 16.)
298 double val2 = val_max / 2.;
299 double val3 = val_max / 2.;
305 if ((bdc[
i] < val3) && (
i < imax))
327 int number_of_good_samples = 0;
328 for (
i = ilow;
i <= ihig;
i++) {
335 number_of_good_samples++;
340 if (number_of_good_samples < 4) {
352 if (amp * amp *
errmat[0][0] < 2.)
367 if ((tm < (
double)ilow) || (tm > (
double)ihig)) {
371 if ((
tmp > (
double)ilow) && (
tmp < (
double)ihig - 1.)) {
377 ret_dat[2] = val_max;
378 ret_dat[3] = (double)imax;
379 ret_dat[4] = (double)ilow;
380 ret_dat[5] = (double)ihig;
381 ret_dat[6] = (double)
tmp;
383 for (
i = 0;
i < 4;
i++) {