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
b969ded5
Commit
b969ded5
authored
3 months ago
by
Tamas Gal
Browse files
Options
Downloads
Plain Diff
Merge branch 'improve-displays' into 'main'
Improve displays See merge request
!46
parents
5856bee7
449f2174
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!46
Improve displays
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/KM3io.jl
+2
-0
2 additions, 0 deletions
src/KM3io.jl
src/displays.jl
+64
-0
64 additions, 0 deletions
src/displays.jl
src/hardware.jl
+0
-5
0 additions, 5 deletions
src/hardware.jl
src/root/offline.jl
+0
-3
0 additions, 3 deletions
src/root/offline.jl
with
66 additions
and
8 deletions
src/KM3io.jl
+
2
−
0
View file @
b969ded5
...
...
@@ -79,6 +79,8 @@ include("tools/helpers.jl")
include
(
"physics.jl"
)
include
(
"displays.jl"
)
function
__init__
()
@static
if
!
isdefined
(
Base
,
:
get_extension
)
...
...
This diff is collapsed.
Click to expand it.
src/displays.jl
0 → 100644
+
64
−
0
View file @
b969ded5
description
(
::
Type
)
=
""
hasdescription
(
T
::
Type
)
=
description
(
T
)
!=
""
function
Base.show
(
io
::
IO
,
p
::
T
)
where
T
<:
Union
{
Position
,
Direction
}
@printf
(
io
,
"%s(%.3f, %.3f, %.3f)"
,
T
,
p
...
)
end
# DetectorModule
function
Base.show
(
io
::
IO
,
m
::
DetectorModule
)
print_object
(
io
,
m
,
multiline
=
false
)
end
function
Base.show
(
io
::
IO
,
::
MIME
"text/plain"
,
m
::
DetectorModule
)
multiline
=
get
(
io
,
:
multiline
,
true
)
print_object
(
io
,
m
,
multiline
=
multiline
)
end
function
print_object
(
io
::
IO
,
m
::
DetectorModule
;
multiline
::
Bool
)
if
multiline
info
=
isbasemodule
(
m
)
?
"base"
:
"optical,
$
(m.n_pmts) PMTs"
println
(
io
,
"DetectorModule
$
(m.id) (
$(info)
)"
)
println
(
io
,
" Location: string
$
(m.location.string), floor
$
(m.location.floor)"
)
println
(
io
,
" Position:
$
(m.pos)"
)
print
(
io
,
" Time offset:
$
(m.t₀) ns"
)
else
info
=
isbasemodule
(
m
)
?
"BM"
:
"DOM"
print
(
io
,
"
$
info(
$
(m.id)"
)
@printf
(
io
,
", S%03d F%02d)"
,
m
.
location
.
string
,
m
.
location
.
floor
)
end
end
# Detector
Base
.
show
(
io
::
IO
,
d
::
Detector
)
=
print
(
io
,
"Detector
$
(d.id) (v
$
(d.version)) with
$
(length(d.strings)) strings and
$
(d.n_modules) modules."
)
# Evt
function
Base.show
(
io
::
IO
,
e
::
Evt
)
print
(
io
,
"
$
(typeof(e)) (
$
(length(e.hits)) hits,
$
(length(e.mc_hits)) MC hits,
$
(length(e.trks)) tracks,
$
(length(e.mc_trks)) MC tracks)"
)
end
function
Base.show
(
io
::
IO
,
::
MIME
"text/plain"
,
e
::
Evt
)
println
(
io
,
"MC Event (Evt) (
$
(length(e.hits)) hits,
$
(length(e.mc_hits)) MC hits,
$
(length(e.trks)) tracks,
$
(length(e.mc_trks)) MC tracks)"
)
println
(
io
,
" ID:
$
(e.id)"
)
println
(
io
,
" Detector ID:
$
(e.det_id)"
)
println
(
io
,
" MC ID:
$
(e.mc_id)"
)
println
(
io
,
" MC event time:
$
(e.mc_event_time)"
)
if
length
(
e
.
mc_trks
)
>
0
println
(
io
,
" Primary particle:
$
(first(e.mc_trks))"
)
else
println
(
io
,
" Primary particle: missing"
)
end
end
description
(
::
Type
{
Trk
})
=
"Reconstructed track"
description
(
::
Type
{
MCTrk
})
=
"Monte Carlo track"
function
Base.show
(
io
::
IO
,
::
MIME
"text/plain"
,
obj
::
T
)
where
T
<:
Union
{
Trk
,
MCTrk
,
PMT
,
AbstractCalibratedHit
,
AbstractDAQHit
}
print
(
io
,
T
)
hasdescription
(
T
)
&&
print
(
io
,
" (
$
(description(T)))"
)
for
(
fn
,
ft
)
in
zip
(
fieldnames
(
T
),
fieldtypes
(
T
))
val
=
getfield
(
obj
,
fn
)
print
(
io
,
"
\n
$(fn)
:
$(val)
"
)
end
end
This diff is collapsed.
Click to expand it.
src/hardware.jl
+
0
−
5
View file @
b969ded5
...
...
@@ -55,10 +55,6 @@ struct DetectorModule
status
::
Int32
t₀
::
Float64
end
function
Base.show
(
io
::
IO
,
m
::
DetectorModule
)
info
=
m
.
location
.
floor
==
0
?
"base"
:
"optical,
$
(m.n_pmts) PMTs"
print
(
io
,
"Detectormodule (
$(info)
) on string
$
(m.location.string) floor
$
(m.location.floor)"
)
end
Base
.
length
(
d
::
DetectorModule
)
=
d
.
n_pmts
Base
.
eltype
(
::
Type
{
DetectorModule
})
=
PMT
Base
.
iterate
(
d
::
DetectorModule
,
state
=
1
)
=
state
>
d
.
n_pmts
?
nothing
:
(
d
.
pmts
[
state
],
state
+
1
)
...
...
@@ -289,7 +285,6 @@ end
Return a vector of all modules of a given detector.
"""
modules
(
d
::
Detector
)
=
collect
(
values
(
d
.
modules
))
Base
.
show
(
io
::
IO
,
d
::
Detector
)
=
print
(
io
,
"Detector
$
(d.id) (v
$
(d.version)) with
$
(length(d.strings)) strings and
$
(d.n_modules) modules."
)
Base
.
length
(
d
::
Detector
)
=
d
.
n_modules
Base
.
eltype
(
::
Type
{
Detector
})
=
DetectorModule
function
Base.iterate
(
d
::
Detector
,
state
=
(
Int
[],
1
))
...
...
This diff is collapsed.
Click to expand it.
src/root/offline.jl
+
0
−
3
View file @
b969ded5
...
...
@@ -136,9 +136,6 @@ struct Evt
flags
::
Int64
usr
::
Dict
{
String
,
Float64
}
end
function
Base.show
(
io
::
IO
,
e
::
Evt
)
print
(
io
,
"
$
(typeof(e)) (
$
(length(e.hits)) hits,
$
(length(e.mc_hits)) MC hits,
$
(length(e.trks)) tracks,
$
(length(e.mc_trks)) MC tracks)"
)
end
struct
MCHeader
_raw
::
Dict
{
String
,
String
}
...
...
This diff is collapsed.
Click to expand it.
Tamas Gal
@tgal
mentioned in commit
a1ab70b6
·
3 months ago
mentioned in commit
a1ab70b6
mentioned in commit a1ab70b6510b3eb74e22d0832b890bfe474dc3cb
Toggle commit list
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