currently i’ve a few connected “problems” while using Roofit.
My initial situation is that there are 3 distributions which i’m fitting with 3 different RooGenericPdfs (3 parameters each). Afterwards i want to fit a global distirubtion that is the sum of the ones fitted before while the goal is to get their fractions. Therefore i’m defining another 3 RooGenericPdfs using the before fitted parameters as RooRealVar in combination with getVal (they should be assumed as constant but not as variables - perhaps first critical point). My next step it to add two of these Pdfs using RooAddPdf and after that adding the sum to the third one. This full sum is now fitted to the global distribution and i can calculate the fraction by expanding
a * afunc + (1-a) [ b * bfunc + (1-b) * cfunction ]
The gymnastic using twice RooAddPdf is done because the coefficients should not be negative and their sum has to be 1. Now coming to the “problems”:
1/ The errors of the final fractions A,B and the resulting C are tiny most likely because the secondly defined Pdfs assume that the variables entering as RooRealVar have no error, but they should be assumed as constant and not be taken into account at all in the error calculation.
2/ It’s obvious that i would prefer something like Aafunc + Bbfunc + C*cfunc , but i was not able to do this or to find the corresponding option. My last approach was using another “global” RooGenericPdf that already includes the ones defined on the second step before (so this has 9 parameters/constants from getval, 3 parameters as fractions and one “x”-like parameter). This is working fine including the x parameter, 2 fraction parameters and 6 constants but after adding only one more parameter/constant/whatever i got a segmentation fault and the complain that RooGenericPdf is not longer “defined in that scope”.
Any ideas/suggestions? Please let me know if you need further information or the explanation is too complicated. Since the code is a few hundret lines i don’t want to post here if it’s not really needed.
Many thanks in advance for your help!