text: import awkward as ak  # noqa: F401
  import numpy as np  # noqa: F401
  import pytest  # noqa: F401
  
  import fastjet
  import fastjet._pyjet  # noqa: F401
  
  vector = pytest.importorskip("vector")  # noqa: F401
  
  
  def test_Esorting_():
      array = 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",
      )
      ans = [
          [
              {"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},
          ],
      ]
  
      assert ans == fastjet.sorted_by_E(array).to_list()
  
  
  def test_pzsorting():
      array = 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",
      )
      ans = [
          [
              {"px": 1.2, "py": 3.2, "pz": 5.4, "E": 2.5, "ex": 0.78},
              {"px": 32.45, "py": 63.21, "pz": 543.14, "E": 24.56, "ex": 0.0},
              {"px": 32.2, "py": 64.21, "pz": 543.34, "E": 24.12, "ex": 0.35},
          ],
          [
              {"px": 1.2, "py": 3.2, "pz": 5.4, "E": 2.5, "ex": 0.78},
              {"px": 32.45, "py": 63.21, "pz": 543.14, "E": 24.56, "ex": 0.0},
              {"px": 32.2, "py": 64.21, "pz": 543.34, "E": 24.12, "ex": 0.35},
          ],
      ]
  
      assert ans == fastjet.sorted_by_pz(array).to_list()
  
  
  def test_ptsorting():
      array = 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},
              ],
          ],
          behavior=vector._backends.awkward_.behavior,
          with_name="Momentum4D",
      )
      ans = [
          [
              {"px": 1.2, "py": 3.2, "pz": 5.4, "E": 2.5, "ex": 0.78},
              {"px": 32.45, "py": 63.21, "pz": 543.14, "E": 24.56, "ex": 0.0},
              {"px": 32.2, "py": 64.21, "pz": 543.34, "E": 24.12, "ex": 0.35},
          ],
          [
              {"px": 1.2, "py": 3.2, "pz": 5.4, "E": 2.5, "ex": 0.78},
              {"px": 32.45, "py": 63.21, "pz": 543.14, "E": 24.56, "ex": 0.0},
              {"px": 32.2, "py": 64.21, "pz": 543.34, "E": 24.12, "ex": 0.35},
          ],
      ]
  
      assert ans == fastjet.sorted_by_pt(array).to_list()
  
  
  def test_rapsorting():
      array = 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},
              ],
          ],
          behavior=vector._backends.awkward_.behavior,
          with_name="Momentum4D",
      )
      ans = [
          [
              {"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},
          ],
      ]
  
      assert ans == fastjet.sorted_by_rapidity(array).to_list()
  
  
  def test_join():
      bb = fastjet.PseudoJet(1, 1, 6, 1)
      cc = fastjet.PseudoJet(3, 2, 3, 31)
      assert fastjet.join(bb, cc).px() == 4.0
  