Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NeRCA.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tamas Gal
NeRCA.jl
Merge requests
!3
Muonscanfit
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Muonscanfit
muonscanfit
into
master
Overview
0
Commits
88
Pipelines
40
Changes
3
Merged
Tamas Gal
requested to merge
muonscanfit
into
master
1 year ago
Overview
0
Commits
88
Pipelines
40
Changes
3
Expand
0
0
Merge request reports
Viewing commit
369359d8
Prev
Next
Show latest version
3 files
+
117
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
Verified
369359d8
Match3B working (slight differences in timings wrt Jpp)
· 369359d8
Tamas Gal
authored
1 year ago
src/hits.jl
+
98
−
2
Options
@@ -440,13 +440,15 @@ function KM3io.slew(h::HitR1)
end
abstract type
AbstractMatcher
end
"""
3D match criterion with road width, intended for muon signals.
Source: B. Bakker, "
Trigger
studies
for
the
Antares
and
KM3NeT
detector
.
",
Master thesis, University of Amsterdam.
"""
mutable struct
Match3B
mutable struct
Match3B
<:
AbstractMatcher
const
roadwidth
::
Float64
const
tmaxextra
::
Float64
x
::
Float64
@@ -469,7 +471,7 @@ mutable struct Match3B
const
Rt
::
Float64
const
R2
::
Float64
function
Match3B
(
roadwidth
;
tmaxextra
=
0.0
)
function
Match3B
(
roadwidth
,
tmaxextra
=
0.0
)
tt2
=
KM3io
.
Constants
.
TAN_THETA_C_WATER
^
2
D0
=
roadwidth
@@ -522,3 +524,97 @@ function (m::Match3B)(hit1, hit2)
m
.
t
>=
m
.
dmin
*
KM3io
.
Constants
.
C_INVERSE
-
m
.
tmaxextra
end
@inline
function
swap!
(
arr
::
AbstractArray
,
i
::
Int
,
j
::
Int
)
arr
[
i
],
arr
[
j
]
=
arr
[
j
],
arr
[
i
]
arr
end
struct
Clique
{
T
<:
AbstractMatcher
}
m
::
T
weights
::
Vector
{
Float64
}
Clique
(
m
::
T
)
where
T
=
new
{
T
}(
m
,
Float64
[])
end
function
(
c
::
Clique
)(
hits
::
Vector
{
T
})
where
T
<:
AbstractSpecialHit
N
=
length
(
hits
)
N
==
0
&&
return
hits
resize!
(
c
.
weights
,
N
)
@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
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
j
=
1
W
=
c
.
weights
[
j
]
# @show W
for
i
∈
2
:
n
print
(
"i=
$
(i-1) j=
$
(j-1) : "
)
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
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