Skip to content

Commit

Permalink
Implement different algorithms for N2Tiled
Browse files Browse the repository at this point in the history
Handle the power parameter properly in the N2Tiled strategy, allowing
different algorithms to be tested (Inclusive kt, Cambridge/Achen).
  • Loading branch information
graeme-a-stewart committed Oct 30, 2023
1 parent 0452ac3 commit 7622f4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/PlainAlgo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ which is already done for the two types above.
"""
function plain_jet_reconstruct(particles::Vector{T}; p = -1, R = 1.0, recombine = +, ptmin = 0.0) where T
# Integer p if possible
p = (round(p) == p) ? Int(p) : p
p = (round(p) == p) ? Int(p) : p

# We make sure these arrays are type stable - have seen issues where, depending on the values
# returned by the methods, they can become unstable and performance degrades
Expand Down
8 changes: 4 additions & 4 deletions src/TiledAlgoLL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ end


"""Initialise a tiled jet from a PseudoJet (using an index into our ClusterSequence)"""
tiledjet_set_jetinfo!(jet::TiledJet, clusterseq::ClusterSequence, jets_index, R2) = begin
tiledjet_set_jetinfo!(jet::TiledJet, clusterseq::ClusterSequence, jets_index, R2, p) = begin
@inbounds jet.eta = rapidity(clusterseq.jets[jets_index])
@inbounds jet.phi = phi_02pi(clusterseq.jets[jets_index])
@inbounds jet.kt2 = pt2(clusterseq.jets[jets_index]) > 1.e-300 ? 1.0 / pt2(clusterseq.jets[jets_index]) : 1.e300
@inbounds jet.kt2 = pt2(clusterseq.jets[jets_index]) > 1.e-300 ? pt2(clusterseq.jets[jets_index])^p : 1.e300
jet.jets_index = jets_index
# Initialise NN info as well
jet.NN_dist = R2
Expand Down Expand Up @@ -360,7 +360,7 @@ function tiled_jet_reconstruct(particles::Vector{PseudoJet}; p = -1, R = 1.0, re
tiledjets = similar(clusterseq.jets, TiledJet)
for ijet in eachindex(tiledjets)
tiledjets[ijet] = TiledJet(ijet)
tiledjet_set_jetinfo!(tiledjets[ijet], clusterseq, ijet, R2)
tiledjet_set_jetinfo!(tiledjets[ijet], clusterseq, ijet, R2, p)
end

# Now initalise all of the nearest neighbour tiles
Expand Down Expand Up @@ -400,7 +400,7 @@ function tiled_jet_reconstruct(particles::Vector{PseudoJet}; p = -1, R = 1.0, re
oldB = copy(jetB) # take a copy because we will need it...

tiledjet_remove_from_tiles!(clusterseq.tiling, jetB)
tiledjet_set_jetinfo!(jetB, clusterseq, nn, R2) # cause jetB to become _jets[nn]
tiledjet_set_jetinfo!(jetB, clusterseq, nn, R2, p) # cause jetB to become _jets[nn]
# (in addition, registers the jet in the tiling)
else
# Jet-beam recombination
Expand Down

0 comments on commit 7622f4b

Please sign in to comment.