Skip to content

Draft: Valencia algorithm 🍊#201

Closed
mattleblanc wants to merge 42 commits intoJuliaHEP:mainfrom
mattleblanc:mlb
Closed

Draft: Valencia algorithm 🍊#201
mattleblanc wants to merge 42 commits intoJuliaHEP:mainfrom
mattleblanc:mlb

Conversation

@mattleblanc
Copy link
Contributor

This PR aims to implement the Valencia (VLC) jet clustering algorithm as another option to study in the context of lepton colliders. Many thanks to my summer student @EthanLynn916 for the initial julia implementation that this PR is based on!

The implementation follows the description in 1404.4294, and so depends on several parameters:

  • R: The jet radius parameter.
  • β: Corresponds to the existing power p of the algorithm.
  • γ: The angular exponent parameter used in the Valencia beam distance.

The extra flexibility given by the VLC algorithm provides some handles that allow for additional suppression of backgrounds due to ISR / BIB / etc. that present themselves in high-energy lepton collisions. It was originally developed for use at CLIC, and is of interest to study in the context of a future muon collider.

This PR touches EEAlgorithm to add the necessary distance functions and parameters. I think this new code is factorized and does not change the performance of the existing algorithms, but am continuing to validate the work.

In particular, some of the new tests are not yet passing due to larger differences in jet rapidity than I'd expected. I'm hopeful that #198 might help bring things slightly closer to the C++ output, so am waiting to test with that merged ... in the meantime, I'm happy to get feedback on this draft PR so that it can be improved.

🍻 MLB

@mattleblanc mattleblanc requested a review from Copilot August 11, 2025 14:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements the Valencia (VLC) jet clustering algorithm as an option for studying lepton colliders. The Valencia algorithm provides additional flexibility through parameters β (power), γ (angular exponent), and R (jet radius) that help suppress backgrounds from ISR/BIB/etc in high-energy lepton collisions.

  • Adds Valencia algorithm as a new JetAlgorithm enum value with corresponding distance functions
  • Implements Valencia-specific distance metrics including valencia_distance and valencia_beam_distance functions
  • Updates the EE algorithm framework to handle the new γ parameter and Valencia-specific logic

Reviewed Changes

Copilot reviewed 8 out of 12 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/AlgorithmStrategyEnums.jl Adds Valencia to JetAlgorithm enum and related algorithm classification functions
src/EEAlgorithm.jl Implements Valencia distance functions and integrates them into the EE clustering framework
src/GenericAlgo.jl Updates generic jet_reconstruct interface to support γ parameter for Valencia
src/ClusterSequence.jl Adds Valencia to algorithms supporting exclusive jets
test/test-valencia.jl Comprehensive test suite for Valencia algorithm with jet matching against FastJet reference
test/runtests.jl Includes Valencia tests in test suite
docs/src/index.md Documents Valencia algorithm in algorithm table
docs/src/examples.md Adds Valencia usage example


where β is the energy exponent (typically set via the algorithm parameters).
"""
@inline function valencia_beam_distance(eereco, i, γ, β)
Copy link

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The parameter order is inconsistent with other functions. Consider reordering to match the pattern used elsewhere, such as valencia_beam_distance(eereco, i, β, γ) to be consistent with the energy parameter coming before angular parameter.

Suggested change
@inline function valencia_beam_distance(eereco, i, γ, β)
@inline function valencia_beam_distance(eereco, i, β, γ)

Copilot uses AI. Check for mistakes.
function read_fastjet_outputs(filename)
if endswith(filename, ".zst")
# Decompress .zst file to a buffer and parse JSON
io = open(`zstdcat $(filename)`, "r")
Copy link

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using shell command interpolation with zstdcat $(filename) could be vulnerable to command injection if filename contains shell metacharacters. Consider using a more secure approach or validating the filename.

Copilot uses AI. Check for mistakes.
m-fila and others added 9 commits August 11, 2025 10:38
* fix and

* make softkiller immutable struct

* reorder fields to match constructors

* change `Int64` to `Int`

Co-authored-by: Jerry Ling <proton@jling.dev>

---------

Co-authored-by: Jerry Ling <proton@jling.dev>
* fix dump in jetreco and instrumented-jetreco examples

* Refactor fixed dump option

Rename the jets selected as "selectedjets" to avoid confusion
with too many "final jets".

Add a test of this option to the example testing script "test.sh"

---------

Co-authored-by: Graeme A Stewart <graeme.andrew.stewart@cern.ch>
…ult types (JuliaHEP#187)

* fix type instability in inclusive and exclusive jets

* fix type instability in read_final_state_particles

* concretize default vector types

* use same convention in recombination schemes, fix docstrings and return type
Lots of places like square logos!
This is the v1.0.0 development branch, update the
release number to reflect that
Do not try to plot a histogram with less than 2 values as it crashes
* Improved animation script

Allow framerate, extra frames and title to be specified.

Small patch to the HepMC3 summary script to print the
particle density per event.

* Add ancestors option
graeme-a-stewart and others added 4 commits August 11, 2025 10:39
* Remove extra particle copy

This was an unnecessary extra copy that was being made (legacy from
when we allowed the internal method to be called directly).

* More consistent internal reconstruction interfaces

Rename all of the internal reconstruction interfaces to ! functions as
they mutate the input particle vector.

Make _ee_genkt_algorithm! take particles as a positional parameter
for consistency reasons with the other functions.

Improve docstrings.

* Format fixes

* Improved documentation

Co-authored-by: Mateusz Jakub Fila <37295697+m-fila@users.noreply.github.com>

* Additional docstring fixes

---------

Co-authored-by: Mateusz Jakub Fila <37295697+m-fila@users.noreply.github.com>
* Implementing modules for Lund Jet Plane generation

* Refactor Lund-plane utilities

Moved `generate_average_lund_image` function to `examples/lundplane/lund-plane-visualisation.jl`
Included reference to original paper
Removed redundant comments

* Fixed the issue with tests of LundPlane

* Small fixes for Lund plane

Rephrase a few things in the documentation.

Use LaTeXStrings for nicer axis labels on example.

Add a max_allowable_R for the package (following Fastjet this is set to
1000)

Make use of the delta_phi() function in deltaR() and deltar().

* Minor formatting

---------

Co-authored-by: Graeme A Stewart <graeme.andrew.stewart@cern.ch>
Add all profile directories to gitignore
Add heavy examples to codecov ignore
* Improved softkiller examples

Rename --maxevents and --skip to --pileup-maxevents and --pileup-skip
which allow variations in the amount of pileup to be applied.

Select the hard scatter event with --eventno (this only even one event).

Change hard scatter and pileup files to be positional arguments, which
is more consistent with other scripts.

Make both scripts a bit more verbose for the user's information.

Run a jet reconstruction in softkiller_runtime.jl so that we actually
do something with the reduced event.

N.B. for now, the reduced event has to be rewritten into a new vector
to get the cluster_hist_indexes correct. This can be removed once
softkiller returns a good-for-reconstruction output.

Add a test.sh script that can be used for a quick test of the examples.

* Remove unused arguments
mattleblanc and others added 14 commits August 11, 2025 10:52
Co-authored-by: Jerry Ling <proton@jling.dev>
Co-authored-by: Jerry Ling <proton@jling.dev>
Co-authored-by: Jerry Ling <proton@jling.dev>
Co-authored-by: Jerry Ling <proton@jling.dev>
Co-authored-by: Jerry Ling <proton@jling.dev>
Co-authored-by: Jerry Ling <proton@jling.dev>
Co-authored-by: Jerry Ling <proton@jling.dev>
@mattleblanc
Copy link
Contributor Author

I made a dog's breakfast of it when rebasing the changes from upstream/main ...

Let me know if this PR can proceed, or if I should clean it up somehow.

@Moelf
Copy link
Member

Moelf commented Aug 11, 2025

the PR seemed fine mostly, I guess you're gonna open up a new one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants