# How to integral my pdf in ROOFIT

Hi ,rooters,
I am a new rootfit user, What I want to obtain is a g(x) by integrate variable y of f(x,y), which is too complex to get it by MATHEMATICA or by manual calculation.
And the g(x) is my Pdf.
I would appreciate it if anyone could give me some examples about roofit integrate pdf.

Best regards,
hurricane

Hi, rooters,
I want to fit my 1-d histogram with custom function. What bothers me is that my functions are too complex to define in ROOT or ROOFIT.

Here is a function about variable X0 Y0

f1(X0,Y0) = u(X0,Y0)*yy(X0,Y0)*yy(X0,Y0)/((1+u(X0,Y0))^3)/sqrt(1-xx(X0,Y0)*xx(X0,Y0)-yy(X0,Y0)*yy(X0,Y0))

where

u(X0,Y0)=(2* b* X0+k * a * a+sqrt((2 * X0 * b+k * a * a)^2-4*(a * a+b * b)(X0 * X0+Y0 * Y0)))/(2(a * a+b * b))

a = 1e-4
b = 0.1
k = 0.86

xx(X0,Y0) = (X0-k/2*b)/(k/2 * sqrt(a * a+b * b))

yy(X0,Y0) = Y0/(k/2*a)

My fit function(in other words,my Pdf in roofit) can be obtained by integral Y0 in range(-4e-4,4e-4) of f1(X0,Y0) , so we can obtain a TF1 about X0.

About the integral process, I am very confused and I have nowhere to start…

Best regards,
hurricane

Hi,
What do you mean your function is too complex to be defined in ROOT ?
You should be able to write your function as a class, define it as a functor object and then you can use the Integrator class of ROOT, or use it via the TF1 interface.
So the first step is defining your function as C++ code. Of course it can use an Integrator inside to compute the internal integrals

Lorenzo

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