Problem in fitting histogram in root

Dear Experts,

I am trying fit a histogram by using exponential function in root. It is giving error as below.

Limitation: Function can not be defined in a command line or a tempfile
You need to write it in a source file
*** Interpreter error recovered ***
root [1]

I am attaching the macro. Please have a look on it and help me to solve it.

Thanks, (1.7 KB)

Remove the very first line (containing “{”).

#include <TChain.h>
#include <TF1.h>
#include <TCut.h>

Hi Coyote,

Yes, It’s working. Many thanks. The fitted plot is coming like as attached. If you see, left side of the histogram is not properly fitted.I want to fit it properly. Could you please tell me how to do it?


Try: h_mm->Fit(fSpectrum, "L"); // "L" or "WL"

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.