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”.


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->SetRangeX(100, 200);

 TVirtualFitter* vFit = fit->GetFitter();

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

May be @moneta can help you.


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



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