2DAlphabet  2.0
Background modeling framework
Generic2D Class Reference

Wraps binned distributions in a common type so that distributions can easily be manipulated and compared. More...

Inheritance diagram for Generic2D:
Collaboration diagram for Generic2D:

Public Member Functions

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

 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 _manipulate (self, name, other, operator='')
 Base method to create a new Generic2D object. More...
 

Private Attributes

 _varStorage
 

Detailed Description

Wraps binned distributions in a common type so that distributions can easily be manipulated and compared.

While a full distribution is always input, this class will actually store three sets of bins, one each for the 'LOW', 'SIG', and 'HIGH' categories of the X axis. The three sets are considered one "object" to the user. Combining an object of class Generic2D with another (see _manipulate method) creates a new Generic2D object with new RooFormulaVars corresponding to the manipulation. To avoid python's garbage collection of RooFit objects, assign each instance of this class to a persistent variable.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  name,
  binning,
  forcePositive = True 
)

Constructor.

Parameters
nameUnique name of object which will be prepended to all associated RooFit objects.
binningBinning scheme object. forcePositive (bool, optional). Defaults to True in which case the bin values will be lower bound by 1e-9.

Member Function Documentation

◆ _manipulate()

def _manipulate (   self,
  name,
  other,
  operator = '' 
)
private

Base method to create a new Generic2D object.

When combining self and other, a new set of RooFormulaVars will be created for the new Generic2D object that connect self and other with the operator string. The associated nuisances of self and other will also be passed to the new object as one set (with potential duplicates removed).

If attempting to add, subtract, multiply, or divide, use the dedicated methods. More complex use cases could be built here.

Parameters
nameUnique name for the new output Generic2D object.
otherObject to combine with self. operator (str, optional): Connecting mathematical operator string for the combination. Defaults to '*' which causes the method to return self*other.
Returns
Generic2D Object containing the combination of self and other.

◆ Add()

def Add (   self,
  name,
  other,
  factor = '1' 
)

Add self with other.

Optionally change the factor in front of other (defaults to 1). This option is primarly for the case of subtracting other from self.

Parameters
nameUnique name for the new output Generic2D object.
otherObject to add to self. factor (str, optional): Factor to include in front of other in the combination. Defaults to '1'. Primary use case is "-1" which will subtract other from self.
Returns
Generic2D Object containing the addition of self and other.

◆ Divide()

def Divide (   self,
  name,
  other 
)

Divide self by other.

Parameters
nameUnique name for the new output Generic2D object.
otherObject to divide self by.
Returns
Generic2D Object containing the division of self by other.

◆ getBinVal()

def getBinVal (   self,
  xbin,
  ybin 
)

Get bin value (for the current parameter values) in bin (xbin, ybin).

Parameters
xbinIndexed at 1 for ROOT compatibility.
ybinIndexed at 1 for ROOT compatibility.
Returns
float Current bin value.

◆ getBinVar()

def getBinVar (   self,
  xbin,
  ybin,
  c = '' 
)

Get the bin variable associated with (xbin,ybin).

The xbin and ybin args are assumed to be for global bin numbers but can be for a given category ("LOW", "SIG", or "HIGH") if specified with the c option.

Parameters
xbin[description]
ybin[description] c (str, optional): One of "LOW", "SIG", or "HIGH" which will cause xbin and ybin to be interpreted as indexes for the given subspace. Defaults to '' in which case xbin and ybin are treated as global.
Returns
RooFormulaVar RooFit object for the requested bin.

◆ Multiply()

def Multiply (   self,
  name,
  other 
)

Multiply self with other.

Parameters
nameUnique name for the new output Generic2D object.
otherObject to multiply self by.
Returns
Generic2D Object containing the multiplication of self and other.

◆ RooParametricHist()

def RooParametricHist (   self)

Produce a RooParametricHist2D filled with this object's binVars.

Returns
RooParametricHist2D Output RooFit object to pass to Combine.

Member Data Documentation

◆ binArgLists

binArgLists

Dict mapping of the subspaces (LOW, SIG, HIGH) to the RooArgList of the RooAbsArgs in the subspace.

◆ binning

binning

Binning object.

◆ binVars

binVars

Ordered dictionary of all RooAbsArgs representing the bins of the space.

◆ forcePositive

forcePositive

Option to ensure bin values cannot be negative.

◆ name

name

Unique name of object which will be prepended to all associated RooFit objects.

◆ nuisances

nuisances

All tracked nuisance dictionaries.

◆ rph

rph

Dict mapping of the subspaces (LOW, SIG, HIGH) to the RooParametricHist2D objects of the subspaces.


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