18 f=
log(t+2.5)-
log(t-50+2.5);
28 for(i=0;i<120;i++)
conve[i]=0.0;
39 void convolution(
float *xleft_a,
float *xleft_b,
float *min_left,
float *xright_a,
float *xright_b,
float *min_right,
float *pTime){
43 float sum_y_left=0.0,sum_y_right=0.0,sum_xy_left=0.0,sum_xy_right=0.0;
44 float a_left=0.0,a_right=0.0,b_left=0.0,b_right=0.0,chi2_left=0.0,chi2_right=0.0,chi_left=0.0,chi_right=0.0;
45 float aleft=0.0,aright=0.0,bleft=0.0,bright=0.0;
49 for(i=0;i<119;i++)
conv[l][i]=0.0;
57 min_l=9999999999999999.0;
58 min_r=9999999999999999.0;
67 float time1=-999.0, time2=-999.0, time3=-999.0;
68 float data1=-999.0, data2=-999.0, data3=-999.0;
75 data1=
conv[1][imax-1];
77 data3=
conv[1][imax+1];
79 peakTime=(0.5)*((time1*time1*(data3-data2)+time2*time2*(data1-data3)+time3*time3*(data2-data1))/(time1*(data3-data2)+time2*(data1-data3)+time3*(data2-data1)))*6.25;
82 for(i=0;i<119;i++)
conv[l][i]=
conv[l][i]/max;
86 for (
int j=0; j<119; j++){
87 if (
conv[1][j]>0.6) nobs++;
102 sum_xy_left += i*cross0;
109 bleft = ((nobs*sum_xy_left) - (sum_x * sum_y_left))/((nobs*sumx2) - (sum_x*
sum_x));
110 bright = ((nobs*sum_xy_right) - (sum_x * sum_y_right))/((nobs*sumx2) - (sum_x*
sum_x));
112 aleft = ((sum_y_left*sumx2)-(sum_x*sum_xy_left))/((nobs*sumx2)-(sum_x*
sum_x));
113 aright = ((sum_y_right*sumx2)-(sum_x*sum_xy_right))/((nobs*sumx2)-(sum_x*
sum_x));
116 chi2_left += (cross0 -(aleft+(bleft*
i)))*(cross0 -(aleft+(bleft*i)));
117 chi2_right += (cross2 -(aright+(bright*
i)))*(cross2 -(aright+(bright*i)));
134 b_right = bright/6.25;
136 a_left = aleft + (bleft*peakTime/6.25);
137 a_right = aright + (bright*peakTime/6.25);
141 *min_left = chi2_left;
144 *min_right = chi2_right;
auto cross2(V1 x, V2 y) -> typename std::remove_reference< decltype(x[0])>::type
float elec(float t, float vs)
void convolution(float *xleft_a, float *xleft_b, float *min_left, float *xright_a, float *xright_b, float *min_right, float *pTime)
int sum_x
More diagnostics.