Skip to main content

Official FastJet bindings to Python and Awkward Array.

Project description

fastjet

Actions Status Documentation Status Code style: black

PyPI version Conda-Forge PyPI platforms

GitHub Discussion Gitter Scikit-HEP

Official FastJet bindings to Python and Awkward Array.

Main features of Fastjet :

  • Contains Vectorized as well as Non-Vectorized interface for Fastjet.
  • Compiled against the complete Fastjet library in C++.
  • Has Awkward Array and Vector as dependency.
  • Provides the functionality to cluster multiple events at a time.
  • Input data can be in any coordinate system.

Installation

The package can be installed from pypi using the following command :

pip install fastjet

Overview

Some of the basic functionalities of Fastjet and how to use them are listed below.

import fastjet
import awkward as ak
import vector

The input data can be either a awkward array or a list of Pseudojets.

Awkward Array

input_data = ak.Array(
    [
        [
            {"px": 1.2, "py": 3.2, "pz": 5.4, "E": 2.5, "ex": 0.78},
            {"px": 32.2, "py": 64.21, "pz": 543.34, "E": 24.12, "ex": 0.35},
            {"px": 32.45, "py": 63.21, "pz": 543.14, "E": 24.56, "ex": 0.0},
        ],
        [
            {"px": 1.2, "py": 3.2, "pz": 5.4, "E": 2.5, "ex": 0.78},
            {"px": 32.2, "py": 64.21, "pz": 543.34, "E": 24.12, "ex": 0.35},
            {"px": 32.45, "py": 63.21, "pz": 543.14, "E": 24.56, "ex": 0.0},
        ],
    ],
    with_name="Momentum4D",
)

List of PseudoJets

input_data = [fastjet.PseudoJet(1,1,1,1)
             ,fastjet.PseudoJet(1.2,1.2,1.2,1.2)
             ,fastjet.PseudoJet(3,3,3,3)
             ,fastjet.PseudoJet(-1,-12,2,1)
             ,fastjet.PseudoJet(-1,-12,2.1,0.9)]

Clustering

The classes (clustering and clustering specification) are the same for all the input types:

jetdef = fastjet.JetDefinition(fastjet.antikt_algorithm, 0.6)
cluster = fastjet.ClusterSequence(input_data, jetdef)

Outputs

The output can be extracted using function calls (output can be an Awkward Array or a list of PseudoJets depending on the input).

inclusive_jets = cluster.inclusive_jets()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastjet-3.3.4.0rc4.tar.gz (35.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page