cpalgnodes.ntuple module
Basic algorithm to output ntuples
- class cpalgnodes.ntuple.NTupleMakerNode(tree_name: str)
Bases:
Node- add_branch(container: str, aux_name: str, branch_name: str)
Add a single branch to the output
- Parameters:
container (str) – The nickname of the container
aux_name (str) – The name of the aux data to write
branch_name (str) – The name of the output branch
- add_branches(container: str, branches: Tuple[str, str])
Add several branches to the output
- Parameters:
container (str) – The nickname of the input container
branches (Tuple[str, str]) – List of (aux_name, branch_name) tuples
- create(container_info: Mapping[str, ContainerInfo]) Algorithm | List[Algorithm] | ConfigFragment
Create the algorithm(s) represented by this node
- Parameters:
container_info (Mapping[str, ContainerInfo]) – The ContainerInfo for each input/output container
- Returns:
The configured algorithm(s)
- Return type:
Union[Algorithm, List[Algorithm], ConfigFragment]
- property has_job_output: bool
Whether or not this node is responsible for producing output from the job.
If a node produces output (e.g. a TTree or histogram) it is always required and so the scheduler will add a dependency from it to the output node.
- property name
The name of this node (should be unique within the graph)
- property produces_aux: Dict[str, Set[str]]
The auxdata produced by this node, split by container
- Return type:
A dictionary mapping container nicknames to the set of auxnames the node produces
- property produces_containers: Dict[str, str]
Any containers created by this node
Containers are returned as a dictionary mapping from the created container nickname to its parent container (or None otherwise). A container has a parent if it is a deep copy, shallow copy or view. Where a node updates a container it should have itself as the parent.
- property requires_aux: Dict[str, Set[str]]
The auxdata required by this node, split by container
- Return type:
A dictionary mapping container nicknames to the set of auxnames the node requires
- requires_objects(required_output: Dict[Tuple[str, str], Expression]) Dict[Tuple[str, str], Expression]
The input objects that this algorithm needs
Part of the preselection mechanism. This method allows each node to tell the scheduler which objects upstream nodes need to have run for this node to produce the data required by downstream node.
For example, in the most simple case (which this default implementation satisfies) the node calculates object-by-object so the node only needs to see the objects on which its output is required.
- Parameters:
required_output (Dict[Dependency, boolean.Expression]) – The selections required downstream of this node on its outputs
- Return type:
The selections this node requires on its inputs
- set_container_selection(container: str, selection: str | Expression)
Set the selection on a container
Only objects passing this selection (on any systematic) will be written out