Skip to content

Commit

Permalink
Remove non-parametrised outer constructor
Browse files Browse the repository at this point in the history
At the full constructor level the type parameter really should be known,
the use case for the non-explicit parametrised version is weak, so
it is removed. (This was also causing a docstring warning.)
  • Loading branch information
graeme-a-stewart committed Dec 6, 2024
1 parent 3bbe3fb commit f52aa36
Showing 1 changed file with 15 additions and 26 deletions.
41 changes: 15 additions & 26 deletions src/Pseudojet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,6 @@ Return the element type of the `PseudoJet` struct.
"""
Base.eltype(::Type{PseudoJet{T}}) where {T} = T

"""
PseudoJet(px::T, py::T, pz::T, E::T,
_cluster_hist_index::Int,
pt2::T) where {T <: Real}
Constructs a PseudoJet object with the given momentum components and energy and
history index.
# Arguments
- `px::T`: The x-component of the momentum.
- `py::T`: The y-component of the momentum.
- `pz::T`: The z-component of the momentum.
- `E::T`: The energy.
- `_cluster_hist_index::Int`: The cluster history index.
- `pt2::T`: The transverse momentum squared.
# Returns
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)

"""
PseudoJet{T}(px::T, py::T, pz::T, E::T,
_cluster_hist_index::Int,
Expand Down Expand Up @@ -120,10 +95,24 @@ Constructs a PseudoJet object with the given momentum components and energy.
A PseudoJet object, with type parameter `T`.
"""
PseudoJet(px::T, py::T,
pz::T, E::T) where {T <: Real} = PseudoJet(px, py, pz, E, 0, px^2 + py^2)
pz::T, E::T) where {T <: Real} = PseudoJet{T}(px, py, pz, E, 0, px^2 + py^2)

"""
PseudoJet{U}(px::T, py::T, pz::T, E::T) where T <: Real, U <: Real
Constructs a PseudoJet object with the given momentum components and energy,
parameterised by `U`.
# Arguments
- `px::T`: The x-component of the momentum.
- `py::T`: The y-component of the momentum.
- `pz::T`: The z-component of the momentum.
- `E::T`: The energy.
- U <: Real: The type parameter for the PseudoJet object.
# Returns
A PseudoJet object, with type parameter `U`.
"""
PseudoJet{U}(px::T, py::T, pz::T, E::T) where {T <: Real, U <: Real} = PseudoJet{U}(U(px),
U(py),
Expand Down

0 comments on commit f52aa36

Please sign in to comment.