Hello,
I am currently an undergraduate student and for the past few days I have been trying to fit a single variable function with 5 parameters.
This is for Muon Life Time and we’re using Scintilators. The model we were told to use was:
f(t)= Background + N1exp(-t/tau1) +N2exp(-t/tau2)
I wrote:
Fitter=new TF1(“Chi-it”,"[0]+ [1] * TMath::Exp(-(x/[2])) + [3] * TMath::Exp(-(x/[4]))",leftbound,rightbound);
I wrote a Monte Carlo Simulation to check how I would do this fit.
Here’s what I’ve tried:
- Use my “Fitter” as:
myhist->Fit(“Chi-it”);
So far, the resulting value is highly dependent on initially set parameters of my Fitter.
The “Perfect Fit” is when my tau1=tau2 and N1=N2, so I am really fitting one exponential function.
Ratio between N1 and N2 is supposed to be close to 1:9.
Also, often the chi-squared minimization fails to converge
2)As I am generating a uniform random Background,
N1 type events and N2 type events.
I keep them in individual arrays and have three separate histograms then set 3 different TF1 and get their parameters and insert them(FixParameter) in my Fitter.
Minimization of chi-squared value fails to converge if I generate over 10,000,000 events.
FitBack=new TF1(“Background”,"[0]",leftbound,rightbound);
Fitone=new TF1(“India”,"[0]*TMath::Exp(-x/[1])",leftbound,rightbound);
Fitone1=new TF1(“India1”,"[0]*TMath::Exp(-x/[1])",leftbound,rightbound);
//Puc=Ionization Count, Test2=Background Count, Test3=muon
Puc.Draw();
Puc.Fit(“India”);
Can3.cd(2);
Test2.Draw();
Test2.Fit(“Background”);
Can3.cd(3);
Test3.Draw();
Test3.Fit(“India1”);
- if I use the parameters successfully found from 2), the resulting Guided Fitter with Fixed Parameters make a great fit and N1:N2 is comparable to 1:9.
Guided.FixParameter(0,Test2.GetFunction(“Background”).GetParameter(0) );
Guided.FixParameter(1,Puc.GetFunction(“India”).GetParameter(0));
Guided.FixParameter(2,Puc.GetFunction(“India”).GetParameter(1));
Guided.FixParameter(3,Test3.GetFunction(“India1”).GetParameter(0));
Guided.FixParameter(4,Test3.GetFunction(“India1”).GetParameter(1));
When I am analyzing the real data, I won’t have the separate “background”, “signal from ionization” or “signal from muon” data. I am going to use the parameters found from 2) as a guidance (SetParameter) to fit my real data.
A slight problem: If I do exactly what I stated in 3) on another set of simulated data, once again either minimization fails to converge or Single exponential function is fitted.
I could use an advice on how to proceed.
Thank you for your time
-SJL