Get the value of the fitting function at a given x in RooFit

Hi everyone,

I fit a distribution of variable “x” with Cristal Ball funtion by using Roofit (using RooCBShape). How can I get value of the fitting function at a given value of “x” in RooFit?

Thank you for your help.
Cheers,
Viet Nga

Hi Viet

I am not an expert, but what works is to turn the pdf into a fine-binned histogram, normalize it to your dataset, and then evaluate the histogram at any given value:

TH1D* hist=pdf->createHistogram(“hist”,x,Binning(100000));
hist->Scale(data->sumEntries()/hist->Integral());
double val=hist->GetBinContent(hist->FindBin(xvalue));

Cheers
Jana