Problem with landau fit on root

Hi @alinasoflau,

you should better not use maxVal. This is a more internal function to optimize the MC event generation.

There is not direct way of finding the most probable value (MPV, also called the “mode”) of a RooFit function, but you can easily convert your model to a TF1 with RooAbsReal::asTF and find the MPV with TF1::getMaximumX:

    TF1 * f = model.asTF( canale );
    double canaleMax = f->GetMaximumX(); 

    std::cout << canaleMax << std::endl;

I found this trick in another forum post.

1 Like