_ROOT Version: 6.17/01
_Platform: linuxx8664gcc
_Compiler: gcc version 8.3.1
Hi,
I am using attached macro to search and then fit transitions in a spectrum resulting from HPGe detector. The macro is same as given in example peaks.C.
I am executing the macro as follows:
TFile *f = new TFile("pFit.root");
.L pfit_bg.C++
pfit_bg("pY_451_his2D_clean",690,720);
This gives the following result:
Found 1 candidate peaks to fit
Found 1 useful peaks to fit
Now fitting: Be patient
FCN=11695.8 FROM MIGRAD STATUS=CONVERGED 185 CALLS 186 TOTAL
EDM=4.35888e-08 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 Area[1] 1.03041e+05 2.27058e+02 1.19814e+01 -2.26166e-07
2 Mean[1] 7.00052e+02 2.37794e-03 3.33811e-04 1.14612e-01
3 Sigma[1] 1.07731e+00 2.06480e-03 1.31165e-04 -3.63132e-02
The problem is that the area given by the macro is: 1.03041e+05. This value is much smaller than one (205821) found from another spectrum analysis tool (gf3 of RADWARE).
Also, cout << pY_451_his2D_clean->Integral(1380,1440) << endl; gives value 211772.
This clearly shows that the area that we get from the fit using the macro is not correct. What is it that I am doing wrong? Please let me know.
But, I am not sure whether that is the elegant way of coding. I am attaching the modified macro. Please let me know if it requires refinements. You can run the macro as follows. The root file can be found in the first post.
TFile *f = new TFile("pFit.root");
.x pfit_bg.C("pY_451_his2D_clean",660,710);
Well, if you need to divide by a value multiple times, there’s nothing better than to retrieve it, assign it to a variable, and use that to scale all other numbers.
[Computationally speaking, it’s better to multiply with the inverse, but that’s only necessary if that part runs billions of times.]