Skip to content

Commit dd58e14

Browse files
committed
allow exclusive and inclusive jets to return jet type used in clusterseq
1 parent 45b6665 commit dd58e14

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/ClusterSequence.jl

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ add_step_to_history!(clusterseq::ClusterSequence, parent1, parent2, jetp_index,
214214
end
215215

216216
"""
217-
inclusive_jets(clusterseq::ClusterSequence; ptmin = 0.0, T = LorentzVectorCyl)
217+
inclusive_jets(clusterseq::ClusterSequence{U}; ptmin = 0.0, T = LorentzVectorCyl) where {U}
218218
219219
Return all inclusive jets of a ClusterSequence with pt > ptmin.
220220
@@ -234,16 +234,18 @@ It iterates over the clustering history and checks the transverse momentum of
234234
each parent jet. If the transverse momentum is greater than or equal to `ptmin`,
235235
the jet is added to the array of inclusive jets.
236236
237-
Valid return types are `LorentzVectorCyl` and `PseudoJet` (N.B. this will evolve
238-
in the future to be any subtype of `FourMomemntumBase`; currently unrecognised types
239-
will return `LorentzVectorCyl`).
237+
Valid return types are `LorentzVectorCyl` and the jet type of the input `clusterseq`
238+
(`U` - either `PseudoJet` or `EEjet` depending which algorithm was used)
239+
(N.B. this will evolve in the future to be any subtype of `FourMomentumBase`;
240+
currently unrecognised types will return `LorentzVectorCyl`).
240241
241242
# Example
242243
```julia
243244
inclusive_jets(clusterseq; ptmin = 10.0)
244245
```
245246
"""
246-
function inclusive_jets(clusterseq::ClusterSequence; ptmin = 0.0, T = LorentzVectorCyl)
247+
function inclusive_jets(clusterseq::ClusterSequence{U}; ptmin = 0.0,
248+
T = LorentzVectorCyl) where {U}
247249
pt2min = ptmin * ptmin
248250
jets_local = T[]
249251
# sizehint!(jets_local, length(clusterseq.jets))
@@ -257,7 +259,7 @@ function inclusive_jets(clusterseq::ClusterSequence; ptmin = 0.0, T = LorentzVec
257259
jet = clusterseq.jets[iparent_jet]
258260
if pt2(jet) >= pt2min
259261
@debug "Added inclusive jet index $iparent_jet"
260-
if T == PseudoJet
262+
if T == U
261263
push!(jets_local, jet)
262264
else
263265
push!(jets_local,
@@ -269,7 +271,7 @@ function inclusive_jets(clusterseq::ClusterSequence; ptmin = 0.0, T = LorentzVec
269271
end
270272

271273
"""
272-
exclusive_jets(clusterseq::ClusterSequence; dcut = nothing, njets = nothing, T = LorentzVectorCyl)
274+
exclusive_jets(clusterseq::ClusterSequence{U}; dcut = nothing, njets = nothing, T = LorentzVectorCyl) where {U}
273275
274276
Return all exclusive jets of a ClusterSequence, with either a specific number of
275277
jets or a cut on the maximum distance parameter.
@@ -290,9 +292,10 @@ jets or a cut on the maximum distance parameter.
290292
# Returns
291293
- An array of `T` objects representing the exclusive jets.
292294
293-
Valid return types are `LorentzVectorCyl` and `PseudoJet` (N.B. this will evolve
294-
in the future to be any subtype of `FourMomemntumBase`; currently unrecognised types
295-
will return `LorentzVectorCyl`)
295+
Valid return types are `LorentzVectorCyl` and the jet type of the input `clusterseq`
296+
(`U` - either `PseudoJet` or `EEjet` depending which algorithm was used)
297+
(N.B. this will evolve in the future to be any subtype of `FourMomentumBase`;
298+
currently unrecognised types will return `LorentzVectorCyl`).
296299
297300
# Exceptions
298301
- `ArgumentError`: If neither `dcut` nor `njets` is provided.
@@ -307,8 +310,8 @@ exclusive_jets(clusterseq, dcut = 20.0)
307310
exclusive_jets(clusterseq, njets = 3, T = PseudoJet)
308311
```
309312
"""
310-
function exclusive_jets(clusterseq::ClusterSequence; dcut = nothing, njets = nothing,
311-
T = LorentzVectorCyl)
313+
function exclusive_jets(clusterseq::ClusterSequence{U}; dcut = nothing, njets = nothing,
314+
T = LorentzVectorCyl) where {U}
312315
if isnothing(dcut) && isnothing(njets)
313316
throw(ArgumentError("Must pass either a dcut or an njets value"))
314317
end
@@ -343,7 +346,7 @@ function exclusive_jets(clusterseq::ClusterSequence; dcut = nothing, njets = not
343346
if (parent < stop_point && parent > 0)
344347
@debug "Added exclusive jet index $(clusterseq.history[parent].jetp_index)"
345348
jet = clusterseq.jets[clusterseq.history[parent].jetp_index]
346-
if (T == PseudoJet) || (T == EEjet)
349+
if T == U
347350
push!(excl_jets, jet)
348351
else
349352
push!(excl_jets,

0 commit comments

Comments
 (0)