Creating a TF1 with a User Function

I am trying to draw a line along a function so called Bethe Bloch function but I got error.
Can anyone help me to figure out this?___

histogram_draw.cpp (4.2 KB)

This is the error

Your function is not correctly declared. See the example here:
https://root.cern/doc/master/classTF1.html#F4

Thanks for your reply. Can you please tell me what is wrong there. Thanks once again.

Same function I used for another purpose and that work fine there.

Try with:
TF1 protons("protons", "BetheBloch(x)", 0.75, 2.15);

/home/haradhan/histogram_draw.cpp:74:42: error: use of undeclared identifier ‘x’
TF1 protons(“protons”,BetheBloch(x),-0.75,2.15);

Please excuse me. I am new in root user. It still show error.

Yes I did , what you said

Thanks. Its work now.

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