Dear All,
I am trying to fit two gamma peaks close to each other,
for this I build two gaussian fitting +BG
TF1 *doublegaus= new TF1("doublegaus","([6]*x+[7])+([0]*exp((-0.5*(x-[1])*(x-[1]))/([2]*[2])))+([3]*exp((-0.5*(x-[4])*(x-[4]))/([5]*[5])))",26,38);
doublegaus->SetParameter(0, 10000); //constant1
doublegaus->SetParameter(1, 30); //main1
doublegaus->SetParameter(2, 1); //sigma1
doublegaus->SetParameter(3, 100); //constant2
doublegaus->SetParameter(4, 35); //main2
doublegaus->SetParameter(5, 0.5); //sigma2
doublegaus->SetParameter(6, 0); //BG
doublegaus->SetParameter(7, 1000); //BG
h2_calibrated->Fit(doublegaus,"R0");
doublegaus->SetLineColor(kRed);
doublegaus->Draw("same");
Peak30 around bin number 30, and Peak35 around bin number 35.
the fitting converge
FCN=11138.4 FROM MIGRAD STATUS=CONVERGED 2113 CALLS 2114 TOTAL
EDM=4.33375e-08 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 7.67244e+05 8.79483e+02 3.58009e+01 1.67668e-07
2 p1 2.91784e+01 5.59168e-04 2.76273e-05 -1.94405e-01
3 p2 5.54109e-01 4.64115e-04 1.73015e-05 1.00972e-01
4 p3 1.73060e+05 4.13150e+02 1.72465e+01 6.57766e-08
5 p4 3.34742e+01 1.32726e-03 6.78958e-05 -7.20144e-02
6 p5 -6.04327e-01 1.12626e-03 4.44822e-05 -1.89956e-01
7 p6 -1.71326e+03 1.25736e+01 6.35794e-02 9.97247e-05
8 p7 7.43028e+04 4.39822e+02 2.19156e+00 3.25446e-06
No the sigma for the second peak (p5) has negative value, How this is possible???
one more question, to calculate the total number under the peak I used the integral function. for both the peak range and subtracted the BG integral
for example, to calculate the total number of peak 30.
TF1 *BG= new TF1("BG","([0]*x+[1])",26,38);
BG->SetParameter(0, doublegaus->GetParameter(6));
BG->SetParameter(1, doublegaus->GetParameter(7));
BG->SetLineColor(kOrange);
// BG->Draw("same");
TF1 *Peak30= new TF1("Peak30","([0]*exp((-0.5*(x-[1])*(x-[1]))/([2]*[2])))",26,38);
Peak30->SetParameter(0, doublegaus->GetParameter(0));
Peak30->SetParameter(1, doublegaus->GetParameter(1));
Peak30->SetParameter(2, doublegaus->GetParameter(2));
Peak30->SetLineColor(kRed);
// Peak30->Draw("same");
**double** Peak30_integral2= (Peak30 ->Integral(27,31)/h2_calibrated->GetBinWidth(0))- (BG->Integral(27,31)/h2_calibrated->GetBinWidth(0));
is this correct??
Cheers
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided