Question about multiFit

Dear all,

I would have a question concerning an application of the multifit macro that we find in the tutorial.
Basically, I would have a TGraphErrors where I want to fit two linear functions in two separate ranges, and then to fit them together as a multifit.

Here is the code I adapted from the tutorial:

[code]
Double_t par[4];
TF1 *g1 = new TF1(“g1”,“pol1”,0,50);
TF1 *g2 = new TF1(“g2”,“pol1”,50,500);
TF1 *total = new TF1(“total”,“pol1(0)+pol1(2)”,0,500);
g1->FixParameter(0,0.);
total->SetLineColor(2);

gre->Fit(g1,“R”);
gre->Fit(g2,“R+”);
g1->GetParameters(&par[0]);
g2->GetParameters(&par[2]);
total->SetParameters(par);
total->FixParameter(0,0.);
gre->Fit(total,“R+”);[/code]

However, I only get reasonable results for the single fits. When I do the “total” fit, I only get a straight line cutting my data, and not two linear trends.
Is there something wrong?

Thank you,

best regards

Hi,

it’s really hard to judge without a full reproducer.
Can you provide one?

Cheers,
Danilo