@@ -6,6 +6,24 @@ using JSON
6
6
using LorentzVectorHEP
7
7
using Logging
8
8
9
+ const events_file = joinpath (@__DIR__ , " data" , " events.hepmc3" )
10
+
11
+ """ Decompress data file, if necessary"""
12
+ function unpack_events (file)
13
+ # File already there?
14
+ if isfile (file)
15
+ return true
16
+ end
17
+ # LZMA source?
18
+ file_compressed = joinpath (dirname (file), basename (file)* " .xz" )
19
+ if isfile (file_compressed)
20
+ @debug " Unpacking $(file_compressed) "
21
+ run (pipeline (` xzcat $file_compressed ` , stdout = file))
22
+ return true
23
+ end
24
+ false
25
+ end
26
+
9
27
""" Read JSON file with fastjet jets in it"""
10
28
function read_fastjet_outputs (fname)
11
29
f = open (fname)
@@ -31,6 +49,9 @@ function sort_jets!(jet_array::Vector{LorentzVectorCyl})
31
49
end
32
50
33
51
function main ()
52
+ # If necessary, unzip the events data file
53
+ unpack_events (events_file)
54
+
34
55
# Read our fastjet outputs (we read for anti-kt, cambridge/achen, inclusive-kt)
35
56
algorithms = Dict (- 1 => " Anti-kt" ,
36
57
0 => " Cambridge/Achen" ,
@@ -76,7 +97,7 @@ function do_test_compare_to_fastjet(strategy::JetRecoStrategy.Strategy, fastjet_
76
97
77
98
# Now run our jet reconstruction...
78
99
# From PseudoJets
79
- events:: Vector{Vector{PseudoJet}} = read_final_state_particles (joinpath ( @__DIR__ , " data " , " events.hepmc3 " ) )
100
+ events:: Vector{Vector{PseudoJet}} = read_final_state_particles (events_file )
80
101
jet_collection = FinalJets[]
81
102
for (ievt, event) in enumerate (events)
82
103
finaljets = final_jets (inclusive_jets (jet_reconstruction (event, R = distance, p = power), ptmin))
@@ -127,7 +148,7 @@ function do_test_compare_types(strategy::JetRecoStrategy.Strategy;
127
148
128
149
# Now run our jet reconstruction...
129
150
# From PseudoJets
130
- events:: Vector{Vector{PseudoJet}} = read_final_state_particles (joinpath ( @__DIR__ , " data " , " events.hepmc3 " ) )
151
+ events:: Vector{Vector{PseudoJet}} = read_final_state_particles (events_file )
131
152
jet_collection = FinalJets[]
132
153
for (ievt, event) in enumerate (events)
133
154
finaljets = final_jets (inclusive_jets (jet_reconstruction (event, R = distance, p = power), ptmin))
@@ -136,7 +157,7 @@ function do_test_compare_types(strategy::JetRecoStrategy.Strategy;
136
157
end
137
158
138
159
# From LorentzVector
139
- events_lv:: Vector{Vector{LorentzVector}} = read_final_state_particles_lv (joinpath ( @__DIR__ , " data " , " events.hepmc3 " ) )
160
+ events_lv:: Vector{Vector{LorentzVector}} = read_final_state_particles_lv (events_file )
140
161
jet_collection_lv = FinalJets[]
141
162
for (ievt, event) in enumerate (events_lv)
142
163
finaljets = final_jets (inclusive_jets (jet_reconstruction (event, R = distance, p = power), ptmin))
0 commit comments