Skip to content
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

Merging tree from a final jet #99

Closed
mgratrix opened this issue Jan 2, 2025 · 2 comments
Closed

Merging tree from a final jet #99

mgratrix opened this issue Jan 2, 2025 · 2 comments

Comments

@mgratrix
Copy link

mgratrix commented Jan 2, 2025

I have reconstructed some events using the Cambridge/Aachen algorithm and would like to find the two parents of these jets. I'm looking for a way of accessing the entire merging tree from a final jet—i.e. a function or API call that, for each PseudoJet, gives you the two sub-jets that were merged to form it. Specifically, I was looking for the ability to make a function along the lines of:

function get_jet_parents(jet::PseudoJet, cluster_seq::ClusterSequence)::Union{Tuple{PseudoJet, PseudoJet}, Nothing} if JetReconstruction.has_parents(jet, cluster_seq) parent1, parent2 = JetReconstruction.parents(jet, cluster_seq) return (parent1, parent2) end return nothing end

As far as I know, this package doesn't have these capabilities yet.

@Moelf
Copy link
Member

Moelf commented Jan 2, 2025

I guess this has some rather large performance implications. But maybe if the api of finding the jets to be clustered is user-friendly enough, one can easily implement this outside

@mgratrix
Copy link
Author

mgratrix commented Jan 4, 2025

The most reliable way I have found to achieve this outside was using the following:

function find_parent_pseudoJets(cs::ClusterSequence, jet::PseudoJet)::Tuple{Union{Nothing, PseudoJet}, Union{Nothing, PseudoJet}} hist_idx = jet._cluster_hist_index jet_history = cs.history[hist_idx] parent1_idx, parent2_idx = jet_history.parent1, jet_history.parent2 parent1_jet = parent1_idx > 0 ? cs.jets[cs.history[parent1_idx].jetp_index] : nothing parent2_jet = parent2_idx > 0 ? cs.jets[cs.history[parent2_idx].jetp_index] : nothing return parent1_jet, parent2_jet end

I am leaving this as a record for anyone else trying to do the same thing. While there is probably a more efficient approach, this was the most reliable I could find for now.

@mgratrix mgratrix closed this as completed Jan 4, 2025
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

No branches or pull requests

2 participants