Skip to content

Bug when using a Convolution in TF1 the second time with a different range #8252

@lmoneta

Description

@lmoneta

When using the CONV operator in TF1 with a different range, but re-using the same function, the new range is not used correctly.
This code shows the problem:

auto f1 = new TF1("f1","CONV(ROOT::Math::breitwigner_pdf(x,[1],[0]),gaus)",0,10);
f1->SetParameters(5,1,1,0,1); 
f1->Draw();    // this is ok
// do convolution in a different range
auto f2 = new TF1("f2","CONV(ROOT::Math::breitwigner_pdf(x,[1],[0]),gaus)",10,20);   
 f2->SetParameters(15,1,1,0,1);
 f2->Draw();  // WRONG result because it performs convolution in 0,10 instead of 10,20

This problem has been reported in https://root-forum.cern.ch/t/fitting-histograms-convolution/44973/7

A simple workaround is just to call:

f2-SetRange(10,20); 

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions