In this equation, the variable of integration is Egamma.
I have plotted the functions Txl and Rho(Ex-Eg,J) as graphs as a function of energy. Using these graphs, I plan to interpolate and extract the values for these functions at all values of Eg from 0 to Emax.

How do I within a user defined function, set the parameters for the equation defined above??

I just can’t figure out a way to set the parameter within a user defined - such that it always sets its value as a interpolation from a TGraph.
And then integrate the full function for all values of energy.

Hi,
For integrating you need to create a TF1 or just a simple C++ functor object that you give as input to the ROOT::Math::IntegratorOneDim class. If you want to parametrize the integrand function better using a TF1. How did you implement Txl(E) and Rho(E) functions ? Are functions or graphs ?
If there are functions it is easy to create a new functions which is the product of the two. See the different way of creating a TF1 here.
If there are represented as TGraph objects and you evaluate them with TGraph::Eval, you can still do as following:

Hi,
integFunction is defined as a function of x. You can do for example integFunction(1.) or integFunction(2.). ig is an instance of the Integrator class which is built passing the C++ object. It takes an argument an object implementing the ROOT::Math::IGenFunction interface, and for this you need to wrap the functor integFunction in that interface. This is done using the ROOT::Math::Functor1D class.
After building the integrator you just call : ig.Integral(0,Emax).

The integFunction - is defined as a function of x, which is basically energy ranging from 0 to ExCurrent. These are also the limits for the integration.
Does the above snippet work that way?
integFunction will be evaluated for all values of x between 0 to ExCurrent and then the same will be fed into the integration and the integral to be calculated.

Sorry, if my question is naive. I haven’t used C++ Functor previously.