Problem with root compilation

Hello,

when I try to compile this macro it gives me two errors why? If you can help me let me know, Thanks.

EDIT: is it possible to pass numeric values ​​from the keyboard (argv, arc)? Do you know how to do it?

fit.C (636 Bytes)

The hyphen character in “->” on the SetParameters line is invalid.
Erase it and retype a real “-”.

Also, “2PI” doesn’t exist,

TF1 *Fit_Gauss= new TF1("Gauss","[0]*exp(-0.5*((x-[1])/[2])^2)/([2]*sqrt(2PI))",0.,MAX);

should be:

TF1 *Fit_Gauss= new TF1("Gauss","[0]*exp(-0.5*((x-[1])/[2])^2)/([2]*sqrt(2*TMath::Pi()))",0.,MAX);

2PI doesn’t exist, indeed.
FYI, here is the list of mathematical constants defined by <math.h>:
https://www.gnu.org/software/libc/manual/html_node/Mathematical-Constants.html

now in compilation,the terminal says use of undeclared identifier ‘Fit_Gauss­’ why?

another question: is it possible to pass parameters to ROOT with the functions argv, arc? If yes, can you tell me how? Thank you.

Can you post again the macro you have now ?

fit.C (684 Bytes)

fit.C (664 Bytes)

I didn’t understand … what is my mistake?

In your file you have --> instead of ->
I fixed it in the version I posted.
Does the version I posted works for you ?

Yes, finally ROOT compiles correctly!

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