Integrating a data set non-equally spaced

Dear all,

I have a data set of points(Xi,Yi) and I want to integrate them. The points are non-equally spaced in Xi and I tried to use TGraph::Integral() but it didn’t work, the result is quite different the result I expected. Does anyone know a way to integrate them?

Thanks in advance,

Manuel

Hi Manuel,

the Integral function of TGraph* does not do exactly what you wanted as it returns the area of the polygon enclosed by the graph.
What you can do is to calculate the area of the trapezoids defined by the x axis and point pairs.

Cheers,
Danilo

root.cern.ch/root/html/TGraph.ht … h:Integral