Hi @OrangeCat
you may find a minimal working code here:
The key is in line 67,
auto nll = [&](const double *x) {
return likelihood_F(x) - std::log( ROOT::Math::normal_pdf(x[1],sigmaPar, meanPar) ); };
where likelihood_F(x)
is the negative log likelihood estimator, and std::log( ... )
is the constraint.
I am not a great expert, but I suspect that the result might be biased when adding constraints, so please try at least with some synthetic data (where you know the parameters) similar to your experimental data, to crosscheck that your method is still robust and non-biased (check the pulls)
Best,
Alvaro