![]() |
TIMBER
beta
Tree Interface for Making Binned Events with RDataFrame
|
Class to represent nodes in the DataFrame processing graph. More...


Public Member Functions | |
| def | __init__ (self, name, DataFrame, action='', nodetype='', children=[], parent=None) |
| Constructor. More... | |
| def | __str__ (self) |
Call with print(<Node>) to print a nicely formatted description of the Node object for debugging. More... | |
| def | Apply (self, actionGroupList) |
| Applies a single CutGroup/VarGroup or an ordered list of Groups to this Node to produce a new final Node. More... | |
| def | Clone (self, name='') |
| Clones Node instance without child information and with new name if specified. More... | |
| def | Close (self) |
| Safely deletes Node instance and all descendants. More... | |
| def | Cut (self, name, cut, nodetype=None, silent=False) |
| Produces a new Node with the provided cut/filter applied. More... | |
| def | Define (self, name, var, nodetype=None, silent=False) |
| Produces a new Node with the provided variable/column added. More... | |
| def | Discriminate (self, name, discriminator) |
| Produces a dictionary with two new Nodes made by forking this Node based upon a discriminator being True or False. More... | |
| def | GetBaseNode (self) |
| Returns the top-most parent Node by climbing node tree until a Node with no parent is reached. More... | |
| def | Range (self, argv) |
| Calls the RDataFrame Range method. More... | |
| def | SetChild (self, child, overwrite=False) |
| Set one of child for the node. More... | |
| def | SetChildren (self, children, overwrite=False) |
| Set multiple children for the node. More... | |
| def | Snapshot (self, columns, outfilename, treename, lazy=False, openOption='RECREATE') |
| Takes a snapshot of the RDataFrame corresponding to this Node. More... | |
Public Attributes | |
| action | |
| str Action performed to create this Node. | |
| children | |
| list(Node) List of child nodes. | |
| DataFrame | |
| ROOT.RDataFrame DataFrame for the Node. | |
| hash | |
| str Unique hash to identify the node. More... | |
| name | |
| str Name of the Node. | |
| parent | |
| Node Parent node. | |
| type | |
| str Either 'Cut' or 'Define' depending what generated the Node. More... | |
Class to represent nodes in the DataFrame processing graph.
Can make new nodes via Define, Cut, and Discriminate and setup relations between nodes (done automatically via Define, Cut, Discriminate)
| def __init__ | ( | self, | |
| name, | |||
| DataFrame, | |||
action = '', |
|||
nodetype = '', |
|||
children = [], |
|||
parent = None |
|||
| ) |
Constructor.
Holds the RDataFrame and other associated information for tracking in the analyzer.
Methods which act on the RDataFrame always return a new node since RDataFrame is not modified in place.
| name | (str): Name for the node. Duplicate named nodes cannot be tracked simultaneously in the analyzer. |
| DataFrame | (RDataFrame): Dataframe to track. |
| children | ([Node], optional): Child nodes if they exist. Defaults to []. |
| parent | (Node, optional): Parent node if it exists. Defaults to None. |
| nodetype | (str, optional): The type of the Node. Useful for organizing and grouping Nodes. Defaults to ''. |
| action | (str, optional): Action performed (the C++ line). Default is '' but should only be used for a base RDataFrame. |
| def __str__ | ( | self | ) |
| def Apply | ( | self, | |
| actionGroupList | |||
| ) |
Applies a single CutGroup/VarGroup or an ordered list of Groups to this Node to produce a new final Node.
| actionGroupList | (Group, list(Group)): The CutGroup or VarGroup to act on node or a list of CutGroups or VarGroups to act (in order) on node. |
| TypeError | If argument type is not Node. |
| def Clone | ( | self, | |
name = '' |
|||
| ) |
| def Close | ( | self | ) |
Safely deletes Node instance and all descendants.
| def Cut | ( | self, | |
| name, | |||
| cut, | |||
nodetype = None, |
|||
silent = False |
|||
| ) |
Produces a new Node with the provided cut/filter applied.
| name | (str): Name for the cut for internal tracking and later reference. |
| cut | (str): A one-line C++ string that evaluates as a boolean. |
| nodetype | (str, optional): Defaults to None in which case the new Node will be type "Cut". |
| silent | (bool, optional): If False, prints the definition action to the terminal. Defaults to False. |
| def Define | ( | self, | |
| name, | |||
| var, | |||
nodetype = None, |
|||
silent = False |
|||
| ) |
Produces a new Node with the provided variable/column added.
| name | (str): Name for the column for internal tracking and later reference. |
| var | (str): A one-line C++ string that evaluates to desired value to store. |
| nodetype | (str, optional): Defaults to None in which case the new Node will be type "Define". |
| silent | (bool, optional): If False, prints the definition action to the terminal. Defaults to False. |
| def Discriminate | ( | self, | |
| name, | |||
| discriminator | |||
| ) |
Produces a dictionary with two new Nodes made by forking this Node based upon a discriminator being True or False.
| name | (str): Name for the discrimination for internal tracking and later reference. |
| discriminator | (str): A one-line C++ string that evaluates as a bool to discriminate on. |
| def GetBaseNode | ( | self | ) |
| def Range | ( | self, | |
| argv | |||
| ) |
Calls the RDataFrame Range method.
Follows the same syntax (ie. Range(begin, end, stride) or Range(end)).
| def SetChild | ( | self, | |
| child, | |||
overwrite = False |
|||
| ) |
| def SetChildren | ( | self, | |
| children, | |||
overwrite = False |
|||
| ) |
| def Snapshot | ( | self, | |
| columns, | |||
| outfilename, | |||
| treename, | |||
lazy = False, |
|||
openOption = 'RECREATE' |
|||
| ) |
Takes a snapshot of the RDataFrame corresponding to this Node.
Compression algorithm set to 1 (ZLIB) and compression level are set to 1.
IMPORTANT When writing a variable size array through Snapshot, it is required that the column indicating its size is also written out and it appears before the array in the columns list. The columns argument should be "all" if you'd like to keep everything.
| columns | ([str] or str): List of columns to keep (str) with regex matching. Provide single string 'all' to include all columns. |
| outfilename | (str): Name of the output file |
| treename | ([type]): Name of the output TTree |
| lazy | (bool, optional): If False, the RDataFrame actions until this point will be executed here. Defaults to False. |
| openOption | (str, optional): TFile opening options. Defaults to 'RECREATE'. |
| hash |
str Unique hash to identify the node.
| type |
1.8.13