50 double B_NEW = (a_new+b_new)/2;
61 double firstG1 = ((2*(a_new-2*B_NEW+(
m-
m1))*
s1)/exp((a_new-(
m-
m1))*(a_new-(
m-
m1))/(2*
s1*
s1)) - (2*(b_new-2*B_NEW+(
m-
m1))*
s1)/exp((b_new-(
m-
m1))*(b_new-(
m-
m1))/(2*
s1*
s1))+ sqrt(2*TMath::Pi())*((B_NEW-(
m-
m1))*(B_NEW-(
m-
m1)) +
s1*
s1)*TMath::Erf((-a_new+(
m-
m1))/(sqrt(2)*
s1)) - sqrt(2*TMath::Pi())*((B_NEW-(
m-
m1))*(B_NEW-(
m-
m1)) +
s1*
s1) * TMath::Erf((-b_new+(
m-
m1))/(sqrt(2)*
s1)))/(2*sqrt(2*TMath::Pi()));
62 double secondG1 = (((2*
s1*(a_new*a_new + B_NEW*B_NEW + a_new*(
m-
m1) + (
m-
m1)*(
m-
m1) - 2*B_NEW*(a_new+(
m-
m1)) + 2*(
s1*
s1)))/exp((a_new-(
m-
m1))*(a_new-(
m-
m1))/(2*(
s1*
s1))) - (2*
s1*(b_new*b_new + B_NEW*B_NEW + b_new*(
m-
m1) + (
m-
m1)*(
m-
m1) - 2*B_NEW*(b_new + (
m-
m1)) + 2*(
s1*
s1)))/exp((b_new - (
m-
m1))*(b_new - (
m-
m1))/(2*(
s1*
s1))) - sqrt(2*TMath::Pi())*(-((B_NEW - (
m-
m1))*(B_NEW - (
m-
m1)) *(
m-
m1)) + (2*B_NEW - 3*(
m-
m1))*(
s1*
s1))*TMath::Erf((-a_new + (
m-
m1))/(sqrt(2)*
s1)) + sqrt(2*TMath::Pi())* (-((B_NEW - (
m-
m1))*(B_NEW - (
m-
m1))*(
m-
m1)) + (2*B_NEW - 3*(
m-
m1))*(
s1*
s1)) *TMath::Erf((-b_new + (
m-
m1))/(sqrt(2)*
s1)))/(2 *sqrt(2*TMath::Pi())));
63 double CURVEG1 = fabs((1-
csi)*secondG1 + (b_new*
csi - a_new)*firstG1);
67 double firstG2 = ((2*(a_new-2*B_NEW+(
m-
m2))*
s2)/exp((a_new-(
m-
m2))*(a_new-(
m-
m2))/(2*
s2*
s2)) - (2*(b_new-2*B_NEW+(
m-
m2))*
s2)/exp((b_new-(
m-
m2))*(b_new-(
m-
m2))/(2*
s2*
s2))+ sqrt(2*TMath::Pi())*((B_NEW-(
m-
m2))*(B_NEW-(
m-
m2)) +
s2*
s2)*TMath::Erf((-a_new+(
m-
m2))/(sqrt(2)*
s2)) - sqrt(2*TMath::Pi())*((B_NEW-(
m-
m2))*(B_NEW-(
m-
m2)) +
s2*
s2) * TMath::Erf((-b_new+(
m-
m2))/(sqrt(2)*
s2)))/(2*sqrt(2*TMath::Pi()));
68 double secondG2 = (((2*
s2*(a_new*a_new + B_NEW*B_NEW + a_new*(
m-
m2) + (
m-
m2)*(
m-
m2) - 2*B_NEW*(a_new+(
m-
m2)) + 2*(
s2*
s2)))/exp((a_new-(
m-
m2))*(a_new-(
m-
m2))/(2*(
s2*
s2))) - (2*
s2*(b_new*b_new + B_NEW*B_NEW + b_new*(
m-
m2) + (
m-
m2)*(
m-
m2) - 2*B_NEW*(b_new + (
m-
m2)) + 2*(
s2*
s2)))/exp((b_new - (
m-
m2))*(b_new - (
m-
m2))/(2*(
s2*
s2))) - sqrt(2*TMath::Pi())*(-((B_NEW - (
m-
m2))*(B_NEW - (
m-
m2)) *(
m-
m2)) + (2*B_NEW - 3*(
m-
m2))*(
s2*
s2))*TMath::Erf((-a_new + (
m-
m2))/(sqrt(2)*
s2)) + sqrt(2*TMath::Pi())* (-((B_NEW - (
m-
m2))*(B_NEW - (
m-
m2))*(
m-
m2)) + (2*B_NEW - 3*(
m-
m2))*(
s2*
s2)) *TMath::Erf((-b_new + (
m-
m2))/(sqrt(2)*
s2)))/(2 *sqrt(2*TMath::Pi())));
69 double CURVEG2 = fabs((1-
csi)*secondG2 + (b_new*
csi - a_new)*firstG2);
73 double firstG3 = ((2*(a_new-2*B_NEW+(
m-
m3))*
s3)/exp((a_new-(
m-
m3))*(a_new-(
m-
m3))/(2*
s3*
s3)) - (2*(b_new-2*B_NEW+(
m-
m3))*
s3)/exp((b_new-(
m-
m3))*(b_new-(
m-
m3))/(2*
s3*
s3))+ sqrt(2*TMath::Pi())*((B_NEW-(
m-
m3))*(B_NEW-(
m-
m3)) +
s3*
s3)*TMath::Erf((-a_new+(
m-
m3))/(sqrt(2)*
s3)) - sqrt(2*TMath::Pi())*((B_NEW-(
m-
m3))*(B_NEW-(
m-
m3)) +
s3*
s3) * TMath::Erf((-b_new+(
m-
m3))/(sqrt(2)*
s3)))/(2*sqrt(2*TMath::Pi()));
74 double secondG3 = (((2*
s3*(a_new*a_new + B_NEW*B_NEW + a_new*(
m-
m3) + (
m-
m3)*(
m-
m3) - 2*B_NEW*(a_new+(
m-
m3)) + 2*(
s3*
s3)))/exp((a_new-(
m-
m3))*(a_new-(
m-
m3))/(2*(
s3*
s3))) - (2*
s3*(b_new*b_new + B_NEW*B_NEW + b_new*(
m-
m3) + (
m-
m3)*(
m-
m3) - 2*B_NEW*(b_new + (
m-
m3)) + 2*(
s3*
s3)))/exp((b_new - (
m-
m3))*(b_new - (
m-
m3))/(2*(
s3*
s3))) - sqrt(2*TMath::Pi())*(-((B_NEW - (
m-
m3))*(B_NEW - (
m-
m3)) *(
m-
m3)) + (2*B_NEW - 3*(
m-
m3))*(
s3*
s3))*TMath::Erf((-a_new + (
m-
m3))/(sqrt(2)*
s3)) + sqrt(2*TMath::Pi())* (-((B_NEW - (
m-
m3))*(B_NEW - (
m-
m3))*(
m-
m3)) + (2*B_NEW - 3*(
m-
m3))*(
s3*
s3)) *TMath::Erf((-b_new + (
m-
m3))/(sqrt(2)*
s3)))/(2 *sqrt(2*TMath::Pi())));
75 double CURVEG3 = fabs((1-
csi)*secondG3 + (b_new*
csi - a_new)*firstG3);
81 double firstG4 = ((2*(a_new-2*B_NEW+(
m-
m4))*
s4)/exp((a_new-(
m-
m4))*(a_new-(
m-
m4))/(2*
s4*
s4)) - (2*(b_new-2*B_NEW+(
m-
m4))*
s4)/exp((b_new-(
m-
m4))*(b_new-(
m-
m4))/(2*
s4*
s4))+ sqrt(2*TMath::Pi())*((B_NEW-(
m-
m4))*(B_NEW-(
m-
m4)) +
s4*
s4)*TMath::Erf((-a_new+(
m-
m4))/(sqrt(2)*
s4)) - sqrt(2*TMath::Pi())*((B_NEW-(
m-
m4))*(B_NEW-(
m-
m4)) +
s4*
s4) * TMath::Erf((-b_new+(
m-
m4))/(sqrt(2)*
s4)))/(2*sqrt(2*TMath::Pi()));
82 double secondG4 = (((2*
s4*(a_new*a_new + B_NEW*B_NEW + a_new*(
m-
m4) + (
m-
m4)*(
m-
m4) - 2*B_NEW*(a_new+(
m-
m4)) + 2*(
s4*
s4)))/exp((a_new-(
m-
m4))*(a_new-(
m-
m4))/(2*(
s4*
s4))) - (2*
s4*(b_new*b_new + B_NEW*B_NEW + b_new*(
m-
m4) + (
m-
m4)*(
m-
m4) - 2*B_NEW*(b_new + (
m-
m4)) + 2*(
s4*
s4)))/exp((b_new - (
m-
m4))*(b_new - (
m-
m4))/(2*(
s4*
s4))) - sqrt(2*TMath::Pi())*(-((B_NEW - (
m-
m4))*(B_NEW - (
m-
m4)) *(
m-
m4)) + (2*B_NEW - 3*(
m-
m4))*(
s4*
s4))*TMath::Erf((-a_new + (
m-
m4))/(sqrt(2)*
s4)) + sqrt(2*TMath::Pi())* (-((B_NEW - (
m-
m4))*(B_NEW - (
m-
m4))*(
m-
m4)) + (2*B_NEW - 3*(
m-
m4))*(
s4*
s4)) *TMath::Erf((-b_new + (
m-
m4))/(sqrt(2)*
s4)))/(2 *sqrt(2*TMath::Pi())));
83 double CURVEG4 = fabs((1-
csi)*secondG4 + (b_new*
csi - a_new)*firstG4);
86 return fabs(
f1*CURVEG1)+ fabs(
f2*CURVEG2)+ fabs(
f3*CURVEG3) + fabs((1-
f1-
f2-
f3)*CURVEG4);