2DAlphabet  2.0
Background modeling framework
ParametricFunction Class Reference
Inheritance diagram for ParametricFunction:
Collaboration diagram for ParametricFunction:

Public Member Functions

def __init__ (self, name, binning, formula, constraints={}, forcePositive=True)
 Represents parametric functions as a group of RooFormulaVars which create a binned distribution and which change as the underlying function parameters change. More...
 
def getNparams (self)
 Get the number of parameters in the formula (not counting "x" or "y"). More...
 
def mappedBinCenter (self, xbin, ybin, cat)
 Convert global x and y bin to values in center of bins where the axis has been mapped to range [0,1]. More...
 
def setFuncParam (self, parIdx, value)
 Set the value of a given. More...
 
- Public Member Functions inherited from Generic2D
def __init__ (self, name, binning, forcePositive=True)
 Constructor. More...
 
def Add (self, name, other, factor='1')
 Add self with other. More...
 
def Divide (self, name, other)
 Divide self by other. More...
 
def getBinVal (self, xbin, ybin)
 Get bin value (for the current parameter values) in bin (xbin, ybin). More...
 
def getBinVar (self, xbin, ybin, c='')
 Get the bin variable associated with (xbin,ybin). More...
 
def Multiply (self, name, other)
 Multiply self with other. More...
 
def RooParametricHist (self)
 Produce a RooParametricHist2D filled with this object's binVars. More...
 

Public Attributes

 arglist
 
 formula
 
 nuisances
 
- Public Attributes inherited from Generic2D
 binArgLists
 Dict mapping of the subspaces (LOW, SIG, HIGH) to the RooArgList of the RooAbsArgs in the subspace. More...
 
 binning
 Binning object. More...
 
 binVars
 Ordered dictionary of all RooAbsArgs representing the bins of the space. More...
 
 forcePositive
 Option to ensure bin values cannot be negative. More...
 
 name
 Unique name of object which will be prepended to all associated RooFit objects. More...
 
 nuisances
 All tracked nuisance dictionaries. More...
 
 rph
 Dict mapping of the subspaces (LOW, SIG, HIGH) to the RooParametricHist2D objects of the subspaces. More...
 

Private Member Functions

def _createFuncVars (self, constraints)
 Creates the nuisances list of the function variables (RooRealVars) and associated meta data (nuisance name, constraint). More...
 
def _replaceXY (self, x, y)
 Find and replace "x" and "y" in the input formula with this method's arguments (floats) which should correspond to bin centers. More...
 

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  name,
  binning,
  formula,
  constraints = {},
  forcePositive = True 
)

Represents parametric functions as a group of RooFormulaVars which create a binned distribution and which change as the underlying function parameters change.

Set parameter specific values by specifying the constraints argument with a dict formatted as

{0: {
'constraint': 'flatParam' or 'param <mu> <sigma>'
'MIN' = -1000
'MAX' = 1000
'NOM' = 0
'ERROR' = 0.1
} }

The 'constraint' can only be 'flatParam' or 'param <mu> <sigma>' (options in the Combine card) which represent "no constraint" and "Gaussian constraint centered at <mu> and with width <sigma>", respectively.

Parameters
name(str): Unique name for the new object.
formula(str): Must reference fit parameters by ordinal with . Use "x" and "y" to represent the "x" and "y" axes of the space. All other terms are indexed starting at 0. Ex. "@0 + x*@1 +y*@2".
constraints(dict, optional): Map of formula parameters to constraint information. Defaults to {} in which case the constraint will be flat, the starting value of the parameter will be 0 with a step size of 0.1, and the range of the parameter will be [-1000,1000].
forcePositive(bool, optional). Defaults to True in which case the bin values will be lower bound by 1e-9.

Member Function Documentation

◆ _createFuncVars()

def _createFuncVars (   self,
  constraints 
)
private

Creates the nuisances list of the function variables (RooRealVars) and associated meta data (nuisance name, constraint).

Parameters
constraintsInformation of which parameters to constrain differently from the default. By default, the constraint will be flat, the starting value of the parameter will be 0 with a step size of 0.1, and the range of the parameter will be [-1000,1000].
Returns
list List of dictionaries with keys "name" (str), "obj" (RooRealVar), "constraint" (str).

◆ _replaceXY()

def _replaceXY (   self,
  x,
  y 
)
private

Find and replace "x" and "y" in the input formula with this method's arguments (floats) which should correspond to bin centers.

Parameters
xValue along x axis to evaluate.
yValue along y axis to evaluate.
Returns
str Formula with "x" and "y" replaced by provided numerical values.

◆ getNparams()

def getNparams (   self)

Get the number of parameters in the formula (not counting "x" or "y").

Converts the formula formating and uses ROOT's TFormula to count.

Returns
int Number of parameters in the fit (not counting "x" or "y").

◆ mappedBinCenter()

def mappedBinCenter (   self,
  xbin,
  ybin,
  cat 
)

Convert global x and y bin to values in center of bins where the axis has been mapped to range [0,1].

Parameters
xbinX axis bin number.
ybinY axis bin number.
Returns
tuple of floats: x and y values, respectively.

◆ setFuncParam()

def setFuncParam (   self,
  parIdx,
  value 
)

Set the value of a given.

Parameters
parIdxParameter index to access.
valueValue to assign.
Exceptions
RuntimeErrorIf the parameter could not be found.
Returns
None

The documentation for this class was generated from the following file: