The above issue is resolved.
Now I am facing another issue which is following:
I am using the attached macro which is perfect for doing calibration.
eff_1.C (1.7 KB)
This macro is finding the position of all the peaks and marking the energy for every peak.
Till now everything is perfect.
The problem arises when I need to fit all the peaks and calculate the area for each peak. I know how to calculate the area of a peak using the following command:
TF1 *f = new TF1("f", "gausn(0) + pol1(3)", 0., 1.); // linear background f->SetRange(395, 420.); f->SetParameters(5e+4, 407., 2., 1200., 0., 0.); h->Fit(f, "ILR+"); // e.g. "ILR+" or "IR+" or "LR+" or "R+"
But what I want is that if I again use this method then I have to write this command (Set Range and Parameters)again and again to find the area of peaks at different positions.
Even if I write down for all the eight peaks. Still I am fine. I have no problems.
Again when I change the histogram in the macro from CL02_E1 to CL02_E2 what I have to take care
- Threshold for finding all the peaks.(which is not a big issue)
- I have to set the parameters and set the range for all the peaks again and again.
The whole process becomes so cumbersome.
Is there any way that one can find the area of all the peaks without setting range and parameters every time if one knows the mean position of every peak??