Skip to content

Commit 5487316

Browse files
Make use of the known jet type parameter
The particle type is know in the function signature of the underlying reconstruction
1 parent f52aa36 commit 5487316

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/EEAlgorithm.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ function ee_genkt_algorithm(particles::AbstractArray{T, 1}; p = 1, R = 4.0,
242242
recombination_particles = copy(particles)
243243
sizehint!(recombination_particles, length(particles) * 2)
244244
else
245+
# We don't really know what element type we have here, so we need to
246+
# drill down to a component to get that underlying type
245247
ParticleType = typeof(px(particles[1]))
246248
recombination_particles = EEjet{ParticleType}[]
247249
sizehint!(recombination_particles, length(particles) * 2)
@@ -275,7 +277,7 @@ function _ee_genkt_algorithm(; particles::Vector{EEjet{T}}, p = 1, R = 4.0,
275277
R2 = R^2
276278

277279
# Numerical type?
278-
ParticleType = eltype(particles[1])
280+
ParticleType = T
279281

280282
# Constant factor for the dij metric and the beam distance function
281283
if algorithm == JetAlgorithm.Durham

src/PlainAlgo.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ function plain_jet_reconstruct(particles::AbstractArray{T, 1}; p::Union{Real, No
236236
recombination_particles = copy(particles)
237237
sizehint!(recombination_particles, length(particles) * 2)
238238
else
239+
# We don't really know what element type we have here, so we need to
240+
# drill down to a component to get that underlying type
239241
ParticleType = typeof(px(particles[1]))
240242
recombination_particles = PseudoJet{ParticleType}[]
241243
sizehint!(recombination_particles, length(particles) * 2)
@@ -288,7 +290,7 @@ function _plain_jet_reconstruct(; particles::Vector{PseudoJet{T}}, p = -1, R = 1
288290
R2 = R^2
289291

290292
# Numerical type for this reconstruction
291-
ParticleType = eltype(particles[1])
293+
ParticleType = T
292294

293295
# Optimised compact arrays for determining the next merge step
294296
# We make sure these arrays are type stable - have seen issues where, depending on the values

src/TiledAlgoLL.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,8 @@ function tiled_jet_reconstruct(particles::AbstractArray{T, 1}; p::Union{Real, No
380380
recombination_particles = copy(particles)
381381
sizehint!(recombination_particles, length(particles) * 2)
382382
else
383+
# We don't really know what element type we have here, so we need to
384+
# drill down to a component to get that underlying type
383385
ParticleType = typeof(px(particles[1]))
384386
recombination_particles = PseudoJet{ParticleType}[]
385387
sizehint!(recombination_particles, length(particles) * 2)
@@ -442,7 +444,7 @@ function _tiled_jet_reconstruct(particles::Vector{PseudoJet{T}}; p::Real = -1, R
442444
p = (round(p) == p) ? Int(p) : p # integer p if possible
443445

444446
# Numerical type for this reconstruction
445-
ParticleType = eltype(particles[1])
447+
ParticleType = T
446448

447449
# This will be used quite deep inside loops, so declare it here so that
448450
# memory (de)allocation gets done only once

0 commit comments

Comments
 (0)