root_function_DoubleSidedCB="""

double DoubleSidedCB2(double x, double mu, double width, double a1, double p1, double a2, double p2)
{
  double u   = (x-mu)/width;
  double A1  = TMath::Power(p1/TMath::Abs(a1),p1)*TMath::Exp(-a1*a1/2);
  double A2  = TMath::Power(p2/TMath::Abs(a2),p2)*TMath::Exp(-a2*a2/2);
  double B1  = p1/TMath::Abs(a1) - TMath::Abs(a1);
  double B2  = p2/TMath::Abs(a2) - TMath::Abs(a2);

  double result(1);
  if      (u<-a1) result *= A1*TMath::Power(B1-u,-p1);
  else if (u<a2)  result *= TMath::Exp(-u*u/2);
  else            result *= A2*TMath::Power(B2+u,-p2);
  return result;
}


double SingleCBLeft(double x, double mu, double sig, double a1, double p1)
{
  double u   = (x-mu)/sig;
  double A1  = TMath::Power(p1/TMath::Abs(a1),p1)*TMath::Exp(-a1*a1/2);
  double B1  = p1/TMath::Abs(a1) - TMath::Abs(a1);

  double result(1);
  if      (u<-a1) result *= A1*TMath::Power(B1-u,-p1);
  else  result *= TMath::Exp(-u*u/2);
  return result;
}

double SingleCBRight(double x, double mu, double sig,  double a2, double p2)
{
  double u   = (x-mu)/sig;
  double A2  = TMath::Power(p2/TMath::Abs(a2),p2)*TMath::Exp(-a2*a2/2);
  double B2  = p2/TMath::Abs(a2) - TMath::Abs(a2);

  double result(1);
  if (u<a2)  result *= TMath::Exp(-u*u/2);
  else            result *= A2*TMath::Power(B2+u,-p2);
  return result;
}

"""


root_function_RightSidedCB="""

double RightSidedCB(double x, double mu, double width, double a1, double p1)
{
  double u   = (x-mu)/width;
  double A2  = TMath::Power(p1/TMath::Abs(a1),p1)*TMath::Exp(-a1*a1/2);
  double B2  = p1/TMath::Abs(a1) - TMath::Abs(a1);

  double result(1);
  if (u<a1)  result *= TMath::Exp(-u*u/2);
  else       result *= A2*TMath::Power(B2+u,-p1);
  return result;
}



"""



root_function_Pol2 ="""

double Pol2(double x, double a1, double a2)
{
  
  double result = 1+ a1*x +a2*x*x; 
  return result;
}
"""
