Re: [ROOT] problem plotting function

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Oct 22 2004 - 09:28:34 MEST


David,

see: http://root.cern.ch/root/htmldoc/TF1.html

and look at the section;
 WHY TF1 CANNOT ACCEPT A CLASS MEMBER FUNCTION ?

Rene brun

BORRAS David wrote:
> 
> Hi Rootters,
> 
> I have written a code in FML_Minuit where i minimize a unbinned likelihood
> method. In this code i define a class MyFunction where i implement the
> function to be used in fitter. This function is the convolution between
> exponential and gaussian function. To do this i use functions from CLHEP
> package (AnalyticConvolution.hh).
> I would like only plot this function convolution and i write some "root
> line" for that.
> here is :
> 
> // Here is the name of my class
> MyFunction f;
> 
> ....some treatments
> 
> //To run root
> TApplication theApp(...)
> // create the canvas for plot
> TCanvas *vc ...
> 
> and here is my problem :
> TF1 *f1 = new TF1("fct","f",xmin,xmax);
> f1->Draw();
> 
> The code compile fine, but when i execute it, i have the following message
> :
> "bad numerical expression "f".The function fct/f has 0 parameters instead
> of 1."
> 
> The canvas appears fine and i only have a line in it.
> Is my problem come from the fact that my function is a member of my
> defined class or i make something wrong in the code ?
> 
> Cheers, David
> *************************************************
> *  David Borras                                 *
> *  PhD Student                                  *
> *************************************************
> *  Laboratoire de Physique Corpusculaire (LPC)  *
> *  IN2P3/CNRS                                   *
> *  Universite Blaise Pascal                     *
> *  24 avenue des Landais                        *
> *  63177 Aubiere Cedex                          *
> *                                               *
> *  tel : 04 73 40 72 77 (work)                  *
> *  mail: borras@clermont.in2p3.fr               *
> *************************************************



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET