Skip to content

Commit 8a108f2

Browse files
committed
add cluster history index argument to pseudojet init
1 parent 6cff5c4 commit 8a108f2

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

compile/downstream/jetreconstruction_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ int main(int argc, char *argv[]) {
6060
#endif
6161
size_t len = 2;
6262
jetreconstruction_PseudoJet particles[2];
63-
sc = jetreconstruction_PseudoJet_init(&particles[0], 0.0, 1.0, 2.0, 3.0);
63+
sc = jetreconstruction_PseudoJet_init(&particles[0], 0.0, 1.0, 2.0, 3.0, 1);
6464
assert(sc == JETRECONSTRUCTION_STATUSCODE_OK);
65-
sc = jetreconstruction_PseudoJet_init(&particles[1], 1.0, 2.0, 3.0, 4.0);
65+
sc = jetreconstruction_PseudoJet_init(&particles[1], 1.0, 2.0, 3.0, 4.0, 2);
6666
assert(sc == JETRECONSTRUCTION_STATUSCODE_OK);
6767

6868
jetreconstruction_JetAlgorithm algorithm = JETRECONSTRUCTION_JETALGORITHM_CA;

compile/include/JetReconstruction.h.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,13 @@ typedef struct {
132132
* @param[in] py The y-component of the momentum.
133133
* @param[in] pz The z-component of the momentum.
134134
* @param[in] E The energy component of the momentum.
135+
* @param[in] cluter_hist_index The index of the cluster history.
135136
* @return An integer status code indicating the success or failure. See common
136137
* status codes jetreconstruction_StatusCode.
137138
*/
138139
jetreconstruction_StatusCode
139140
jetreconstruction_PseudoJet_init(jetreconstruction_PseudoJet *ptr, double px,
140-
double py, double pz, double E);
141+
double py, double pz, double E, long cluter_hist_index);
141142

142143
/**
143144
* @struct jetreconstruction_HistoryElement

compile/precompile_execution.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ clustersequence_ptr = Ptr{C_ClusterSequence{PseudoJet}}(Libc.malloc(sizeof(C_Clu
2929
results_ptr = Ptr{C_JetsResult{PseudoJet}}(Libc.malloc(sizeof(C_JetsResult{PseudoJet})))
3030
@assert results_ptr != C_NULL
3131

32-
assert_ok(jetreconstruction_PseudoJet_init(jets_ptr, 0.0, 1.0, 2.0, 3.0))
32+
assert_ok(jetreconstruction_PseudoJet_init(jets_ptr, 0.0, 1.0, 2.0, 3.0, 1))
3333
assert_ok(jetreconstruction_PseudoJet_init(jets_ptr + sizeof(PseudoJet), 1.0, 2.0, 3.0,
34-
4.0))
34+
4.0, 2))
3535

3636
for algorithm in [JetAlgorithm.AntiKt, JetAlgorithm.CA, JetAlgorithm.Kt]
3737
for strategy in [RecoStrategy.N2Plain, RecoStrategy.N2Tiled, RecoStrategy.Best]

src/C_JetReconstruction/C_JetReconstruction.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ function make_c_array(v::Vector{T}) where {T}
119119
end
120120

121121
"""
122-
jetreconstruction_PseudoJet_init(ptr::Ptr{PseudoJet}, px::Cdouble, py::Cdouble, pz::Cdouble, E::Cdouble) -> Cint
123-
122+
jetreconstruction_PseudoJet_init(ptr::Ptr{PseudoJet}, px::Cdouble,
123+
py::Cdouble, pz::Cdouble,
124+
E::Cdouble, cluster_hist_index::Clong) -> Cint
124125
C-binding for `PseudoJet` initialization.
125126
126127
# Arguments
@@ -129,16 +130,18 @@ C-binding for `PseudoJet` initialization.
129130
- `py::Cdouble`: The y-component of the momentum.
130131
- `pz::Cdouble`: The z-component of the momentum.
131132
- `E::Cdouble`: The energy of the jet.
133+
- `cluster_hist_index::Clong`: The index of the cluster history.
132134
133135
# Returns
134136
- `Cint`: An integer status code indicating the success or failure.
135137
136138
"""
137139
Base.@ccallable function jetreconstruction_PseudoJet_init(ptr::Ptr{PseudoJet}, px::Cdouble,
138140
py::Cdouble, pz::Cdouble,
139-
E::Cdouble)::Cint
141+
E::Cdouble,
142+
cluster_hist_index::Clong)::Cint
140143
try
141-
pseudojet = PseudoJet(px, py, pz, E)
144+
pseudojet = PseudoJet(px, py, pz, E; cluster_hist_index = cluster_hist_index)
142145
unsafe_store!(ptr, pseudojet)
143146
catch e
144147
return handle_exception(e)

test/test-c-interface.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ end
4141
function test_pseudojet()
4242
ptr = Ptr{PseudoJet}(Libc.malloc(sizeof(PseudoJet)))
4343
@test ptr != C_NULL
44-
ret = C_JetReconstruction.jetreconstruction_PseudoJet_init(ptr, 0.1, 0.2, 0.3, 1.0)
44+
ret = C_JetReconstruction.jetreconstruction_PseudoJet_init(ptr, 0.1, 0.2, 0.3, 1.0, 1)
4545
@test C_JetReconstruction.StatusCode.T(ret) == C_JetReconstruction.StatusCode.OK
4646
c_jet = unsafe_load(ptr)
47-
jet = PseudoJet(0.1, 0.2, 0.3, 1.0)
47+
jet = PseudoJet(0.1, 0.2, 0.3, 1.0; cluster_hist_index = 1)
4848
struct_approx_equal(jet, c_jet)
4949
end
5050

0 commit comments

Comments
 (0)