Problems with finding minimum values

Hi,
I’m not very experienced with Root analysis.
After studying laser diffraction from a slit I represent the pattern obtained with the TGraph. Is there a way to find all the local minima of the experimental points?
Thanks.

Hi,

We don’t have in ROOT a specific algorithm for this. What we have is a function , TF1::GetMinimumX(min,max) to find the minimum of a function in the range [min,max].
From a TGraph you can create a TF1 early using a lambda function:

TF1 * f = new TF1("f",[&](double*x, double *p){ return graph->Eval(x[0]); }, xmin, xmax, 0); 

An alternative/complementary possibility is to use the TSpectrum class and its function to search for peaks.
You can use the peak positions as range for looking for the minima.
See https://root.cern.ch/doc/v608/classTSpectrum.html#a5f8b7b208f813670259b51a8bcdcbfc5

Lorenzo

2 Likes

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