Skip to content

Commit fb0076a

Browse files
Fix for jet constituent indexes (#188)
The index used to retrieve ancestors of a jet was wrong. This is a fix for the 0.4 branch.
1 parent 5bf2d58 commit fb0076a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ClusterSequence.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ given jet.
617617
An vector of indices representing the original constituents of the given jet.
618618
"""
619619
function constituent_indexes(jet::T, cs::ClusterSequence{T}) where {T <: FourMomentum}
620-
get_all_ancestors(cs.history[jet._cluster_hist_index].jetp_index, cs)
620+
get_all_ancestors(jet._cluster_hist_index, cs)
621621
end
622622

623623
"""

test/test-constituents.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function Base.isapprox(j1::PseudoJet, j2::PseudoJet)
99
end
1010

1111
# Expected constituent indexes and parent indexes
12-
const expected_constituent_indexes = [84, 85, 139, 86, 133, 74, 79, 124, 76, 75, 163]
12+
const expected_constituent_indexes = [167, 87, 119, 168, 151, 152, 49, 143, 41, 106]
1313
const expected_parent_indexes = [320, 335]
1414

1515
input_file = joinpath(dirname(pathof(JetReconstruction)), "..", "test", "data",
@@ -27,15 +27,15 @@ pj_jets = inclusive_jets(cluster_seq; ptmin = 5.0, T = PseudoJet)
2727
@testset "Jet constituents" begin
2828
@testset "Constituents of jet number $(event_no)" begin
2929
my_constituents = JetReconstruction.constituents(pj_jets[event_no], cluster_seq)
30-
@test size(my_constituents)[1] == 11
30+
@test size(my_constituents)[1] == length(expected_constituent_indexes)
3131
for (i, idx) in enumerate(expected_constituent_indexes)
3232
@test my_constituents[i] events[1][idx]
3333
end
3434
end
3535

3636
@testset "Constituent indexes for jet number $(event_no)" begin
3737
my_constituent_indexes = constituent_indexes(pj_jets[event_no], cluster_seq)
38-
@test size(my_constituent_indexes)[1] == 11
38+
@test size(my_constituent_indexes)[1] == length(expected_constituent_indexes)
3939
# Testing the index values is sufficient, the content came from the original input file!
4040
@test my_constituent_indexes == expected_constituent_indexes
4141
end

0 commit comments

Comments
 (0)