It is implemented as:
RooAddition constrSum("add","add", RooArgList(*f_WZLL,*f_WZLT,*f_WZTL,*f_WZTT));
RooRealVar targetSum("target", "target", 1.00);
RooRealVar constrStrength("strength","strength", 0.005); // Can adjust impact of constraint here
RooGaussian constraint("constraint","constraint", constrSum, targetSum, constrStrength);
...
const RooArgList constraintset(constraint);
return pdf->fitTo(*data, ExternalConstraints(constraintset), Save(),
SumW2Error(false),//PrintLevel(-1),// Warnings(false),
Minimizer("Minuit2", "minimize"),Strategy(2),//Offset(true),
Hesse(true),Minos(true),//PrintEvalErrors(-1),
Extended(true));//,NumCPU(5)); Range()
I tested this for different values of “constrStrength”. For 1 i obviously get poor values and large uncertainties. For 0.1 and 0.01 i get slightly off values and decent uncertainties. For values even smaller i get the errors above.
I know that Non-differentiable functions are bad for this. However i do need pretty hard constrains for that because that is the physics behind this that the fraction can not be negative and i want to reproduce the results of the fit using “mus” where this is all true by default. So i would need a very strong constraint on the Sum of the remaining fractions to be lower than 1.
Some results from the different fits:
mu fit:
mu=0.9165+0.5137-0.5545
muLT=1.7416+5.2248-1.7416
muTL=1.0054+4.7772-1.0054
muTT=0.905+0.1962-0.1967
fit with 3 fraction parameters (f_TT removed)(nominal values recalculated from Ntot and f_X values)
mu=0.9157
muLT=1.7414
muTL=1.0142
muTT=0.9037
fit with 3 fraction parameters (f_LTremoved)(nominal values recalculated from Ntot and f_X values)
mu=0.9113
muLT=1.8804
muTL=0.888
muTT=0.8986
fit with 4 fraction parameters (gauss constraint on Sum=1 with strength=0.008)(nominal values recalculated from Ntot and f_X values)
mu=0.9376
muLT=1.3251
muTL=1.1847
muTT=0.9124
(1-Sum of fractions=-0.0001)
We can see that using the 3 Parameter fit removing f_TT gives results very close to the mu fit(i would still like them to agree more to be honest) but that the one where i remove LT gives fairly worse results. The one with the gaussian constraint also gives significantly worse values compared to the nominal fit.
For the first fraction fit it might be enough to increase the fit precision a bit (can that be done?) while for the second one i think the Sum(3 fractions)<1 is necessary. For the last one i do not know what to do.