_ROOT Version: 5.34/09
_Platform: Linux 3.11.10-100.fc18.x86_64
_Compiler: gcc version 4.7.2 20121109 (Red Hat 4.7.2-8) (GCC)
I am learning to fit peaks in a gamma-ray spectrum obtained with a high-purity germanium detector. I am successfully able to get reasonable fits to several peaks. A code “peaks.C” was of great help in this.
My question now is - How to display the positions (X-coordinate) of the fitted peaks on the Pad itself, just above the peak?
Thank you very much for your suggestion. I tried it, but it is not working. Please find attached code. You will see that I am trying the same thing in two different ways, but neither of them is working.
Below is the log of the command which I used to run the macro.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
root [0] TFile *f = new TFile(“hist.root”);
root [1] .ls
root [2] .L pfit.C++
root [3] pfit(“Addbackspectra00”,450,750);
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I am attaching the macro and “hist.root” for your reference, which contains one histogram. You will see that the macro writes “Ajay” at the desired place but NOT the X-coordinates of the fitted peaks.
The h2->Fit("fit"); call clears the pad and draws everything anew so, any previous TText is gone (note: you can see the “Ajay” TText because it is drawn afterwards so, draw your another “add-ons” after the fit, too).