Skip to content

Feature request: obtain constituents in cluster form #337

Open
@kpedro88

Description

@kpedro88

Currently, using jet substructure functions that take constituents as input requires the following repetitive pattern:

jetdef = fastjet.JetDefinition(fastjet.antikt_algorithm, 0.8)
    jet_cluster = fastjet._pyjet.AwkwardClusterSequence(array, jetdef)
    constituents = jet_cluster.constituents()
    constituents_cluster = fastjet._pyjet.AwkwardClusterSequence(constituents, jetdef)
    result = constituents_cluster.njettiness()

This could be streamlined as follows: (using the example from #336)

In _pyjet.py:

    def constituents(self, min_pt=0, cluster=False):
        result = self._internalrep.constituents(min_pt)
        if cluster:
            return AwkwardClusterSequence(result, self._jetdef)
        else:
            return result

and then in the user code:

constituents_cluster = jet_cluster.constituents(cluster=True)
result = constituents_cluster.njettiness()

Note from @lgray:

this will require some care with the dask implementation since we have to avoid accidentally sending the client side cluster sequence to a node.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions