-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Implementation of substructure modules #87
Open
sattwamo
wants to merge
6
commits into
JuliaHEP:main
Choose a base branch
from
sattwamo:substructure
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
10d0c6b
Initial addition of substructure modules
sattwamo d80ffed
Added documentation
sattwamo 769b555
Merge branch 'JuliaHEP:main' into substructure
sattwamo b23118c
Refactoring the initial code
sattwamo 3d4220b
Merge branch 'JuliaHEP:main' into substructure
sattwamo 094b34e
Updated documentation
sattwamo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# Jet Substructure | ||
|
||
## Structures | ||
|
||
### `MassDropTagger` | ||
|
||
The `MassDropTagger` structure is used for tagging jets based on mass drop conditions, which helps in identifying subjets within a jet that undergo a significant drop in mass. | ||
|
||
**Fields**: | ||
|
||
- `mu::Float64`: Maximum allowed mass ratio for a jet to pass the tagging condition. | ||
- `y::Float64`: Minimum kT distance threshold for parent jet separation. | ||
|
||
--- | ||
|
||
### `SoftDropTagger` | ||
|
||
The `SoftDropTagger` instance is used to apply soft-drop grooming to jets, removing soft, wide-angle radiation. This approach is commonly used in jet grooming to reduce contamination from soft particles. | ||
|
||
**Fields**: | ||
|
||
- `zcut::Float64`: Minimum allowed energy fraction for subjets. | ||
- `b::Float64`: Angular exponent controlling soft radiation suppression. | ||
- `cluster_rad::Float64`: New radius used to recluster components of the jet. Defaults to `1.0` if no value is specified. | ||
|
||
--- | ||
|
||
### `JetFilter` | ||
|
||
The `JetFilter` structure is used to filter jets based on a specific radius and the number of hardest subjets. This technique reduces contamination from peripheral soft particles. | ||
|
||
**Fields**: | ||
|
||
- `filter_radius::Float64`: Radius parameter used to recluster subjets. | ||
- `num_hardest_jets::Int`: Number of hardest subjets retained in the filtered result. | ||
|
||
--- | ||
|
||
### `JetTrim` | ||
|
||
`JetTrim` instance is used to trim jets by removing soft, large-angle components from the jet. This is useful in cleaning up jets to remove softer particles at wide angles. | ||
|
||
**Fields**: | ||
|
||
- `trim_radius::Float64`: Radius used for reclustering in trimming. | ||
- `trim_fraction::Float64`: Minimum momentum fraction for retained subjets. | ||
- `recluster_method::JetAlgorithm.Algorithm`: Method identifier for reclustering. | ||
|
||
--- | ||
|
||
## Functions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above - don't repeat docstrings, show how to use these functions. |
||
|
||
### `mass_drop` | ||
|
||
```julia | ||
mass_drop(jet::PseudoJet, clusterseq::ClusterSequence, tag::MassDropTagger) -> PseudoJet | ||
``` | ||
|
||
The `mass_drop` function identifies subjets in a jet that pass the mass drop tagging condition. It iterates through the clustering history of the jet, stopping at the first jet that satisfies the mass and distance thresholds. | ||
|
||
**Arguments** : | ||
|
||
* `jet`: `PseudoJet` instance representing the jet to be tagged. | ||
* `clusterseq`: `ClusterSequence` with jet clustering history. | ||
* `tag`: `MassDropTagger` instance providing mass drop parameters. | ||
|
||
**Returns** : | ||
|
||
`PseudoJet`: The jet (or subjet) that satisfies the mass drop condition, or a zero-momentum `PseudoJet` if no tagging occurs. | ||
|
||
--- | ||
|
||
### `soft_drop` | ||
|
||
```julia | ||
soft_drop(jet::PseudoJet, clusterseq::ClusterSequence, tag::SoftDropTagger) -> PseudoJet | ||
``` | ||
|
||
The `soft_drop` function applies soft-drop grooming to remove soft, wide-angle radiation from jets. It reclusters the jet with a specified radius and clustering method, iteratively checking the soft-drop condition on subjets. | ||
|
||
**Arguments** : | ||
|
||
* `jet`: `PseudoJet` instance to groom. | ||
* `clusterseq`: `ClusterSequence` containing jet history. | ||
* `tag`: `SoftDropTagger` instance with soft-drop parameters. | ||
|
||
**Returns** : | ||
|
||
`PseudoJet`: Groomed jet or zero-momentum `PseudoJet` if grooming fails. | ||
|
||
--- | ||
|
||
### `jet_filtering` | ||
|
||
```julia-repl | ||
jet_filtering(jet::PseudoJet, clusterseq::ClusterSequence, filter::JetFilter) -> PseudoJet | ||
``` | ||
|
||
The `jet_filtering` function filters a jet to retain only the hardest subjets based on a specified radius and number. This helps in refining the jet structure by reducing soft particle contamination. | ||
|
||
**Arguments** : | ||
|
||
* `jet`: `PseudoJet` instance representing the jet to filter. | ||
* `clusterseq`: `ClusterSequence` containing jet history. | ||
* `filter`: `JetFilter` instance specifying radius and number of subjets. | ||
|
||
**Returns** : | ||
|
||
`PseudoJet`: Filtered jet composed of the hardest subjets. | ||
|
||
--- | ||
|
||
### `jet_trimming` | ||
|
||
```julia | ||
jet_trimming(jet::PseudoJet, clusterseq::ClusterSequence, trim::JetTrim) -> PseudoJet | ||
``` | ||
|
||
The `jet_trimming` function trims a jet by removing subjets with transverse momentum below a specified fraction of the main jet's momentum. This method cleans up jets by removing soft particles. | ||
|
||
**Arguments** : | ||
|
||
* `jet`: `PseudoJet` instance representing the jet to trim. | ||
* `clusterseq`: `ClusterSequence` containing jet history. | ||
* `trim`: `JetTrim` instance specifying trimming parameters. | ||
|
||
**Returns** : | ||
|
||
`PseudoJet`: Trimmed jet composed of retained subjets. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#! /usr/bin/env julia | ||
using JetReconstruction | ||
|
||
input_file = joinpath(dirname(pathof(JetReconstruction)), | ||
"..", "test", "data", "events.pp13TeV.hepmc3.gz") | ||
events = read_final_state_particles(input_file) | ||
|
||
# Event to pick | ||
event_no = 1 | ||
|
||
cluster_seq = jet_reconstruct(events[event_no], p = 0, R = 1.0) | ||
jets = inclusive_jets(cluster_seq; ptmin = 5.0, T = PseudoJet) | ||
|
||
r = 0.3 # recluster radius | ||
n = 3 # number of hard jets to consider | ||
|
||
filter = JetFilter(r, n) | ||
|
||
@info "Jet Filtering: recluster radius = $r, hard subjets to consider = $n" | ||
for jet in jets | ||
filtered = jet_filtering(jet, cluster_seq, filter) | ||
|
||
println("Original jet: pt = $(JetReconstruction.pt(jet)), rap = $(JetReconstruction.rapidity(jet)), phi = $(JetReconstruction.phi(jet)), E = $(jet.E)") | ||
println("Filtered jet: pt = $(JetReconstruction.pt(filtered)), rap = $(JetReconstruction.rapidity(filtered)), phi = $(JetReconstruction.phi(filtered)), E = $(filtered.E)\n") | ||
end | ||
|
||
r = 0.3 # recluster radius | ||
f = 0.3 # trim fraction | ||
m = JetAlgorithm.CA # recluster method | ||
|
||
trim = JetTrim(r, f, m) | ||
|
||
@info "Jet Trimming: recluster radius = $r, trim fraction = $f, recluster method = $m" | ||
for jet in jets | ||
trimmed = jet_trimming(jet, cluster_seq, trim) | ||
|
||
println("Original jet: pt = $(JetReconstruction.pt(jet)), rap = $(JetReconstruction.rapidity(jet)), phi = $(JetReconstruction.phi(jet)), E = $(jet.E)") | ||
println("Trimmed jet: pt = $(JetReconstruction.pt(trimmed)), rap = $(JetReconstruction.rapidity(trimmed)), phi = $(JetReconstruction.phi(trimmed)), E = $(trimmed.E)\n") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#! /usr/bin/env julia | ||
using JetReconstruction | ||
|
||
input_file = joinpath(dirname(pathof(JetReconstruction)), | ||
"..", "test", "data", "events.pp13TeV.hepmc3.gz") | ||
events = read_final_state_particles(input_file) | ||
|
||
# Event to pick | ||
event_no = 1 | ||
|
||
cluster_seq = jet_reconstruct(events[event_no], p = 0, R = 1.0) | ||
jets = inclusive_jets(cluster_seq; ptmin = 5.0, T = PseudoJet) | ||
|
||
μ = 0.67 # jet mass ratio | ||
y = 0.09 # symmetry cut | ||
|
||
MDtagger = MassDropTagger(μ, y) | ||
|
||
@info "Mass Drop Tagging: μ = $μ, y = $y" | ||
for jet in jets | ||
tagged = mass_drop(jet, cluster_seq, MDtagger) | ||
println("Original jet: pt = $(JetReconstruction.pt(jet)), rap = $(JetReconstruction.rapidity(jet)), phi = $(JetReconstruction.phi(jet)), E = $(jet.E)") | ||
println("Tagged jet: pt = $(JetReconstruction.pt(tagged)), rap = $(JetReconstruction.rapidity(tagged)), phi = $(JetReconstruction.phi(tagged)), E = $(tagged.E)\n") | ||
end | ||
|
||
z = 0.1 # soft drop threshold | ||
b = 2.0 # angular exponent | ||
|
||
SDtagger = SoftDropTagger(z, b) | ||
|
||
@info "Soft Drop Tagging: recluster radius = $(SDtagger.cluster_rad), zcut = $z, b = $b" | ||
for jet in jets | ||
tagged = soft_drop(jet, cluster_seq, SDtagger) | ||
println("Original jet: pt = $(JetReconstruction.pt(jet)), rap = $(JetReconstruction.rapidity(jet)), phi = $(JetReconstruction.phi(jet)), E = $(jet.E)") | ||
println("Tagged jet: pt = $(JetReconstruction.pt(tagged)), rap = $(JetReconstruction.rapidity(tagged)), phi = $(JetReconstruction.phi(tagged)), E = $(tagged.E)\n") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[deps] | ||
JetReconstruction = "44e8cb2c-dfab-4825-9c70-d4808a591196" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Examples for Substructure Modules | ||
|
||
The `JetGrooming.jl` file shows the usage of `jet_filtering` and `jet_trimming` functions while the `JetTagging.jl` file demonstrates how to use `mass_drop` and `soft_drop` functions. | ||
|
||
To use these examples run | ||
|
||
```julia | ||
julia --project JetTagging.jl | ||
... | ||
julia --project JetGrooming.jl | ||
... | ||
``` | ||
|
||
The parameters of tagging and grooming and the input files can be easily changed in the scripts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't just repeat the docstrings! Write a description of how to use these functions and refer to the API documentation by reference (e.g.
[MassDropTagger](@ref)
).You can refer to the nice examples you wrote as well.