Re: TF2 with member method of a given class instance (this)

From: Lorenzo Moneta <Lorenzo.Moneta_at_cern.ch>
Date: Thu, 15 Jul 2010 19:37:28 +0200


Hi Robert,

 You don't need to have TreeWalk static. You can do directly by doing:

TF2 * f2 = new TF2( ptr_TreeWalk, &TreeWalk::DoLikelihoodFitPoissonMinimize, xmin, xmax, ymin, ymax, npar, "TreeWalk","DoLikelihoodFit");

 This is documented in http://root.cern.ch/root/htmldoc/TF1.html#F5

Cheers, Lorenzo
On Jul 15, 2010, at 5:44 PM, Philippe Canal wrote:

> Hi Robert,
> 
> If 'TreeWalk' is a class you also need to declare this function as static.
> 
> Cheers,
> Philippe.
> 
> On 7/15/10 7:37 AM, Robert Riemann wrote:

>> Hi rooters,
>>
>> I am trying to re-use my member function, which was initially ment to
>> work with ROOT::Match::Functor, but I don't how to get TF2 working
>> with it.
>> Is it possilble at all to use TF2 with member functions?
>>
>> Using with Functor:
>>
>> ROOT::Math::Functor f(this,TreeWalk::DoLikelihoodFitPoissonMinimize,2);
>>
>> Signature:
>>
>> Double_t DoLikelihoodFitPoissonMinimize(const double* xval) const;
>>
>> I think I have to create a wrapper function to fit the expected
>> signature of TF2:
>>
>> Double_t TreeWalk::DoLikelihoodFitPoissonMinimizeSep(double* x, double* y) {
>> Double_t xval[2] = {
>> *x,
>> *y
>> };
>> return DoLikelihoodFitPoissonMinimize(xval);
>> };
>>
>>
>> it would be nice to get some hints to get it finally working.
>>
>> Best Regards,
>> Robert
>>
>>

> Received on Thu Jul 15 2010 - 19:37:37 CEST

This archive was generated by hypermail 2.2.0 : Sat Jul 17 2010 - 11:50:01 CEST