Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
KM3BUU
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
simulation
KM3BUU
Commits
6a0ff81b
Commit
6a0ff81b
authored
4 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Add primary and secondary lepton to aanet file
parent
61bbfd99
No related branches found
No related tags found
Loading
Pipeline
#13403
failed
4 years ago
Stage: test
Stage: coverage
Stage: doc
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
km3buu/jobcard.py
+7
-6
7 additions, 6 deletions
km3buu/jobcard.py
km3buu/output.py
+52
-9
52 additions, 9 deletions
km3buu/output.py
with
59 additions
and
15 deletions
km3buu/jobcard.py
+
7
−
6
View file @
6a0ff81b
...
...
@@ -23,6 +23,7 @@ INPUT_PATH = "/opt/buuinput2019/"
PROCESS_LOOKUP
=
{
"
cc
"
:
2
,
"
nc
"
:
3
,
"
anticc
"
:
-
2
,
"
antinc
"
:
-
3
}
FLAVOR_LOOKUP
=
{
"
electron
"
:
1
,
"
muon
"
:
2
,
"
tau
"
:
3
}
PDGID_LOOKUP
=
{
1
:
12
,
2
:
14
,
3
:
16
}
XSECTIONMODE_LOOKUP
=
{
"
integratedSigma
"
:
0
,
"
dSigmadCosThetadElepton
"
:
1
,
...
...
@@ -83,12 +84,12 @@ def read_jobcard(filepath):
def
generate_neutrino_jobcard_template
(
process
,
flavour
,
energy
,
target
,
write_events
=
False
,
input_path
=
INPUT_PATH
):
# pragma: no cover
process
,
flavour
,
energy
,
target
,
write_events
=
False
,
input_path
=
INPUT_PATH
):
# pragma: no cover
"""
Generate a jobcard for neutrino interaction
...
...
This diff is collapsed.
Click to expand it.
km3buu/output.py
+
52
−
9
View file @
6a0ff81b
...
...
@@ -25,7 +25,7 @@ import awkward1
import
itertools
from
scipy.spatial.transform
import
Rotation
from
.jobcard
import
Jobcard
from
.jobcard
import
Jobcard
,
read_jobcard
,
PDGID_LOOKUP
EVENT_FILENAME
=
"
FinalEvents.dat
"
LHE_PERT_FILENAME
=
"
EventOutput.Pert.[0-9]{8}.lhe
"
...
...
@@ -184,12 +184,14 @@ class GiBUUOutput:
self
.
lhe_real_files
=
list
(
filter
(
lhe_real_regex
.
match
,
self
.
output_files
))
jobcard_regex
=
re
.
compile
(
'
.job
'
)
jobcard_regex
=
re
.
compile
(
'
.
*.
job
'
)
jobcard_files
=
list
(
filter
(
jobcard_regex
.
match
,
self
.
output_files
))
print
(
self
.
output_files
)
if
len
(
jobcard_files
)
==
1
:
self
.
_jobcard
=
jobcard_files
[
0
]
self
.
_jobcard_fname
=
jobcard_files
[
0
]
self
.
jobcard
=
read_jobcard
(
self
.
_jobcard_fname
)
else
:
self
.
_
jobcard
=
None
self
.
jobcard
=
None
def
associate_jobcard
(
self
,
jobcard
):
"""
...
...
@@ -200,7 +202,7 @@ class GiBUUOutput:
jobcard: Jobcard
Jobcard object instance
"""
self
.
_
jobcard
=
jobcard
self
.
jobcard
=
jobcard
def
write_detector_file
(
gibuu_output
,
...
...
@@ -212,6 +214,21 @@ def write_detector_file(gibuu_output,
fobj
.
set_output
(
ofile
)
mc_event_id
=
0
is_cc
=
False
if
gibuu_output
.
jobcard
is
None
:
raise
EnvironmentError
(
"
No jobcard provided within the GiBUU output!
"
)
nu_type
=
PDGID_LOOKUP
[
gibuu_output
.
jobcard
[
'
neutrino_induced
'
]
[
'
flavor_id
'
]]
sec_lep_type
=
nu_type
if
abs
(
gibuu_output
.
jobcard
[
'
neutrino_induced
'
][
'
process_id
'
])
==
2
:
is_cc
=
True
sec_lep_type
-=
1
if
gibuu_output
.
jobcard
[
'
neutrino_induced
'
][
'
process_id
'
]
<
0
:
nu_type
*=
-
1
sec_lep_type
*=
-
1
for
ifile
in
gibuu_output
.
lhe_pert_files
:
lhe_data
=
pylhe
.
readLHEWithAttributes
(
ifile
)
for
event
in
lhe_data
:
...
...
@@ -242,13 +259,37 @@ def write_detector_file(gibuu_output,
timestamp
=
np
.
random
.
uniform
(
0
,
livetime
)
# event_info = parse_gibuu_event_info(event.optional[0])
# p_lepton_in = event_info
event_info
=
parse_gibuu_event_info
(
event
.
optional
[
0
])
nu_in_trk
=
ROOT
.
Trk
()
nu_in_trk
.
id
=
0
nu_in_trk
.
mother_id
=
-
1
nu_in_trk
.
type
=
nu_type
nu_in_trk
.
pos
.
set
(
*
vtx_pos
)
nu_in_trk
.
dir
.
set
(
*
direction
)
nu_in_trk
.
E
=
event_info
[
'
mom_lepton_in_E
'
].
item
()
nu_in_trk
.
t
=
timestamp
nu_in_trk
.
setusr
(
'
cc
'
,
is_cc
)
fobj
.
evt
.
mc_trks
.
push_back
(
nu_in_trk
)
lep_out_trk
=
ROOT
.
Trk
()
lep_out_trk
.
id
=
1
lep_out_trk
.
mother_id
=
0
lep_out_trk
.
type
=
sec_lep_type
lep_out_trk
.
pos
.
set
(
*
vtx_pos
)
mom
=
np
.
array
(
event_info
[[
'
mom_lepton_out_x
'
,
'
mom_lepton_out_y
'
,
'
mom_lepton_out_z
'
]].
item
())
p_dir
=
R
.
apply
(
mom
/
np
.
linalg
.
norm
(
mom
))
lep_out_trk
.
dir
.
set
(
*
p_dir
)
lep_out_trk
.
E
=
event_info
[
'
mom_lepton_out_E
'
].
item
()
lep_out_trk
.
t
=
timestamp
fobj
.
evt
.
mc_trks
.
push_back
(
lep_out_trk
)
for
i
,
p
in
enumerate
(
event
.
particles
):
trk
=
ROOT
.
Trk
()
trk
.
id
=
i
trk
.
id
=
i
+
2
mom
=
np
.
array
([
p
.
px
,
p
.
py
,
p
.
pz
])
p_dir
=
mom
/
np
.
linalg
.
norm
(
mom
)
p_dir
=
R
.
apply
(
mom
/
np
.
linalg
.
norm
(
mom
)
)
trk
.
pos
.
set
(
*
vtx_pos
)
trk
.
dir
.
set
(
*
p_dir
)
trk
.
mother_id
=
0
...
...
@@ -257,5 +298,7 @@ def write_detector_file(gibuu_output,
trk
.
t
=
timestamp
fobj
.
evt
.
mc_trks
.
push_back
(
trk
)
fobj
.
write
()
if
mc_event_id
>
100
:
break
del
fobj
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