Skip to content
Snippets Groups Projects

Muonscanfit

Merged Tamas Gal requested to merge muonscanfit into master
1 file
+ 6
31
Compare changes
  • Side-by-side
  • Inline
+ 6
31
@@ -546,75 +546,50 @@ function (c::Clique)(hits::Vector{T}) where T<:AbstractSpecialHit
@inbounds for i 1:N
c.weights[i] = weight(hits[i])
end
println("starting weights: $(c.weights)")
for i 1:N
for j i:N
@inbounds for i 1:N
@inbounds for j i:N
j == i && continue
if c.m(hits[i], hits[j])
println(" match: i=$(i-1) j=$(j-1)")
c.weights[i] += weight(hits[j])
c.weights[j] += weight(hits[i])
end
end
end
println("modified weights: $(c.weights)")
# ====================================================================
# above this line, everything's fine
# ====================================================================
# Remove hit with the smallest weight of associated hits.
# This procedure stops when the weight of associated hits
# is equal to the maximal weight of (remaining) hits.
n = N
# @show N
while true
@inbounds while true
j = 1
W = c.weights[j]
# @show W
for i 2:n
print("i=$(i-1) j=$(j-1) : ")
@inbounds for i 2:n
if c.weights[i] < c.weights[j]
println("$(c.weights[i]) < $(c.weights[j]) = less")
j = i
elseif c.weights[i] > W
println("$(c.weights[i]) > $W = greater")
W = c.weights[i]
else
println("noop")
end
end
# @show j, W
println(" W = $W")
# end condition
# @show c.weights[j], W
c.weights[j] == W && return resize!(hits, n)
# Swap the selected hit to end.
# @show (j, n)
println(" swapping j=$(j-1) n=$(n-1)")
swap!(hits, j, n)
# @show c.weights
swap!(c.weights, j, n)
# @show c.weights
println("swapped weights: $(c.weights)")
println("swapped weights: $([h.dom_id for h in hits])")
# @show n
# Decrease weight of associated hits for each associated hit.
for i 1:n
@inbounds for i 1:n
c.weights[n] <= weight(hits[n]) && break
if c.m(hits[i], hits[n])
c.weights[i] -= weight(hits[n])
c.weights[n] -= weight(hits[i])
end
end
n -= 1
println("n = $n")
println("end weights: $(c.weights)")
end
end
Loading