<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Fitting Example
Step1:  Inject into the interpreter the functions.
Step2:  Construct the histogram containing the input data
Step3:  Create the function and try to fit it without setting any parameter. Activate the interactive visualisation with %jsroot on. 
Remember that in order to embed a plot in a notebook, you'll need to create a TCanvas and draw it explicitly.
Step4:  Less than optimal. Set parameters and fit again, draw histogram with error bars
Step5:  Much better. Now time to beautify the plot. Construct a TF1 for the background and Lorentzian functions and draw them in the same canvas.
We save the fit results and set the parameters of the functions accordingly
Step6:  We can now add a legend
<ASSISTANT_TASK:>
Python Code:
import ROOT
Explanation: Fitting Example
End of explanation
%%cpp -d
//Define functions for fitting 
// Quadratic background function
double background(double *x, double *par) {
  return par[0] + par[1]*x[0] + par[2]*x[0]*x[0];
}
// Lorenzian Peak function
double lorentzianPeak(double *x, double *par) {
  return (0.5*par[0]*par[1]/TMath::Pi()) /
    TMath::Max(1.e-10,(x[0]-par[2])*(x[0]-par[2])
    + .25*par[1]*par[1]);
}
// Sum of background and peak function
double fitFunction(double *x, double *par) {
  return background(x, par) + lorentzianPeak(x, &par[3]);
}
Explanation: Inject into the interpreter the functions.
End of explanation
# Your code here
Explanation: Construct the histogram containing the input data
End of explanation
# Your code here
Explanation: Create the function and try to fit it without setting any parameter. Activate the interactive visualisation with %jsroot on. 
Remember that in order to embed a plot in a notebook, you'll need to create a TCanvas and draw it explicitly.
End of explanation
# Your code here
Explanation: Less than optimal. Set parameters and fit again, draw histogram with error bars
End of explanation
# Your code here
Explanation: Much better. Now time to beautify the plot. Construct a TF1 for the background and Lorentzian functions and draw them in the same canvas.
We save the fit results and set the parameters of the functions accordingly
End of explanation
# Your code here
Explanation: We can now add a legend
End of explanation
<END_TASK>