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
1b7834af
Verified
Commit
1b7834af
authored
1 year ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Add S1 and S2 parameter for muonscanfit
parent
069793fe
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#46378
failed
1 year ago
Stage: test
Stage: docs
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
scripts/muonscanfit.jl
+4
-0
4 additions, 0 deletions
scripts/muonscanfit.jl
src/scanfit.jl
+17
-4
17 additions, 4 deletions
src/scanfit.jl
test/math_tests.jl
+3
-0
3 additions, 0 deletions
test/math_tests.jl
with
24 additions
and
4 deletions
scripts/muonscanfit.jl
+
4
−
0
View file @
1b7834af
...
@@ -37,6 +37,8 @@ struct MuonScanfitResult
...
@@ -37,6 +37,8 @@ struct MuonScanfitResult
dir_z
::
Float64
dir_z
::
Float64
t
::
Float64
t
::
Float64
Q
::
Float64
Q
::
Float64
S1
::
Float64
S2
::
Float64
NDF
::
Int
NDF
::
Int
walltime
::
Float64
walltime
::
Float64
mc_angular_error
::
Float64
mc_angular_error
::
Float64
...
@@ -93,6 +95,8 @@ function main()
...
@@ -93,6 +95,8 @@ function main()
muon
.
dir
...
,
muon
.
dir
...
,
muon
.
t
,
muon
.
t
,
muon
.
Q
,
muon
.
Q
,
muon
.
S1
,
muon
.
S2
,
muon
.
NDF
,
muon
.
NDF
,
walltime
,
walltime
,
mc_angular_error
,
mc_angular_error
,
...
...
This diff is collapsed.
Click to expand it.
src/scanfit.jl
+
17
−
4
View file @
1b7834af
const
N_FITS_SPREAD
=
10
# number of prefits to calculate the spread of the fit
Base
.
@kwdef
struct
MuonScanfitParameters
Base
.
@kwdef
struct
MuonScanfitParameters
tmaxlocal
::
Float64
=
18.0
# [ns]
tmaxlocal
::
Float64
=
18.0
# [ns]
roadwidth
::
Float64
=
200.0
# [m]
roadwidth
::
Float64
=
200.0
# [m]
...
@@ -59,6 +62,8 @@ function (msf::MuonScanfit)(hits::Vector{T}) where T<:KM3io.AbstractHit
...
@@ -59,6 +62,8 @@ function (msf::MuonScanfit)(hits::Vector{T}) where T<:KM3io.AbstractHit
isempty
(
candidates
)
&&
return
candidates
isempty
(
candidates
)
&&
return
candidates
sort!
(
candidates
,
by
=
m
->
m
.
Q
;
rev
=
true
)
sort!
(
candidates
,
by
=
m
->
m
.
Q
;
rev
=
true
)
S1
=
spread
(
candidates
[
1
:
min
(
N_FITS_SPREAD
,
length
(
candidates
))])
# Second round on directed cones pointing towards the previous best directions
# Second round on directed cones pointing towards the previous best directions
# TODO: currently disabled until all the allocations are minimised
# TODO: currently disabled until all the allocations are minimised
# here, reusing a Vector{Direction} (attached to msf as buffer) might be a good idea.
# here, reusing a Vector{Direction} (attached to msf as buffer) might be a good idea.
...
@@ -76,9 +81,12 @@ function (msf::MuonScanfit)(hits::Vector{T}) where T<:KM3io.AbstractHit
...
@@ -76,9 +81,12 @@ function (msf::MuonScanfit)(hits::Vector{T}) where T<:KM3io.AbstractHit
sort!
(
candidates
,
by
=
m
->
m
.
Q
;
rev
=
true
)
sort!
(
candidates
,
by
=
m
->
m
.
Q
;
rev
=
true
)
end
end
candidates
[
1
:
msf
.
params
.
nfits
]
S2
=
spread
(
candidates
[
1
:
min
(
N_FITS_SPREAD
,
length
(
candidates
))])
[
setproperties
(
c
,
(
S1
=
S1
,
S2
=
S2
))
for
c
in
candidates
[
1
:
msf
.
params
.
nfits
]]
end
end
"""
"""
Performs the scanfit for each given direction and returns a
Performs the scanfit for each given direction and returns a
...
@@ -105,9 +113,14 @@ struct MuonScanfitCandidate
...
@@ -105,9 +113,14 @@ struct MuonScanfitCandidate
pos
::
Position
{
Float64
}
pos
::
Position
{
Float64
}
dir
::
Direction
{
Float64
}
dir
::
Direction
{
Float64
}
t
::
Float64
t
::
Float64
Q
::
Float64
Q
::
Float64
# quality of the fit
S1
::
Float64
# spread of the prefits, the smaller the better
S2
::
Float64
# spread of the last fits, the smaller the better
NDF
::
Int
NDF
::
Int
end
end
MuonScanfitCandidate
(
pos
::
Position
{
Float64
},
dir
::
Direction
{
Float64
},
t
::
Float64
,
Q
::
Float64
,
NDF
::
Int
)
=
MuonScanfitCandidate
(
pos
,
dir
,
t
,
Q
,
π
,
π
,
NDF
)
MuonScanfitCandidate
()
=
MuonScanfitCandidate
(
Position
(
0.0
,
0.0
,
0.0
),
Direction
(
0.0
,
0.0
,
1.0
),
NaN
,
NaN
,
NaN
,
NaN
,
0
)
Base
.
angle
(
m1
::
T
,
m2
::
T
)
where
T
<:
MuonScanfitCandidate
=
angle
(
m1
.
dir
,
m2
.
dir
)
"""
"""
The quality of the fit, the larger the better, as used in e.g. Jpp.
The quality of the fit, the larger the better, as used in e.g. Jpp.
...
@@ -384,7 +397,7 @@ function (s::XYTSolver)(hits::Vector{T}, dir::Direction{Float64}, α::Float64) w
...
@@ -384,7 +397,7 @@ function (s::XYTSolver)(hits::Vector{T}, dir::Direction{Float64}, α::Float64) w
hits
=
s
.
hits_buffer
# just for convenience
hits
=
s
.
hits_buffer
# just for convenience
n_final_hits
=
length
(
hits
)
n_final_hits
=
length
(
hits
)
n_final_hits
<=
s
.
est
.
NUMBER_OF_PARAMETERS
&&
return
MuonScanfitCandidate
(
Position
(
0
,
0
,
0
),
dir
,
0
,
-
Inf
,
0
)
n_final_hits
<=
s
.
est
.
NUMBER_OF_PARAMETERS
&&
return
MuonScanfitCandidate
()
NDF
=
n_final_hits
-
s
.
est
.
NUMBER_OF_PARAMETERS
NDF
=
n_final_hits
-
s
.
est
.
NUMBER_OF_PARAMETERS
N
=
hitcount
(
hits
)
N
=
hitcount
(
hits
)
...
@@ -394,7 +407,7 @@ function (s::XYTSolver)(hits::Vector{T}, dir::Direction{Float64}, α::Float64) w
...
@@ -394,7 +407,7 @@ function (s::XYTSolver)(hits::Vector{T}, dir::Direction{Float64}, α::Float64) w
estimate!
(
s
.
est
,
hits
)
estimate!
(
s
.
est
,
hits
)
catch
ex
catch
ex
# isa(ex, SingularSVDException) && @warn "Singular SVD"
# isa(ex, SingularSVDException) && @warn "Singular SVD"
return
MuonScanfitCandidate
(
Position
(
0
,
0
,
0
),
dir
,
0
,
-
Inf
,
0
)
return
MuonScanfitCandidate
()
end
end
# TODO: consider creating a "pos()" getter for everything
# TODO: consider creating a "pos()" getter for everything
...
...
This diff is collapsed.
Click to expand it.
test/math_tests.jl
+
3
−
0
View file @
1b7834af
...
@@ -8,6 +8,9 @@ using Test
...
@@ -8,6 +8,9 @@ using Test
@test
π
/
2
≈
angle
([
1
,
0
,
0
],
[
0
,
0
,
1
])
@test
π
/
2
≈
angle
([
1
,
0
,
0
],
[
0
,
0
,
1
])
@test
π
≈
angle
([
1
,
0
,
0
],
[
-
1
,
0
,
0
])
@test
π
≈
angle
([
1
,
0
,
0
],
[
-
1
,
0
,
0
])
m1
=
NeRCA
.
MuonScanfitCandidate
(
Position
(
1
,
2
,
3
),
Direction
(
1.0
,
0.0
,
0.0
),
0
,
0
,
0
,
0
)
m2
=
NeRCA
.
MuonScanfitCandidate
(
Position
(
1
,
2
,
3
),
Direction
(
0.0
,
1.0
,
0.0
),
0
,
0
,
0
,
0
)
@test
π
/
2
≈
angle
(
m1
,
m2
)
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