Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
KM3io.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
common
KM3io.jl
Commits
52813864
Verified
Commit
52813864
authored
8 months ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Use a custom container for fit information (0-based indexing)
parent
a934c463
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!36
Make fitinf use 0-based indexing
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/root/offline.jl
+17
-2
17 additions, 2 deletions
src/root/offline.jl
test/root.jl
+1
-1
1 addition, 1 deletion
test/root.jl
with
18 additions
and
3 deletions
src/root/offline.jl
+
17
−
2
View file @
52813864
...
...
@@ -37,6 +37,21 @@ struct CalibratedMCHit
dir
::
Direction
{
Float64
}
end
"""
A container object to store fit information which uses 0-based indexing.
"""
struct
FitInformation
values
::
Vector
{
Float64
}
end
Base
.
getindex
(
fitinf
::
FitInformation
,
idx
)
=
fitinf
.
values
[
idx
+
1
]
Base
.
length
(
fitinf
::
FitInformation
)
=
length
(
fitinf
.
values
)
Base
.
firstindex
(
::
FitInformation
)
=
0
Base
.
lastindex
(
fitinf
::
FitInformation
)
=
length
(
fitinf
)
-
1
Base
.
eltype
(
::
FitInformation
)
=
Float64
function
Base.iterate
(
fitinf
::
FitInformation
,
state
=
0
)
state
>
length
(
fitinf
)
?
nothing
:
(
fitinf
[
state
],
state
+
1
)
end
"""
Represents a reconstructed "
track
", which can be e.g. a muon track but also a shower.
"""
...
...
@@ -50,7 +65,7 @@ struct Trk
lik
::
Float64
rec_type
::
Int32
rec_stages
::
Vector
{
Int32
}
fitinf
::
Vector
{
Float64
}
fitinf
::
FitInformation
end
"""
...
...
@@ -304,7 +319,7 @@ function Base.getindex(f::OfflineTree, idx::Integer)
e
.
trks_lik
[
i
],
e
.
trks_rec_type
[
i
],
e
.
trks_rec_stages
[
i
],
e
.
trks_fitinf
[
i
],
FitInformation
(
e
.
trks_fitinf
[
i
]
)
,
)
)
end
...
...
This diff is collapsed.
Click to expand it.
test/root.jl
+
1
−
1
View file @
52813864
...
...
@@ -18,7 +18,7 @@ const USRFILE = datapath("offline", "usr-sample.root")
@test
56
==
length
(
t
[
1
]
.
trks
)
@test
0
==
length
(
t
[
1
]
.
w
)
@test
17
==
length
(
t
[
1
]
.
trks
[
1
]
.
fitinf
)
@test
0.009290906625313346
==
t
[
end
]
.
trks
[
1
]
.
fitinf
[
1
]
@test
0.009290906625313346
==
t
[
end
]
.
trks
[
1
]
.
fitinf
[
0
]
close
(
f
)
f
=
ROOTFile
(
datapath
(
"offline"
,
"numucc.root"
))
...
...
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