I was introduced to ROOT only in September, and need to use it for a project where I plot data, fit a curve to the data, and integrate the curve from the fit. I found the documentation on fitting graphs, and was unsure if the TGraph::Fit method worked with TMultiGraph (I am plotting multiple data sets on one canvas). If it does work, where can I find the function that results from the fit?
After getting the function from the fit, can I integrate it using the TF1::Integrate function that I found while searching integration methods?
(I hope this isn’t too much to ask)
ROOT Version: 6.26/06 Platform: Windows 11 Compiler: Not Provided
Maybe this is what you want: https://root.cern/doc/v626/classTMultiGraph.html#MG02
If you want to fit each graph separately you can fit them directly (not from the multigraph), as shown also in that page (in “Fit box position”). If you want to retrieve each graph when they are already in the multigraph, you can use GetListOfGraphs, as shown here:
Scroll down to IntegralMultiple() [2/3]; it explains the parameters (in this case, a,b and epsrel mean the same as in Integral); you could also scroll to IntegralOneDim(), which Integral() calls, as it says there, but IntegralOneDim only explains a and b for some reason. You can always click on the link at the line “Definition at line XXX…” to see the code and follow the variables; if you can read the code, sometimes it’s faster.