Quantities
- class code_generation.quantity.NanoAODQuantity(name)[source]
A NanoAODQuantity is a quantity that comes directly from the NanoAOD file. Normally, these quantities are not suited to be used in the output ntuple, are therefore shielded from using them directly as a output.
- Parameters:
name (str)
- get_leaf(shift, scope)[source]
Overloaded version for the get_leaf function to return the shifted versions of the quantity if needed.
- Parameters:
shift (str) – Name of the shift for which the leaf should be returned
scope (str) – Scope for which the leaf should be returned (not used)
- Returns:
str. Name of the leaf
- Return type:
str
- get_shifts(scope)[source]
Overloaded version of the get_shifts function
- Parameters:
scope (str) – Scope for which shifts should be returned (not used)
- Returns:
List of all shifts
- Return type:
list
- register_external_shift(shift_name, external_name)[source]
Function used to register a NanoAOD quantity as a shift of another quantity. Iif the shifted version of a quantity already exists in the input, this function can be used to register an branch from the input as a shifted version of a quantity
- Parameters:
shift_name (str) – Name of the shift
external_name (str) – Name of the shifted quantity in the NanoAOD
- Returns:
None
- Return type:
None
- class code_generation.quantity.Quantity(name)[source]
- Parameters:
name (str)
- add(name)[source]
Function is not used for a base quantity
- Parameters:
name (str)
- Return type:
None
- adopt(child, scope)[source]
Adopt a child quantity to the current quantity. An adopted quantity will inherit all shifts of the partent quantity.
- Parameters:
child (Quantity) – The child quantity
scope (str) – Scope for which the child should be adopted
- Returns:
None
- Return type:
None
- copy(name)[source]
Generate a copy of the current quantity with a new name.
- Parameters:
name (str) – Name of the new quantity
- Returns:
Quantity. a new Quantity object.
- Return type:
- get_leaf(shift, scope)[source]
Function to get the leaf of a given shift within a given scope. A leaf is the name of the quantity used for that scope/shift combination. If no shift is defined, the name of the quantity is returned.
- Parameters:
shift (str) – Name of the shift for which the leaf should be returned
scope (str) – Scope for which the leaf should be returned
- Returns:
str. Name of the leaf
- Return type:
str
- get_leaves_of_scope(scope)[source]
Function returns a list of all leaves, which are defined for a given scope.
- Parameters:
scope (str) – Scope for which the leaves should be returned
- Returns:
list. List of leaves
- Return type:
List[str]
- get_shifts(scope)[source]
Function returns a list of all shifts, which are defined for a given scope.
- Parameters:
scope (str) – Scope for which shifts should be returned
- Returns:
List of all shifts, which are defined for a given scope.
- Return type:
list
- ignore_shift(name, scope)[source]
Function to ignore a shift for a given scope.
- Parameters:
name (str) – Name of the shift to be ignored
scope (str) – Scope for which the shift should be ignored
- Returns:
None
- Return type:
None
- reserve_scope(scope)[source]
Function to reserve a scope for a given quantity. The scopes, in which a quantity is used as an output are tracked in the output_scopes list. If a quantity is already used within a given scope as output, this will result in an exception. This check is triggered for every Producer.
- Parameters:
scope (str)
- Return type:
None
- shift(name, scope)[source]
Function to define a shift for a given scope. If the shift is marked as ignored, nothing will be added. When a new shift is defined, all child quantities of a given quantity will be shifted as well.
- Parameters:
name (str) – Name of the shift
scope (str) – Scope for which the shift should be defined
- Returns:
None
- Return type:
None
- class code_generation.quantity.QuantityGroup(name)[source]
A Quantity Group is a group of quantities, that all have the same settings, but different names.
- Parameters:
name (str)
- add(name)[source]
Function to add a new Quantity to the group. This quantity contains the identical shifts as the group itself
- Parameters:
name (str) – Name of the new Quantity
- Returns:
None
- Return type:
None
- get_leaves_of_scope(scope)[source]
Function returns a list of all leaves, which are defined for a given scope. This is an overload of the function used for the quantity class.
For the writeout, loop over all quantities in the group and return them all (plus their shifts) in a list.
- Parameters:
scope (str) – Scope for which the leaves should be returned
- Returns:
list. List of leaves
- Return type:
List[str]