@@ -9,8 +9,8 @@ using Logging
9
9
const events_file = joinpath (@__DIR__ , " data" , " events.hepmc3" )
10
10
11
11
const algorithms = Dict (- 1 => " Anti-kt" ,
12
- 0 => " Cambridge/Achen" ,
13
- 1 => " Inclusive-kt" )
12
+ 0 => " Cambridge/Achen" ,
13
+ 1 => " Inclusive-kt" )
14
14
15
15
""" Simple structure with necessary parameters for an exclusive selection test"""
16
16
struct InclusiveTest
@@ -70,9 +70,12 @@ function main()
70
70
unpack_events (events_file)
71
71
72
72
# Read our fastjet inclusive outputs (we read for anti-kt, cambridge/achen, inclusive-kt)
73
- fastjet_alg_files_inclusive = Dict (- 1 => joinpath (@__DIR__ , " data" , " jet-collections-fastjet-inclusive-akt.json" ),
74
- 0 => joinpath (@__DIR__ , " data" , " jet-collections-fastjet-inclusive-ca.json" ),
75
- 1 => joinpath (@__DIR__ , " data" , " jet-collections-fastjet-inclusive-ikt.json" ))
73
+ fastjet_alg_files_inclusive = Dict (- 1 => joinpath (@__DIR__ , " data" ,
74
+ " jet-collections-fastjet-inclusive-akt.json" ),
75
+ 0 => joinpath (@__DIR__ , " data" ,
76
+ " jet-collections-fastjet-inclusive-ca.json" ),
77
+ 1 => joinpath (@__DIR__ , " data" ,
78
+ " jet-collections-fastjet-inclusive-ikt.json" ))
76
79
77
80
fastjet_data = Dict {Int, Vector{Any}} ()
78
81
for (k, v) in pairs (fastjet_alg_files_inclusive)
@@ -83,8 +86,10 @@ function main()
83
86
84
87
# Test each stratgy for inclusive jet selection
85
88
for power in keys (algorithms)
86
- do_test_compare_to_fastjet (RecoStrategy. N2Plain, fastjet_data[power], algname = algorithms[power], power = power)
87
- do_test_compare_to_fastjet (RecoStrategy. N2Tiled, fastjet_data[power], algname = algorithms[power], power = power)
89
+ do_test_compare_to_fastjet (RecoStrategy. N2Plain, fastjet_data[power],
90
+ algname = algorithms[power], power = power)
91
+ do_test_compare_to_fastjet (RecoStrategy. N2Tiled, fastjet_data[power],
92
+ algname = algorithms[power], power = power)
88
93
end
89
94
90
95
# Compare inputing data in PseudoJet with using a LorentzVector
@@ -93,17 +98,27 @@ function main()
93
98
94
99
# Now test exclusive selections
95
100
inclusive_tests = InclusiveTest[]
96
- push! (inclusive_tests, InclusiveTest (" exclusive njets=4" , 1 , " jet-collections-fastjet-njets4-ikt.json" , nothing , 4 ))
97
- push! (inclusive_tests, InclusiveTest (" exclusive dijmax=20" , 1 , " jet-collections-fastjet-dij20-ikt.json" , 20.0 , nothing ))
98
- push! (inclusive_tests, InclusiveTest (" exclusive njets=4" , 0 , " jet-collections-fastjet-njets4-ca.json" , nothing , 4 ))
99
- push! (inclusive_tests, InclusiveTest (" exclusive dijmax=0.99" , 0 , " jet-collections-fastjet-dij099-ca.json" , 0.99 , nothing ))
101
+ push! (inclusive_tests,
102
+ InclusiveTest (" exclusive njets=4" , 1 , " jet-collections-fastjet-njets4-ikt.json" ,
103
+ nothing , 4 ))
104
+ push! (inclusive_tests,
105
+ InclusiveTest (" exclusive dijmax=20" , 1 , " jet-collections-fastjet-dij20-ikt.json" ,
106
+ 20.0 , nothing ))
107
+ push! (inclusive_tests,
108
+ InclusiveTest (" exclusive njets=4" , 0 , " jet-collections-fastjet-njets4-ca.json" ,
109
+ nothing , 4 ))
110
+ push! (inclusive_tests,
111
+ InclusiveTest (" exclusive dijmax=0.99" , 0 ,
112
+ " jet-collections-fastjet-dij099-ca.json" , 0.99 , nothing ))
100
113
101
114
for test in inclusive_tests
102
115
input_file = joinpath (@__DIR__ , " data" , test. fastjet_file)
103
116
fastjet_jets = read_fastjet_outputs (input_file)
104
117
sort_jets! (fastjet_jets)
105
- do_test_compare_to_fastjet (RecoStrategy. N2Tiled, fastjet_jets; algname = test. algname,
106
- power = test. power, selection = test. selction, njets = test. njets, dijmax = test. dijmax)
118
+ do_test_compare_to_fastjet (RecoStrategy. N2Tiled, fastjet_jets;
119
+ algname = test. algname,
120
+ power = test. power, selection = test. selction,
121
+ njets = test. njets, dijmax = test. dijmax)
107
122
end
108
123
end
109
124
@@ -116,13 +131,13 @@ njets -> apply inclusive njets cut
116
131
If dijmax and njets are nothing, test inclusive jets with pt >= ptmin
117
132
"""
118
133
function do_test_compare_to_fastjet (strategy:: RecoStrategy.Strategy , fastjet_jets;
119
- algname = " Unknown" ,
120
- selection = " Inclusive" ,
121
- ptmin:: Float64 = 5.0 ,
122
- distance:: Float64 = 0.4 ,
123
- power:: Integer = - 1 ,
124
- dijmax = nothing ,
125
- njets = nothing )
134
+ algname = " Unknown" ,
135
+ selection = " Inclusive" ,
136
+ ptmin:: Float64 = 5.0 ,
137
+ distance:: Float64 = 0.4 ,
138
+ power:: Integer = - 1 ,
139
+ dijmax = nothing ,
140
+ njets = nothing )
126
141
127
142
# Strategy
128
143
if (strategy == RecoStrategy. N2Plain)
@@ -169,9 +184,9 @@ function do_test_compare_to_fastjet(strategy::RecoStrategy.Strategy, fastjet_jet
169
184
# the momentum
170
185
# Sometimes phi could be in the range [-π, π], but FastJet always is [0, 2π]
171
186
normalised_phi = jet. phi < 0.0 ? jet. phi + 2 π : jet. phi
172
- @test jet. rap ≈ fastjet_jets[ievt][" jets" ][ijet][" rap" ] atol = 1e-7
173
- @test normalised_phi ≈ fastjet_jets[ievt][" jets" ][ijet][" phi" ] atol = 1e-7
174
- @test jet. pt ≈ fastjet_jets[ievt][" jets" ][ijet][" pt" ] rtol = 1e-6
187
+ @test jet. rap≈ fastjet_jets[ievt][" jets" ][ijet][" rap" ] atol= 1e-7
188
+ @test normalised_phi≈ fastjet_jets[ievt][" jets" ][ijet][" phi" ] atol= 1e-7
189
+ @test jet. pt≈ fastjet_jets[ievt][" jets" ][ijet][" pt" ] rtol= 1e-6
175
190
end
176
191
end
177
192
end
@@ -180,10 +195,10 @@ function do_test_compare_to_fastjet(strategy::RecoStrategy.Strategy, fastjet_jet
180
195
end
181
196
182
197
function do_test_compare_types (strategy:: RecoStrategy.Strategy ;
183
- algname = " Unknown" ,
184
- ptmin:: Float64 = 5.0 ,
185
- distance:: Float64 = 0.4 ,
186
- power:: Integer = - 1 )
198
+ algname = " Unknown" ,
199
+ ptmin:: Float64 = 5.0 ,
200
+ distance:: Float64 = 0.4 ,
201
+ power:: Integer = - 1 )
187
202
188
203
# Strategy
189
204
if (strategy == RecoStrategy. N2Plain)
@@ -201,7 +216,8 @@ function do_test_compare_types(strategy::RecoStrategy.Strategy;
201
216
events:: Vector{Vector{PseudoJet}} = read_final_state_particles (events_file)
202
217
jet_collection = FinalJets[]
203
218
for (ievt, event) in enumerate (events)
204
- finaljets = final_jets (inclusive_jets (jet_reconstruction (event, R = distance, p = power), ptmin))
219
+ finaljets = final_jets (inclusive_jets (jet_reconstruction (event, R = distance,
220
+ p = power), ptmin))
205
221
sort_jets! (finaljets)
206
222
push! (jet_collection, FinalJets (ievt, finaljets))
207
223
end
@@ -210,7 +226,8 @@ function do_test_compare_types(strategy::RecoStrategy.Strategy;
210
226
events_lv:: Vector{Vector{LorentzVector}} = read_final_state_particles_lv (events_file)
211
227
jet_collection_lv = FinalJets[]
212
228
for (ievt, event) in enumerate (events_lv)
213
- finaljets = final_jets (inclusive_jets (jet_reconstruction (event, R = distance, p = power), ptmin))
229
+ finaljets = final_jets (inclusive_jets (jet_reconstruction (event, R = distance,
230
+ p = power), ptmin))
214
231
sort_jets! (finaljets)
215
232
push! (jet_collection_lv, FinalJets (ievt, finaljets))
216
233
end
@@ -222,9 +239,9 @@ function do_test_compare_types(strategy::RecoStrategy.Strategy;
222
239
@test size (event. jets) == size (event_lv. jets)
223
240
# Test each jet in turn
224
241
for (jet, jet_lv) in zip (event. jets, event_lv. jets)
225
- @test jet. rap ≈ jet_lv. rap atol = 1e-7
226
- @test jet. phi ≈ jet_lv. phi atol = 1e-7
227
- @test jet. pt ≈ jet_lv. pt rtol = 1e-6
242
+ @test jet. rap≈ jet_lv. rap atol= 1e-7
243
+ @test jet. phi≈ jet_lv. phi atol= 1e-7
244
+ @test jet. pt≈ jet_lv. pt rtol= 1e-6
228
245
end
229
246
end
230
247
end
0 commit comments