I have a fit, where two parameters should be constrainted by functions …
I mean the the parameters (p1, p2) have to fullfill the
min < f(p1, p2) < max constraint for every p1, p2.
(like, for example, moving the parameters within a circular ring only
(Rmin < sqrt(p1p1 + p2p2) < Rmax))
how to do it?
The particluar problem is the following:
I fit simultaneosly two histograms: one is filled with the invariant mass of particles, the other is with the energy of the same particles. I am looking for a peak on the invariant mass spectrum (I dont know where!!) and in the same time a peak in the energy spectrum (these two spectra are projections of a 2D spectrum (invariant mass vs energy). The hope that the peak (if it exists) on the invariant mass spectrum will form some structure on the energy spectrum, too.).
The complication is coming when I want to do these fits after a momentum cut!
Plotting the mentioned 2D histo with momentum limits results “arches” on the 2D histos. and I have to check that the peaks on the projections corresponds to a place within these arches.
unfortunately in ROOT we don’t have any implementation of constrained minimization algorithm. Only simple constraints on the parameters are supported in ROOT, like a < par < b where a and b are fixed number (not function of parameters).
If you can re-parametrize your problem, by a parameter transformation, to end-up in constraints like those then you can solve it in ROOT.
Otherwise you have to use software from another package.
See wiki.mcs.anl.gov/NEOS/index.php/ … ware_Guide
for a list of existing minimization/optimization software.
Thank you for your answer,
I started to implement one way to short-cut this problem.
The implementation is on the way, so if there is a general problem with it please tell it to me:
I am using VirtulaFitter, and in the fcn-function I implement the specific requirement for the constraints:
if(p_low < momcul(p1, p2) && momcut(p, p2) < p_high)
chi2 = _chi2; /// the calculated chi2
chi2 = 10e6; // any big number
If I understand it correctly for every parameter-vector this fcn function will be called, so in every step the constraints could be treated right …
I wont have time in the next 2-3 days to finish the implementation …
Do you see any problem with it?
This might work as far as your minimum is not too close to the border region. There, Minuit might have some problems computing the derivatives. It is however worth to try