diff --git a/src/ClusterSequence.jl b/src/ClusterSequence.jl index 6b46bb5..a6d0515 100644 --- a/src/ClusterSequence.jl +++ b/src/ClusterSequence.jl @@ -148,12 +148,13 @@ ClusterSequence(algorithm::JetAlgorithm.Algorithm, p::Real, R::Float64, strategy Qtot) end -ClusterSequence{T}(algorithm::JetAlgorithm.Algorithm, p::Real, R::Float64, strategy::RecoStrategy.Strategy, jets::Vector{T}, history, Qtot) where {T <: FourMomentum} = begin +function ClusterSequence{T}(algorithm::JetAlgorithm.Algorithm, p::Real, R::Float64, + strategy::RecoStrategy.Strategy, jets::Vector{T}, history, + Qtot) where {T <: FourMomentum} ClusterSequence{T}(algorithm, Float64(p), R, strategy, jets, length(jets), history, Qtot) end - """ add_step_to_history!(clusterseq::ClusterSequence, parent1, parent2, jetp_index, dij) diff --git a/src/EEAlgorithm.jl b/src/EEAlgorithm.jl index 589578e..12192ae 100644 --- a/src/EEAlgorithm.jl +++ b/src/EEAlgorithm.jl @@ -248,7 +248,7 @@ function ee_genkt_algorithm(particles::AbstractArray{T, 1}; p = 1, R = 4.0, for i in eachindex(particles) push!(recombination_particles, EEjet{ParticleType}(px(particles[i]), py(particles[i]), pz(particles[i]), - energy(particles[i]))) + energy(particles[i]))) end end @@ -299,8 +299,9 @@ function _ee_genkt_algorithm(; particles::Vector{EEjet{T}}, p = 1, R = 4.0, # Setup the initial history and get the total energy history, Qtot = initial_history(particles) - clusterseq = ClusterSequence{EEjet{ParticleType}}(algorithm, p, R, RecoStrategy.N2Plain, particles, history, - Qtot) + clusterseq = ClusterSequence{EEjet{ParticleType}}(algorithm, p, R, RecoStrategy.N2Plain, + particles, history, + Qtot) # Run over initial pairs of jets to find nearest neighbours get_angular_nearest_neighbours!(eereco, algorithm, dij_factor) diff --git a/src/EEjet.jl b/src/EEjet.jl index 9f6ec68..4e85d6d 100644 --- a/src/EEjet.jl +++ b/src/EEjet.jl @@ -27,14 +27,12 @@ mutable struct EEjet{T <: Real} <: FourMomentum _cluster_hist_index::Int end - """ Base.eltype(::Type{EEjet{T}}) where T Return the element type of the `EEjet` struct. """ -Base.eltype(::Type{EEjet{T}}) where T = T - +Base.eltype(::Type{EEjet{T}}) where {T} = T """ EEjet(px::T, py::T, pz::T, E::T, _cluster_hist_index::Integer) where {T <: Real} @@ -106,8 +104,8 @@ Constructs an `EEjet` object with conversion of the given momentum components An `EEjet` object with the momentum components and energy parametrised to type `U`. """ -EEjet{U}(px::T, py::T, pz::T, E::T) where {T <: Real, U <: Real} = EEjet(U(px), U(py), U(pz), U(E), 0) - +EEjet{U}(px::T, py::T, pz::T, E::T) where {T <: Real, U <: Real} = EEjet(U(px), U(py), + U(pz), U(E), 0) """ EEjet(pj::PseudoJet) -> EEjet @@ -122,7 +120,6 @@ Constructs an `EEjet` object from a given `PseudoJet` object `pj`. """ EEjet(pj::PseudoJet) = EEjet(px(pj), py(pj), pz(pj), energy(pj), cluster_hist_index(pj)) - p2(eej::EEjet) = eej._p2 pt2(eej::EEjet) = eej.px^2 + eej.py^2 const kt2 = pt2 diff --git a/src/PlainAlgo.jl b/src/PlainAlgo.jl index cbc396d..8b81c49 100644 --- a/src/PlainAlgo.jl +++ b/src/PlainAlgo.jl @@ -281,7 +281,7 @@ generalised k_t algorithm. """ function _plain_jet_reconstruct(; particles::Vector{PseudoJet{T}}, p = -1, R = 1.0, algorithm::JetAlgorithm.Algorithm = JetAlgorithm.AntiKt, - recombine = +) where T <: Real + recombine = +) where {T <: Real} # Bounds N::Int = length(particles) # Parameters @@ -308,8 +308,10 @@ function _plain_jet_reconstruct(; particles::Vector{PseudoJet{T}}, p = -1, R = 1 # Current implementation mutates the particles vector, so need to copy it # for the cluster sequence (there is too much copying happening, so this # needs to be rethought and reoptimised) - clusterseq = ClusterSequence{PseudoJet{ParticleType}}(algorithm, p, R, RecoStrategy.N2Plain, particles, history, - Qtot) + clusterseq = ClusterSequence{PseudoJet{ParticleType}}(algorithm, p, R, + RecoStrategy.N2Plain, particles, + history, + Qtot) # Initialize nearest neighbours @simd for i in 1:N diff --git a/src/Pseudojet.jl b/src/Pseudojet.jl index b3a5a27..3ce0ee6 100644 --- a/src/Pseudojet.jl +++ b/src/Pseudojet.jl @@ -53,7 +53,7 @@ end Return the element type of the `PseudoJet` struct. """ -Base.eltype(::Type{PseudoJet{T}}) where T = T +Base.eltype(::Type{PseudoJet{T}}) where {T} = T """ PseudoJet(px::T, py::T, pz::T, E::T, @@ -75,10 +75,10 @@ history index. A `PseudoJet` object. """ PseudoJet(px::T, py::T, pz::T, E::T, - _cluster_hist_index::Int, - pt2::T) where {T <: Real} = PseudoJet{T}(px, - py, pz, E, _cluster_hist_index, - pt2, 1.0 / pt2, _invalid_rap, _invalid_phi) +_cluster_hist_index::Int, +pt2::T) where {T <: Real} = PseudoJet{T}(px, + py, pz, E, _cluster_hist_index, + pt2, 1.0 / pt2, _invalid_rap, _invalid_phi) """ PseudoJet{T}(px::T, py::T, pz::T, E::T, @@ -100,10 +100,10 @@ and energy and history index. A `PseudoJet` object. """ PseudoJet{T}(px::T, py::T, pz::T, E::T, - _cluster_hist_index::Int, - pt2::T) where {T <: Real} = PseudoJet{T}(px, - py, pz, E, _cluster_hist_index, - pt2, 1.0 / pt2, _invalid_rap, _invalid_phi) +_cluster_hist_index::Int, +pt2::T) where {T <: Real} = PseudoJet{T}(px, + py, pz, E, _cluster_hist_index, + pt2, 1.0 / pt2, _invalid_rap, _invalid_phi) """ PseudoJet(px::T, py::T, pz::T, E::T) where T <: Real @@ -125,8 +125,12 @@ pz::T, E::T) where {T <: Real} = PseudoJet(px, py, pz, E, 0, px^2 + py^2) """ PseudoJet{U}(px::T, py::T, pz::T, E::T) where T <: Real, U <: Real """ -PseudoJet{U}(px::T, py::T, pz::T, E::T) where {T <: Real, U <: Real} = PseudoJet{U}(U(px), U(py), U(pz), U(E), 0, U(px^2 + py^2)) - +PseudoJet{U}(px::T, py::T, pz::T, E::T) where {T <: Real, U <: Real} = PseudoJet{U}(U(px), + U(py), + U(pz), + U(E), 0, + U(px^2 + + py^2)) import Base.show """ diff --git a/src/TiledAlgoLL.jl b/src/TiledAlgoLL.jl index 34c53de..dd578c4 100644 --- a/src/TiledAlgoLL.jl +++ b/src/TiledAlgoLL.jl @@ -385,8 +385,9 @@ function tiled_jet_reconstruct(particles::AbstractArray{T, 1}; p::Union{Real, No sizehint!(recombination_particles, length(particles) * 2) for i in eachindex(particles) push!(recombination_particles, - PseudoJet{ParticleType}(px(particles[i]), py(particles[i]), pz(particles[i]), - energy(particles[i]))) + PseudoJet{ParticleType}(px(particles[i]), py(particles[i]), + pz(particles[i]), + energy(particles[i]))) end end @@ -424,7 +425,7 @@ tiled_jet_reconstruct(particles::Vector{PseudoJet}; p = 1, R = 1.0, recombine = """ function _tiled_jet_reconstruct(particles::Vector{PseudoJet{T}}; p::Real = -1, R = 1.0, algorithm::JetAlgorithm.Algorithm = JetAlgorithm.AntiKt, - recombine = +) where T <: Real + recombine = +) where {T <: Real} # Bounds N::Int = length(particles) @@ -468,7 +469,9 @@ function _tiled_jet_reconstruct(particles::Vector{PseudoJet{T}}; p::Real = -1, R tiling = Tiling(setup_tiling(_eta, R)) # ClusterSequence is the struct that holds the state of the reconstruction - clusterseq = ClusterSequence{PseudoJet{ParticleType}}(algorithm, p, R, RecoStrategy.N2Tiled, jets, history, Qtot) + clusterseq = ClusterSequence{PseudoJet{ParticleType}}(algorithm, p, R, + RecoStrategy.N2Tiled, jets, + history, Qtot) # Tiled jets is a structure that has additional variables for tracking which tile a jet is in tiledjets = similar(clusterseq.jets, TiledJet)