I’m trying to find a way to track when my fits have a variable reaching a limit. So naturally the Bool_t fLimset from TMinuit seemed like a great flag to use.

But, I have a weird problem. in a situation where I have some parameters reaching a limit (and minuit shows the *at limit* warning). If I fit once, then look at fLimset, it will have a value of 0.

But If I rerun the fit, and then look at the value of fLimset, it will have the correct value of 1.

Below, customGaus is a multiple gaussian TF1, with ParLimits placed on every parameter. There are 14 parameters.

```
histo->Fit(customGaus,"N");
cout << "#IS PAR Reaching Limit? = "<< gMinuit->fLimset << endl;
histo->Fit(customGaus,"N");
cout << "#IS PAR Reaching Limit? = "<< gMinuit->fLimset << endl;
```

This code results in an output to console of:

```
#IS PAR Reaching Limit? = 0
#IS PAR Reaching Limit? = 1
```

Can anyone tell me where I’m going wrong?

Update: I edited the title from “Using fLimset from TMinuit to detect pars hitting l” to “How to detect when parameters are at limit” in the hopes I’ll get an answer.

Thanks