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
Commits
1255cc10
Verified
Commit
1255cc10
authored
1 year ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Preparation for demo
parent
92fc76cd
No related branches found
No related tags found
1 merge request
!3
Muonscanfit
Pipeline
#44262
passed
1 year ago
Stage: test
Stage: docs
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/scanfit.jl
+20
-24
20 additions, 24 deletions
src/scanfit.jl
with
20 additions
and
24 deletions
src/scanfit.jl
+
20
−
24
View file @
1255cc10
...
...
@@ -5,8 +5,8 @@ Base.@kwdef struct MuonScanfitParameters
nfits
::
Int
=
1
nprefits
::
Int
=
10
σ
::
Float64
=
5.0
# [ns]
α₁
::
Float64
=
5
.0
# grid angle of the coarse scan
α₂
::
Float64
=
0.
3
# grid angle of the fine scan
α₁
::
Float64
=
7
.0
# grid angle of the coarse scan
α₂
::
Float64
=
0.
5
# grid angle of the fine scan
θ
::
Float64
=
3.5
# opening angle of the fine-scan cone
end
...
...
@@ -25,7 +25,7 @@ end
struct
MuonScanfit
params
::
MuonScanfitParameters
detector
::
Detector
directions
et
::
DirectionSet
coarse
directions
::
DirectionSet
coincidencebuilder
::
L1Builder
function
MuonScanfit
(
params
::
MuonScanfitParameters
,
detector
::
Detector
)
coincidencebuilder
=
L1Builder
(
L1BuilderParameters
(
params
.
tmaxlocal
,
false
))
...
...
@@ -55,23 +55,24 @@ function (msf::MuonScanfit)(hits::Vector{T}) where T<:KM3io.AbstractHit
clusterize!
(
rhits
,
Match3B
(
msf
.
params
.
roadwidth
,
msf
.
params
.
tmaxlocal
))
# First round on 4π
candidates
=
scanfit
(
msf
.
params
,
rhits
,
msf
.
directions
et
)
candidates
=
scanfit
(
msf
.
params
,
rhits
,
msf
.
coarse
directions
)
isempty
(
candidates
)
&&
return
candidates
sort!
(
candidates
,
by
=
m
->
m
.
Q
;
rev
=
true
)
# Second round on a directed cone pointing towards the previous best direction
# TODO: take the X best fits from the previous step and repeat the cone fit in each direction
# e.g. bei concatenating the fibonaccicone directions
directions
=
Vector
{
Vector
{
Direction
{
Float64
}}}()
for
idx
in
1
:
min
(
msf
.
params
.
nprefits
,
length
(
candidates
))
most_likely_dir
=
candidates
[
idx
]
.
dir
push!
(
directions
,
fibonaccicone
(
most_likely_dir
,
msf
.
params
.
α₂
,
msf
.
params
.
θ
))
end
directionset
=
DirectionSet
(
vcat
(
directions
...
),
msf
.
params
.
α₂
)
candidates
=
scanfit
(
msf
.
params
,
rhits
,
directionset
)
isempty
(
candidates
)
&&
return
candidates
sort!
(
candidates
,
by
=
m
->
m
.
Q
;
rev
=
true
)
# Second round on directed cones pointing towards the previous best directions
# TODO: currently disabled until all the allocations are minimised
# here, reusing a Vector{Direction} (attached to msf as buffer) might be a good idea.
# By doing so, we need `fibonaccicone!` and `fibonaccisphere!` as mutating functions
# directions = Vector{Vector{Direction{Float64}}}()
# for idx in 1:min(msf.params.nprefits, length(candidates))
# most_likely_dir = candidates[idx].dir
# push!(directions, fibonaccicone(most_likely_dir, msf.params.α₂, msf.params.θ))
# end
# directionset = DirectionSet(vcat(directions...), msf.params.α₂)
# candidates = scanfit(msf.params, rhits, directionset)
# isempty(candidates) && return candidates
# sort!(candidates, by=m->m.Q; rev=true)
candidates
[
1
:
msf
.
params
.
nfits
]
end
...
...
@@ -84,18 +85,13 @@ be empty if none of the directions had enough hits to perform the algorithm.
"""
function
scanfit
(
params
::
MuonScanfitParameters
,
rhits
::
Vector
{
T
},
directionset
::
DirectionSet
)
where
T
<:
AbstractReducedHit
xytsolvers
=
Channel
{
XYTSolver
}(
Threads
.
nthreads
())
for
_
in
1
:
Threads
.
nthreads
()
put!
(
xytsolvers
,
XYTSolver
(
params
.
nmaxhits
,
params
.
roadwidth
,
params
.
tmaxlocal
,
params
.
σ
))
end
chunk_size
=
max
(
1
,
length
(
directionset
.
directions
)
÷
Threads
.
nthreads
())
chunks
=
Iterators
.
partition
(
directionset
.
directions
,
chunk_size
)
tasks
=
map
(
chunks
)
do
chunk
Threads
.
@spawn
begin
xytsolver
=
take!
(
xytsolvers
)
results
=
map
(
c
->
xytsolver
(
rhits
,
c
,
directionset
.
angular_separation
),
chunk
)
put!
(
xytsolvers
,
xytsolver
)
xytsolver
=
XYTSolver
(
params
.
nmaxhits
,
params
.
roadwidth
,
params
.
tmaxlocal
,
params
.
σ
)
results
=
[
xytsolver
(
rhits
,
c
,
directionset
.
angular_separation
)
for
c
in
chunk
]
results
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment