I’m not sure if It’s the right place to ask this question.

I’m trying to write a TF2 function for integration purposes. It is something like this:

```
Integral = \int_0^umx du u f(u) \int_fmin(u)^fmax(u) dE crossection(E)
```

If the energy integral had some fix limits, I could just create the TF2 and integrate on those limits. The problem here is that for each u I’ll have different boundaries for the energy function.

I could write it in python like this:

```
def integrand(E,u):
fu = fCrossInterp(u)
integrand = crossSection(element, m_A, E) * u * fu
return integrand
# Calculate the intersection uInt of eMin and eMax given a specific rIndex
uInt = EminEmaxIntersection(element, m_X)
uLow = 0
uHigh = min(uInt, V_gal)
eLow = lambda u: eMin(u, m_X)
eHigh = lambda u: eMax(element, m_X, u)
integral = integrate.dblquad(integrand, uLow, uHigh, eLow, eHigh)[0]
return integral
```

Sadly, I can’t use python since the code here will be used to generate some events for a geant4 simulation. In this case, is there anything similar to solve this for a TF2 function or anyother thing in cling?

Worst case scenario, I’ll turn it in a numerical integration.

Anyway, thanks in advance.

Bests.