@@ -52,8 +52,8 @@ struct HistoryElement
52
52
end
53
53
54
54
""" Used for initial particles"""
55
- HistoryElement (jetp_index) = HistoryElement (NonexistentParent, NonexistentParent, Invalid, jetp_index, 0.0 , 0.0 )
56
-
55
+ HistoryElement (jetp_index) = HistoryElement (NonexistentParent, NonexistentParent, Invalid,
56
+ jetp_index, 0.0 , 0.0 )
57
57
58
58
"""
59
59
Convienence structure holding all of the relevant parameters for
@@ -63,7 +63,7 @@ struct ClusterSequence
63
63
""" Algorithm and strategy used"""
64
64
algorithm:: JetAlgorithm.Algorithm
65
65
strategy:: RecoStrategy.Strategy
66
-
66
+
67
67
"""
68
68
This contains the physical PseudoJets; for each PseudoJet one can find
69
69
the corresponding position in the history by looking at
@@ -96,14 +96,19 @@ ClusterSequence(p::Int, strategy::RecoStrategy.Strategy, jets, history, Qtot) =
96
96
end
97
97
98
98
""" ClusterSequence constructor, with direct algorithm specified"""
99
- ClusterSequence (alg:: JetAlgorithm.Algorithm , strategy:: RecoStrategy.Strategy , jets, history, Qtot) =
100
- ClusterSequence (alg, strategy, jets, length (jets), history, Qtot)
99
+ ClusterSequence (alg:: JetAlgorithm.Algorithm , strategy:: RecoStrategy.Strategy , jets, history, Qtot) = ClusterSequence (alg,
100
+ strategy,
101
+ jets,
102
+ length (jets),
103
+ history,
104
+ Qtot)
101
105
102
106
""" Add a new jet's history into the recombination sequence"""
103
107
add_step_to_history! (clusterseq:: ClusterSequence , parent1, parent2, jetp_index, dij) = begin
104
108
max_dij_so_far = max (dij, clusterseq. history[end ]. max_dij_so_far)
105
- push! (clusterseq. history, HistoryElement (parent1, parent2, Invalid,
106
- jetp_index, dij, max_dij_so_far))
109
+ push! (clusterseq. history,
110
+ HistoryElement (parent1, parent2, Invalid,
111
+ jetp_index, dij, max_dij_so_far))
107
112
108
113
local_step = length (clusterseq. history)
109
114
@@ -122,10 +127,11 @@ add_step_to_history!(clusterseq::ClusterSequence, parent1, parent2, jetp_index,
122
127
clusterseq. history[parent1] = @set hist_elem. child = local_step
123
128
124
129
if parent2 >= 1
125
- clusterseq. history[parent2]. child == Invalid || error (
126
- " Internal error. Trying to recombine an object that has previsously been recombined. Parent " * string (parent2) * " 's child index " * string (clusterseq. history[parent1]. child) * " . Parent jet index: " *
127
- string (clusterseq. history[parent2]. jetp_index) * " ." ,
128
- )
130
+ clusterseq. history[parent2]. child == Invalid ||
131
+ error (" Internal error. Trying to recombine an object that has previsously been recombined. Parent " *
132
+ string (parent2) * " 's child index " *
133
+ string (clusterseq. history[parent1]. child) * " . Parent jet index: " *
134
+ string (clusterseq. history[parent2]. jetp_index) * " ." )
129
135
hist_elem = clusterseq. history[parent2]
130
136
clusterseq. history[parent2] = @set hist_elem. child = local_step
131
137
end
@@ -158,24 +164,24 @@ function inclusive_jets(clusterseq::ClusterSequence, ptmin = 0.0)
158
164
jets_local
159
165
end
160
166
161
-
162
167
""" Return all exclusive jets of a ClusterSequence"""
163
168
function exclusive_jets (clusterseq:: ClusterSequence ; dcut = nothing , njets = nothing )
164
169
if isnothing (dcut) && isnothing (njets)
165
170
throw (ArgumentError (" Must pass either a dcut or an njets value" ))
166
171
end
167
172
168
173
if ! isnothing (dcut)
169
- njets = n_exclusive_jets (clusterseq, dcut= dcut)
174
+ njets = n_exclusive_jets (clusterseq, dcut = dcut)
170
175
end
171
176
172
177
# Check that an algorithm was used that makes sense for exclusive jets
173
- if ! (clusterseq. algorithm ∈ (JetAlgorithm. CA, JetAlgorithm. Kt, JetAlgorithm. EEKt, JetAlgorithm. Durham))
178
+ if ! (clusterseq. algorithm ∈
179
+ (JetAlgorithm. CA, JetAlgorithm. Kt, JetAlgorithm. EEKt, JetAlgorithm. Durham))
174
180
throw (ArgumentError (" Algorithm used is not suitable for exclusive jets ($(clusterseq. algorithm) )" ))
175
181
end
176
182
177
183
# njets search
178
- stop_point = 2 * clusterseq. n_initial_jets - njets + 1
184
+ stop_point = 2 * clusterseq. n_initial_jets - njets + 1
179
185
180
186
# Sanity check - never return more jets than initial particles
181
187
if stop_point < clusterseq. n_initial_jets
@@ -194,26 +200,27 @@ function exclusive_jets(clusterseq::ClusterSequence; dcut = nothing, njets = not
194
200
if (parent < stop_point && parent > 0 )
195
201
@debug " Added exclusive jet index $(clusterseq. history[parent]. jetp_index) "
196
202
jet = clusterseq. jets[clusterseq. history[parent]. jetp_index]
197
- push! (excl_jets, LorentzVectorCyl (pt (jet), rapidity (jet), phi (jet), mass (jet)))
203
+ push! (excl_jets,
204
+ LorentzVectorCyl (pt (jet), rapidity (jet), phi (jet), mass (jet)))
198
205
end
199
206
end
200
207
end
201
208
202
209
excl_jets
203
210
end
204
211
205
-
206
212
""" Return all number of exclusive jets of a ClusterSequence that are above a certain dcut value"""
207
213
function n_exclusive_jets (clusterseq:: ClusterSequence ; dcut:: AbstractFloat )
208
214
# Check that an algorithm was used that makes sense for exclusive jets
209
- if ! (clusterseq. algorithm ∈ (JetAlgorithm. CA, JetAlgorithm. Kt, JetAlgorithm. EEKt, JetAlgorithm. Durham))
215
+ if ! (clusterseq. algorithm ∈
216
+ (JetAlgorithm. CA, JetAlgorithm. Kt, JetAlgorithm. EEKt, JetAlgorithm. Durham))
210
217
throw (ArgumentError (" Algorithm used is not suitable for exclusive jets ($(clusterseq. algorithm) )" ))
211
218
end
212
219
213
220
# Locate the point where clustering would have stopped (i.e. the
214
221
# first time max_dij_so_far > dcut)
215
222
i_dcut = length (clusterseq. history)
216
- for i_history ∈ length (clusterseq. history): - 1 : 1
223
+ for i_history in length (clusterseq. history): - 1 : 1
217
224
@debug " Examining $i_history , max_dij=$(clusterseq. history[i_history]. max_dij_so_far) "
218
225
if clusterseq. history[i_history]. max_dij_so_far <= dcut
219
226
i_dcut = i_history
@@ -223,5 +230,4 @@ function n_exclusive_jets(clusterseq::ClusterSequence; dcut::AbstractFloat)
223
230
224
231
# The number of jets is then given by this formula
225
232
length (clusterseq. history) - i_dcut
226
-
227
- end
233
+ end
0 commit comments