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
a3cf1ce9
Commit
a3cf1ce9
authored
5 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Updated corpuscles geant type and added a getindex for EvtFile
parent
2be535a2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/KM3io.jl
+11
-4
11 additions, 4 deletions
src/KM3io.jl
with
11 additions
and
4 deletions
src/KM3io.jl
+
11
−
4
View file @
a3cf1ce9
...
...
@@ -3,6 +3,8 @@ module KM3io
using
StaticArrays
using
Corpuscles
import
Base
:
getindex
abstract type
AbstractHit
end
struct
Cartesian
{
T
}
<:
FieldVector
{
3
,
T
}
...
...
@@ -30,7 +32,7 @@ struct Hit <: AbstractHit
PMid
::
Integer
npe
::
Real
time
::
Real
particle
::
GeantID
particle
::
Geant
3
ID
track_id
::
Integer
end
...
...
@@ -53,7 +55,7 @@ end
struct
Track
id
::
Integer
kin
::
KineticInfo
particle
::
GeantID
particle
::
Geant
3
ID
end
struct
Event
...
...
@@ -68,6 +70,10 @@ struct EvtFile
events
::
Dict
{
T
,
Event
}
where
{
T
<:
Integer
}
end
function
getindex
(
f
::
EvtFile
,
i
::
Integer
)
f
.
events
[
i
]
end
EvtFile
()
=
EvtFile
(
Dict
{
Int64
,
Event
}())
function
read_evt_hit
(
line
::
AbstractString
)
...
...
@@ -76,7 +82,7 @@ function read_evt_hit(line::AbstractString)
pmt_id
=
parse
(
Int64
,
fields
[
3
])
npe
=
parse
(
Float64
,
fields
[
4
])
time
=
parse
(
Float64
,
fields
[
5
])
geantid
=
GeantID
(
parse
(
Int64
,
fields
[
6
]))
geantid
=
Geant
3
ID
(
parse
(
Int64
,
fields
[
6
]))
track_id
=
parse
(
Int64
,
fields
[
7
])
Hit
(
id
,
pmt_id
,
npe
,
time
,
geantid
,
track_id
)
end
...
...
@@ -112,7 +118,7 @@ function read_evt_track(line::AbstractString)
fields
=
split
(
line
)
id
=
parse
(
Int64
,
fields
[
2
])
kin
=
parse_kin
(
fields
[
3
:
10
])
particle
=
GeantID
(
parse
(
Int8
,
fields
[
11
]))
particle
=
Geant
3
ID
(
parse
(
Int8
,
fields
[
11
]))
Track
(
id
,
kin
,
particle
)
end
...
...
@@ -152,6 +158,7 @@ function read_evt_file(filepath::AbstractString)
evtfile
.
events
[
eventid
]
=
Event
(
hits
,
neutrino
,
tracks
,
weights
)
end
end
close
(
f
)
return
evtfile
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