TIMBER  beta
Tree Interface for Making Binned Events with RDataFrame
Public Member Functions | Public Attributes | List of all members
Correction Class Reference

Class to handle corrections produced by C++ modules. More...

Inheritance diagram for Correction:
Inheritance graph
[legend]
Collaboration diagram for Correction:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, name, script='', constructor=[], mainFunc='eval', corrtype=None, columnList=None, isClone=False, cloneFuncInfo=None)
 Constructor. More...
 
def Clone (self, name, newMainFunc=None, newType=None)
 Makes a clone of current instance. More...
 
def GetType (self)
 Gets Correction type. More...
 
- Public Member Functions inherited from ModuleWorker
def __init__ (self, name, script, constructor=[], mainFunc='eval', columnList=None, isClone=False, cloneFuncInfo=None)
 Constructor. More...
 
def Clone (self, name, newMainFunc=None)
 Makes a clone of current instance. More...
 
def GetCall (self, evalArgs={}, toCheck=None)
 Gets the call to the method to be evaluated per-event. More...
 
def GetFuncNames (self)
 Gets list of function names in C++ script. More...
 
def GetMainFunc (self)
 Gets full main function name. More...
 
def MakeCall (self, inArgs={}, toCheck=None)
 Makes the call (stored in class instance) to the method with the branch/column names deduced or added from input. More...
 

Public Attributes

 existing
 bool Denotes if associated c++ has already been compiled
 
 name
 str Name of correction
 
- Public Attributes inherited from ModuleWorker
 name
 str Correction name
 

Detailed Description

Class to handle corrections produced by C++ modules.

Uses clang in python to parse the C++ code and determine function names, namespaces, and argument names and types.

Writing the C++ modules has two requirements:

(1) the desired branch/column names must be specified or be used as the argument variable names to allow the framework to automatically determine what branch/column to use in GetCall(),

(2) the return must be a vector ordered as {nominal, up, down} for "weight" type and {up, down} for "uncert" type.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  name,
  script = '',
  constructor = [],
  mainFunc = 'eval',
  corrtype = None,
  columnList = None,
  isClone = False,
  cloneFuncInfo = None 
)

Constructor.

Parameters
name(str): Correction name.
script(str, optional): Path to C++ script with function to calculate correction. Use an empty string to point to existing columns that do not need to be calculated. Defaults to ''.
constructor([str], optional): List of arguments to script class constructor. Defaults to [].
mainFunc(str, optional): Name of the function to use inside script. Defaults to None and the class will try to deduce it.
corrtype(str, optional): Either "weight" (nominal weight to apply with an uncertainty), "corr" (only a correction), or "uncert" (only an uncertainty). Defaults to '' and the class will try to deduce it.
columnList([str], optional): List of column names to search mainFunc arguments against. Defaults to None and the standard NanoAOD columns from LoadColumnNames() will be used.
isClone(bool, optional): For internal use when cloning. Defaults to False. If True, will not duplicate compile the same script if two functions are needed in one C++ script.
cloneFuncInfo(dict, optional): For internal use when cloning. Defaults to None. Should be the _funcInfo from the object from which this one i

Member Function Documentation

◆ Clone()

def Clone (   self,
  name,
  newMainFunc = None,
  newType = None 
)

Makes a clone of current instance.

If multiple functions are in the same script, one can clone the correction and reassign the mainFunc to avoid compiling the same script twice.

Parameters
name(str): Clone name.
newMainFunc(str, optional): Name of the function to use inside script. Defaults to None and the original is used.
newType(str, optional): New type for the cloned correction. Defaults to None and the original is used.
Returns
Correction Clone of instance with same script but different function (newMainFunc).

◆ GetType()

def GetType (   self)

Gets Correction type.

Returns
str Correction type.

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