Problems with "TVirtualFitter" and "GetFitter()"

Hi, I’m using TVirtualFitter with GetFitter() like below,

“TVirtualFitter* vFit = fit->GetFitter();”

For that line, my ROOT shows me an error like this,

error: cannot initialize a variable of type ‘TVirtualFitter *’ with an rvalue of type ‘ROOT::Fit::Fitter *’

Does anybody know the reason why?

Thank you in advance!

What is the fit variable ?

Thank you! fit was from “TFractionFitter”.

Originally,

TObjArray *DistAll = new TObjArray(50);
for (int i=0;i< 50;i++){
    
    ........
  
    DistAll->Add(Dist[i]);   // "Dist" is the each histogram distributions
  }

TFractionFitter*  fit = new TFractionFitter(Target, DistAll);

for (int i=0;i<50;i++){
    fit->SetMC(i, Dist[i]);
    fit->Constrain(i,0.001,0.8);
  }

  fit->SetRangeX(100, 200);

 TVirtualFitter* vFit = fit->GetFitter();

Then, the last line creates the error as shown above.

May be @moneta can help you.

Hi,

TFractionFitter::GetFitter() returns a ROOT::Fitter object and not a TVirtualFitter.

See
https://root.cern.ch/doc/master/classTFractionFitter.html#a379c2cd2a5ad84d5e19a380874e3db15

Lorenzo

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