Hi @ynikitenko!
You can get the normalization integral and then divide the coefficients by it to get the actual coefficients of the normalized pdf.
I have prepared a little demo to show how to do this, comparing also with the analytical Chebychev polynomials:
double cheby_t2(double x, double a0, double a1, double a2) {
double t0 = 1;
double t1 = x;
double t2 = 2*x*t1 - t0;
return a0 * t0 + a1 * t1 + a2 * t2;
}
void demo() {
RooRealVar x("x", "x", 0, 10);
x.setBins(10);
RooRealVar a1("a1", "a1", 0.5, 0., 1.);
RooRealVar a2("a2", "a2", 0.0, 0., 1.);
RooChebychev cheb("cheb", "Background", x, RooArgSet(a1, a2));
RooArgSet normSet{x};
std::unique_ptr<RooAbsReal> chebIntegral{cheb.createIntegral(normSet)};
double normVal = chebIntegral->getVal();
double a0Val = 1./normVal;
double a1Val = a1.getVal()/normVal;
double a2Val = a2.getVal()/normVal;
std::cout << "norm : " << normVal << std::endl;
std::cout << "a0 : " << a0Val << std::endl;
std::cout << "a1 : " << a1Val << std::endl;
std::cout << "a2 : " << a2Val << std::endl;
// To compare with analytical Chebychev as cross check:
for (int i = 0; i < x.numBins(); ++i) {
x.setBin(i);
double xScaled = 2. * (x.getVal() - x.getMin()) / (x.getMax() - x.getMin()) - 1.;
double ref = cheby_t2(xScaled, a0Val, a1Val, a2Val);
std::cout << i << " : x=" << x << " roocheb=" << cheb.getVal(normSet) << " ref=" << ref << std::endl;
}
}
Here is the output:
------------------------------------------------------------------
| Welcome to ROOT 6.35.01 https://root.cern |
| (c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for linuxx8664gcc on Jan 01 1980, 00:00:00 |
| From heads/master@v6-35-01-1714-g978479d9c9 |
| With g++ (GCC) 14.2.1 20241116 |
| Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
root [0]
Processing demo.C...
norm : 10
a0 : 0.1
a1 : 0.05
a2 : 0
0 : x=0.5 roocheb=0.055 ref=0.055
1 : x=1.5 roocheb=0.065 ref=0.065
2 : x=2.5 roocheb=0.075 ref=0.075
3 : x=3.5 roocheb=0.085 ref=0.085
4 : x=4.5 roocheb=0.095 ref=0.095
5 : x=5.5 roocheb=0.105 ref=0.105
6 : x=6.5 roocheb=0.115 ref=0.115
7 : x=7.5 roocheb=0.125 ref=0.125
8 : x=8.5 roocheb=0.135 ref=0.135
9 : x=9.5 roocheb=0.145 ref=0.145
root [1]
About the documentation: the reference guide is not updated for a long time, and we wonât do that anymore.
Maybe you have suggestions to update the reference guide instead, or the RooFit tutorials?
Cheers,
Jonas