Skip to content

Commit 94dee65

Browse files
committed
add support for GenKt
1 parent 68e3ffd commit 94dee65

File tree

6 files changed

+27
-14
lines changed

6 files changed

+27
-14
lines changed

compile/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@ int main(int argc, char *argv[]) {
6060
/*Call jet reconstruction*/
6161
jetreconstruction_JetAlgorithm algorithm = JETRECONSTRUCTION_JETALGORITHM_CA;
6262
double R = 3.0;
63+
double power = 0.0;
6364
jetreconstruction_RecoStrategy strategy = JETRECONSTRUCTION_RECOSTRATEGY_BEST;
6465
jetreconstruction_RecombinationScheme recombination = JETRECONCSTRUCTION_RECOMBINATIONSCHEME_ESCHEME;
6566
6667
jetreconstruction_ClusterSequence cluster_seq;
67-
jetreconstruction_StatusCode sc = jetreconstruction_jet_reconstruct(particles, len, algorithm, R,
68+
jetreconstruction_StatusCode sc = jetreconstruction_jet_reconstruct(particles, len, algorithm, power, R,
6869
strategy, recombination, &cluster_seq);
6970
if (sc != JETRECONSTRUCTION_STATUSCODE_OK){
7071
/*An error occurred check the value or stderr for more information*/

compile/downstream/jetreconstruction_test.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,15 @@ int main(int argc, char *argv[]) {
6565
sc = jetreconstruction_PseudoJet_init(&particles[1], 1.0, 2.0, 3.0, 4.0, 2);
6666
assert(sc == JETRECONSTRUCTION_STATUSCODE_OK);
6767

68-
jetreconstruction_JetAlgorithm algorithm = JETRECONSTRUCTION_JETALGORITHM_CA;
68+
jetreconstruction_JetAlgorithm algorithm = JETRECONSTRUCTION_JETALGORITHM_GENKT;
6969
double R = 3.0;
70+
double power = 0.5;
7071
jetreconstruction_RecoStrategy strategy = JETRECONSTRUCTION_RECOSTRATEGY_BEST;
7172
jetreconstruction_RecombinationScheme recombination =
7273
JETRECONCSTRUCTION_RECOMBINATIONSCHEME_ESCHEME;
7374

7475
jetreconstruction_ClusterSequence cluster_seq;
75-
sc = jetreconstruction_jet_reconstruct(particles, len, algorithm, R, strategy,
76+
sc = jetreconstruction_jet_reconstruct(particles, len, algorithm, power, R, strategy,
7677
recombination, &cluster_seq);
7778
assert(sc == JETRECONSTRUCTION_STATUSCODE_OK);
7879

compile/include/JetReconstruction.h.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ static inline void jetreconstruction_ClusterSequence_free_members(
247247
* reconstruction.
248248
* @param[in] particles_length The length of @p particles array.
249249
* @param[in] algorithm The algorithm to use for jet reconstruction.
250+
* @param[in] power The power value used for the distance measure for
251+
* generalised k_T algorithms (GenKt, EEKt). Other algorithms will ignore this
252+
* value.
250253
* @param[in] R The jet radius parameter.
251254
* @param[in] strategy The jet reconstruction strategy to use.
252255
* @param[in] recombination_scheme The recombination scheme used for combining
@@ -258,7 +261,7 @@ static inline void jetreconstruction_ClusterSequence_free_members(
258261
*/
259262
jetreconstruction_StatusCode jetreconstruction_jet_reconstruct(
260263
const jetreconstruction_PseudoJet *particles, size_t particles_length,
261-
jetreconstruction_JetAlgorithm algorithm, double R,
264+
jetreconstruction_JetAlgorithm algorithm, double power, double R,
262265
jetreconstruction_RecoStrategy strategy,
263266
jetreconstruction_RecombinationScheme recombination_scheme,
264267
jetreconstruction_ClusterSequence *result);

compile/precompile_execution.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ end
1919

2020
R = 2.0
2121
jets_len = Csize_t(2)
22+
power = 0.5
2223

2324
### pp jets ###
2425

@@ -33,15 +34,15 @@ assert_ok(jetreconstruction_PseudoJet_init(jets_ptr, 0.0, 1.0, 2.0, 3.0, 1))
3334
assert_ok(jetreconstruction_PseudoJet_init(jets_ptr + sizeof(PseudoJet), 1.0, 2.0, 3.0,
3435
4.0, 2))
3536

36-
for algorithm in [JetAlgorithm.AntiKt, JetAlgorithm.CA, JetAlgorithm.Kt],
37+
for algorithm in [JetAlgorithm.AntiKt, JetAlgorithm.CA, JetAlgorithm.Kt, JetAlgorithm.GenKt],
3738
strategy in [RecoStrategy.N2Plain, RecoStrategy.N2Tiled, RecoStrategy.Best],
3839
recombination in [
3940
RecombinationScheme.EScheme,
4041
RecombinationScheme.PtScheme,
4142
RecombinationScheme.Pt2Scheme
4243
]
4344

44-
assert_ok(jetreconstruction_jet_reconstruct(jets_ptr, jets_len, algorithm, R,
45+
assert_ok(jetreconstruction_jet_reconstruct(jets_ptr, jets_len, algorithm, power, R,
4546
strategy, recombination,
4647
clustersequence_ptr))
4748

src/C_JetReconstruction/C_JetReconstruction.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ end
231231
c_jet_reconstruct(particles::Ptr{T},
232232
particles_length::Csize_t,
233233
algorithm::JetAlgorithm.Algorithm,
234+
power::Cdouble,
234235
R::Cdouble,
235236
strategy::RecoStrategy.Strategy,
236237
recombination_scheme::RecombinationScheme.Recombine,
@@ -242,6 +243,7 @@ Internal helper functions for calling `jet_reconstruct` with C-compatible data-s
242243
- `particles::Ptr{T}`: Pointer to an array of pseudojet objects used for jet reconstruction.
243244
- `particles_length::Csize_t`: The length of `particles`` array.
244245
- `algorithm::JetAlgorithm.Algorithm`: The algorithm to use for jet reconstruction.
246+
- `power::Cdouble`: The power value used for the distance measure for generalised k_T algorithms (GenKt, EEKt). Other algorithms will ignore this value.
245247
- `R::Cdouble`: The jet radius parameter.
246248
- `strategy::RecoStrategy.Strategy`: The jet reconstruction strategy to use.
247249
- `recombination_scheme::RecombinationScheme.Recombine`: The recombination scheme used for combining particles.
@@ -256,13 +258,14 @@ Internal helper functions for calling `jet_reconstruct` with C-compatible data-s
256258
function c_jet_reconstruct(particles::Ptr{T},
257259
particles_length::Csize_t,
258260
algorithm::JetAlgorithm.Algorithm,
261+
power::Cdouble,
259262
R::Cdouble,
260263
strategy::RecoStrategy.Strategy,
261264
recombination_scheme::RecombinationScheme.Recombine,
262265
result::Ptr{C_ClusterSequence{U}}) where {T, U}
263266
try
264267
particles_v = unsafe_wrap(Vector{T}, particles, particles_length)
265-
clusterseq = jet_reconstruct(particles_v; p = nothing, algorithm = algorithm, R = R,
268+
clusterseq = jet_reconstruct(particles_v; p = power, algorithm = algorithm, R = R,
266269
strategy = strategy,
267270
RecombinationMethods[recombination_scheme]...)
268271
c_clusterseq = C_ClusterSequence{U}(clusterseq)
@@ -278,6 +281,7 @@ end
278281
jetreconstruction_jet_reconstruct(particles::Ptr{PseudoJet},
279282
particles_length::Csize_t,
280283
algorithm::JetAlgorithm.Algorithm,
284+
power::Cdouble,
281285
R::Cdouble,
282286
strategy::RecoStrategy.Strategy,
283287
recombination_scheme::RecombinationScheme.Recombine,
@@ -289,7 +293,8 @@ C-binding for `jet_reconstruct`.
289293
- `particles::Ptr{PseudoJet}`: Pointer to an array of pseudojet objects used for jet reconstruction.
290294
- `particles_length::Csize_t`: The length of `particles`` array.
291295
- `algorithm::JetAlgorithm.Algorithm`: The algorithm to use for jet reconstruction.
292-
- `R::Cdouble`: The jet radius parameter..
296+
- `power::Cdouble`: The power value used for the distance measure for generalised k_T algorithms (GenKt, EEKt). Other algorithms will ignore this value.
297+
- `R::Cdouble`: The jet radius parameter.
293298
- `strategy::RecoStrategy.Strategy`: The jet reconstruction strategy to use.
294299
- `recombination_scheme::RecombinationScheme.Recombine`: The recombination scheme used for combining particles.
295300
- `result::Ptr{C_ClusterSequence{PseudoJet}}`: A pointer to which a cluster sequence containing the reconstructed jets and the merging history will be stored.
@@ -304,11 +309,12 @@ C-binding for `jet_reconstruct`.
304309
Base.@ccallable function jetreconstruction_jet_reconstruct(particles::Ptr{PseudoJet},
305310
particles_length::Csize_t,
306311
algorithm::JetAlgorithm.Algorithm,
312+
power::Cdouble,
307313
R::Cdouble,
308314
strategy::RecoStrategy.Strategy,
309315
recombination_scheme::RecombinationScheme.Recombine,
310316
result::Ptr{C_ClusterSequence{PseudoJet}})::Cint
311-
return c_jet_reconstruct(particles, particles_length, algorithm, R, strategy,
317+
return c_jet_reconstruct(particles, particles_length, algorithm, power, R, strategy,
312318
recombination_scheme, result)
313319
end
314320

test/test-c-interface.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function test_pseudojet()
4747
struct_approx_equal(jet, c_jet)
4848
end
4949

50-
function test_jet_reconstruct(filename; algorithm, R, strategy, recombine, power = nothing,
50+
function test_jet_reconstruct(filename; algorithm, R, strategy, recombine, power = 0.0,
5151
T = PseudoJet)
5252
@testset "C-interface jet reconstruct" begin
5353
events = JetReconstruction.read_final_state_particles(filename)
@@ -62,6 +62,7 @@ function test_jet_reconstruct(filename; algorithm, R, strategy, recombine, power
6262
ret = C_JetReconstruction.jetreconstruction_jet_reconstruct(c_event,
6363
c_event_length,
6464
algorithm,
65+
power,
6566
R,
6667
strategy,
6768
recombine,
@@ -139,20 +140,20 @@ end
139140
@testset "C-interface JetReconstruction pp" begin
140141
test_cone_size = 0.4
141142
test_recombine_scheme = RecombinationScheme.EScheme
143+
test_power = 0.5
142144

143145
test_pseudojet()
144146

145-
for alg in [JetAlgorithm.AntiKt, JetAlgorithm.CA, JetAlgorithm.Kt],
147+
for alg in [JetAlgorithm.AntiKt, JetAlgorithm.CA, JetAlgorithm.Kt, JetAlgorithm.GenKt],
146148
stg in [RecoStrategy.Best, RecoStrategy.N2Plain, RecoStrategy.N2Tiled]
147149

148-
power = JetReconstruction.algorithm2power[alg]
149-
@testset "C-interface JetReconstruction comparison: alg=$alg, p=$power, R=$test_cone_size, strategy=$stg" begin
150+
@testset "C-interface JetReconstruction comparison: alg=$alg, R=$test_cone_size, strategy=$stg" begin
150151
cluster_seq_ptrs, cluster_seqs = test_jet_reconstruct(events_file_pp;
151152
algorithm = alg,
152153
strategy = stg,
153154
recombine = test_recombine_scheme,
154155
R = test_cone_size,
155-
power = power)
156+
power = test_power)
156157
test_inclusive_jets(cluster_seq_ptrs, cluster_seqs; ptmin = 5.0)
157158
if alg != JetAlgorithm.AntiKt
158159
test_exclusive_jets_njets(cluster_seq_ptrs, cluster_seqs; njets = 4)

0 commit comments

Comments
 (0)