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
cd20ac06
Commit
cd20ac06
authored
5 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Read hits from evt files
parent
6f60ecbd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/KM3io.jl
+66
-1
66 additions, 1 deletion
src/KM3io.jl
with
66 additions
and
1 deletion
src/KM3io.jl
+
66
−
1
View file @
cd20ac06
module
KM3io
greet
()
=
print
(
"Hello World!"
)
using
Corpuscles
abstract type
AbstractHit
end
struct
RawHit
<:
AbstractHit
id
::
Integer
PMid
::
Integer
pe
::
Integer
time
::
Integer
end
struct
Hit
<:
AbstractHit
id
::
Integer
PMid
::
Integer
npe
::
Real
time
::
Real
particle
::
GeantID
track_id
::
Integer
end
struct
Event
hits
::
Vector
{
AbstractHit
}
end
Event
()
=
Event
(
Vector
{
AbstractHit
}())
struct
EvtFile
events
::
Dict
{
T
,
Event
}
where
{
T
<:
Integer
}
end
EvtFile
()
=
EvtFile
(
Dict
{
Int64
,
Event
}())
function
read_hit_entry
(
line
::
AbstractString
)
fields
=
split
(
line
)
id
=
parse
(
Int64
,
fields
[
2
])
pmt_id
=
parse
(
Int64
,
fields
[
3
])
npe
=
parse
(
Float64
,
fields
[
4
])
time
=
parse
(
Float64
,
fields
[
5
])
geantid
=
GeantID
(
parse
(
Int64
,
fields
[
6
]))
track_id
=
parse
(
Int64
,
fields
[
7
])
Hit
(
id
,
pmt_id
,
npe
,
time
,
geantid
,
track_id
)
end
function
read_evt_file
(
filepath
::
AbstractString
)
f
=
open
(
filepath
)
evtfile
=
EvtFile
()
while
!
eof
(
f
)
line
=
readline
(
f
)
if
occursin
(
"start_event:"
,
line
)
fields
=
split
(
line
)
eventid
=
parse
(
Int64
,
fields
[
2
])
event
=
Event
()
evtfile
.
events
[
eventid
]
=
event
while
!
occursin
(
"end_event:"
,
line
)
line
=
readline
(
f
)
if
occursin
(
"hit:"
,
line
)
hit
=
read_hit_entry
(
line
)
push!
(
event
.
hits
,
hit
)
end
end
end
end
return
evtfile
end
EvtFile
(
filepath
::
AbstractString
)
=
read_evt_file
(
filepath
)
end
# module
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