TF1Convolution (TF1* Constructor) does not update parameter values

Hi,

ROOT 6.18 seems to have an issue updating TF1Convolution objects constructed from defined TF1 objects. Partly taken from the fitConvolution.cxx tutorial, here is a MWE:

Double_t FExpo(Double_t* x, Double_t* p){
  return p[0]*TMath::Exp(-p[1]*x[0]);
}

Double_t FGaus(Double_t* x, Double_t* p){
  return p[0]*TMath::Gaus(x[0],0,p[1],true);
}

TF1* F1 = new TF1("Gaus",FGaus,-1,6,2)
TF1* F2 = new TF1("Expo",FExpo,-1,6,2)
TF1Convolution *f_conv = new TF1Convolution(F1,F2,-1,6,true);
    f_conv->SetRange(-1.,6.);
    f_conv->SetNofPointsFFT(1000);
    TF1   *f = new TF1("f",f_conv, 0., 5., f_conv->GetNpar());
  f->SetParameters(1.,-0.3,0.,1.);

If you draw f, you will see that the parameters have not updated from 0, nor will changing them again or calling Update on any of the objects fix this… I need to define my own TF1 objects this way since I’m convolving a Cauchy (lorentzian) distribution with an exponentially modified gaussian.

I recently updated from 6.10.08 where this worked.


ROOT Version: 6.18/00
Platform: linuxx8664gcc
Compiler: Provided


Hi Spencer,
thank you for the nice report!

@moneta, our TF1 expert, is currently on holidays. We’ll try to check your reproducer as soon as possible. If you don’t hear anything in a few days, please ping us again here!

Cheers,
Enrico

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

Hi,

I see the parameters are changed when setting them. You have to be careful in the way setting the parameters and doing the convolution. Also I recommend you yo set the exponential function to zero outside the range, otherwise there is an issue with the FFT convolution.
Attached is a working example

Lorenzo

rootTalk
_35022.C|attachment
(560 Bytes)