Compile problem with TF1 and Math/ParamFunctor.h

Hi all,

Similar to http://root.cern.ch/phpBB2/viewtopic.php?t=7212, I have a problem where I get the error

However, this is the only error I get.

The offending function is in a class implementation file, which is as follows

#include "TF1.h"

class Particle
{
...
    void GetDecayTime()
...
};

double Particle::GetDecayTime()
{
	double time;
	double max = 10.0*this->lifetime;
	TF1 *fdecay = new TF1("decay","exp(-1.0*x/[0])",0.0,max,1);
	fdecay->SetParameter(0,this->lifetime);
	time = fdecay->GetRandom();
	delete fdecay;
	time = time*(1/(6.582E-25));
	return time;
}

It’s not the most difficult code, and it compiles outside of the class, so I am unsure why the function breaks when instanstiated inside a class.

ttfn

Alex

Hi,

your signature for creating the TF1 is not correct, when you use a formula string you don;t have to pass the parameters and you must just do:

TF1 *fdecay = new TF1("decay","exp(-1.0*x/[0])",0.0,max);

Best Regards

Lorenzo

Oops, sorry! Mea culpa :wink:

compiles fine now.