I want to sweight some distribution with a pdf that contains Gaussian-constraints in the model, so in my nominal fit (independent of the sWeight calculation) I have an
RooFit::ExternalConstraints( *gaussconstr )
in my fitTo-function. As I see in the sPlot class, there, the pdf is just fitted back without the external constraints, so the fit function will find different yields (and indeed, the sum of sWeights is not equal to the number of signal events I find in my nominal fit).
Is it somehow possible to add these ExternalConstraints to the fitting in the sPlot class? As a quick workaround I thought about just adding this argument to the fitTo-function by myself. Would this be an option, or will I run into problems doing this?
I also thought about using internal constraints, but don’t I then also need to modify the fitTo?
As in the tutorial about constraints:
// M E T H O D 1 - A d d i n t e r n a l c o n s t r a i n t t o m o d e l
// -------------------------------------------------------------------------------------
// Multiply constraint term with regular p.d.f using RooProdPdf
// Specify in fitTo() that internal constraints on parameter f should be used
Or am I missing something? Indeed, it would be easier to do something without the hack I thought about, so I would be happy about a different solution.
EDIT:
Oh, I see that this update will only be released in ROOT 6.20. It’s coming very soon, but in the mean time, you can use ROOT’s development version from here: https://root.cern/nightlies