Logo ROOT  
Reference Guide
No Matches
ConstraintHelpers.cxx File Reference
#include "ConstraintHelpers.h"
#include <RooAbsData.h>
#include <RooAbsPdf.h>
#include <RooConstraintSum.h>
#include <RooMsgService.h>
Include dependency graph for ConstraintHelpers.cxx:


std::unique_ptr< RooAbsRealcreateConstraintTerm (std::string const &name, RooAbsPdf const &pdf, RooAbsData const &data, RooArgSet const *constrainedParameters, RooArgSet const *externalConstraints, RooArgSet const *globalObservables, const char *globalObservablesTag, bool takeGlobalObservablesFromData, bool removeConstraintsFromPdf)
 Create the parameter constraint sum to add to the negative log-likelihood.

Function Documentation

◆ createConstraintTerm()

std::unique_ptr< RooAbsReal > createConstraintTerm ( std::string const &  name,
RooAbsPdf const &  pdf,
RooAbsData const &  data,
RooArgSet const *  constrainedParameters,
RooArgSet const *  externalConstraints,
RooArgSet const *  globalObservables,
const char *  globalObservablesTag,
bool  takeGlobalObservablesFromData,
bool  removeConstraintsFromPdf 

Create the parameter constraint sum to add to the negative log-likelihood.

If there are constraints, returns a pointer to the constraint NLL. Returns a nullptr if the parameters are unconstrained.
[in]nameName of the created RooConstraintSum object.
[in]pdfThe PDF model whose parameters should be constrained. Constraint terms will be extracted from RooProdPdf instances that are servers of the PDF (internal constraints).
[in]dataDataset used in the fit with the constraint sum. It is used to figure out which are the observables and also to get the global observables definition and values if they are stored in the dataset.
[in]constrainedParametersSet of parameters to constrain. If nullptr, all parameters will be considered.
[in]externalConstraintsSet of constraint terms that are not embedded in the PDF (external constraints).
[in]globalObservablesThe normalization set for the constraint terms. If it is nullptr, the set of all constrained parameters will be used as the normalization set.
[in]globalObservablesTagAlternative to define the normalization set for the constraint terms. All constrained parameters that have the attribute with the tag defined by globalObservablesTag are used. The globalObservables and globalObservablesTag parameters are mutually exclusive, meaning at least one of them has to be nullptr.
[in]takeGlobalObservablesFromDataIf the dataset should be used to automatically define the set of global observables. If this is the case and the set of global observables is still defined manually with the globalObservables or globalObservablesTag parameters, the values of all global observables that are not stored in the dataset are taken from the model.
[in]removeConstraintsPdfIf true, the constraints that are extracted from the PDF are removed from the original PDF.

Definition at line 95 of file ConstraintHelpers.cxx.