Commit a1523825 authored by Keerthi Nakkalil's avatar Keerthi Nakkalil
Browse files

The initial values to the fitting parameters assigned properly using...

The initial values to the fitting parameters assigned properly using FindLastBinAbove() and GetBinCenter().
parent 4f1c14a2
......@@ -20,9 +20,25 @@ void gain_measurement()
modified_erf->SetParNames("constant","mean","noise");
modified_erf->SetParameter(1,hist_255->GetMean());
modified_erf->SetParameter(2,hist_255->GetRMS());
modified_erf->SetParLimits(0,200,250.0);
// Seeting the initial values for the fit parameters
modified_erf->SetParameter(0,200.0);
double lastbin1 = hist_255->FindLastBinAbove(200);
double mean = hist_255->GetBinCenter(lastbin1);
cout<<"The initial mean value assigned is : "<<mean<<std::endl;
modified_erf->SetParameter(1,mean);
double lastbin2 = hist_255->FindLastBinAbove(150);
double lastbin3 = hist_255->FindLastBinAbove(50);
double sigma = lastbin3 -lastbin2;
cout<<"The initial noise assigned is :"<<sigma<<std::endl;
modified_erf->SetParameter(2,sigma);
//Fitting histogram
modified_erf->SetLineWidth(2);
modified_erf->SetLineColor(2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment