Skip to content
Snippets Groups Projects
Commit d401882c authored by Johannes Schumann's avatar Johannes Schumann
Browse files

Merge branch 'trkstatus' into 'master'

Fixing wrongly applied GENIE trk status codes

See merge request !11
parents 7df896b9 8dee69fe
No related branches found
No related tags found
1 merge request!11Fixing wrongly applied GENIE trk status codes
Pipeline #20687 passed with warnings
...@@ -107,21 +107,49 @@ EMPTY_KM3NET_HEADER_DICT = { ...@@ -107,21 +107,49 @@ EMPTY_KM3NET_HEADER_DICT = {
} }
PARTICLE_MC_STATUS = { PARTICLE_MC_STATUS = {
"Undefined": -1, "TRK_MOTHER_UNDEFINED":
"InitialState": 0, # generator-level initial state -1, # mother id was not defined for this MC track (all reco tracks have this value)
"StableFinalState": "TRK_MOTHER_NONE": -2, # mother id of a particle if it has no parent
1, # generator-level final state: particles to be tracked by detector-level MC "TRK_ST_UNDEFINED":
"IntermediateState": 2, 0, # status was not defined for this MC track (all reco tracks have this value)
"DecayedState": 3, "TRK_ST_FINALSTATE":
"CorrelatedNucleon": 10, 1, # particle to be tracked by detector-level MC ('track_in' tag in evt files from gseagen, genhen, mupage).
"NucleonTarget": 11, "TRK_ST_PRIMARYNEUTRINO":
"DISPreFragmHadronicState": 12, 100, # initial state neutrino ('neutrino' tag in evt files from gseagen and genhen).
"PreDecayResonantState": 13, "TRK_ST_PRIMARYCOSMIC":
"HadronInTheNucleus": 200, # initial state cosmic ray ('track_primary' tag in evt files from corant).
14, # hadrons inside the nucleus: marked for hadron transport modules to act on "TRK_ST_ININUCLEI": 5, # Initial state nuclei (gseagen)
"FinalStateNuclearRemnant": "TRK_ST_INTERSTATE":
15, # low energy nuclear fragments entering the record collectively as a 'hadronic blob' pseudo-particle 2, # Intermidiate state particles produced in hadronic showers (gseagen)
"NucleonClusterTarget": 16 "TRK_ST_DECSTATE":
3, # Short-lived particles that are forced to decay, like pi0 (gseagen)
"TRK_ST_NUCTGT": 11, # Nucleon target (gseagen)
"TRK_ST_PREHAD": 12, # DIS pre-fragmentation hadronic state (gseagen)
"TRK_ST_PRERES": 13, # resonant pre-decayed state (gseagen)
"TRK_ST_HADNUC": 14, # Hadrons inside the nucleus before FSI (gseagen)
"TRK_ST_NUCLREM": 15, #Low energy nuclear fragments (gseagen)
"TRK_ST_NUCLCLT":
16, #For composite nucleons before phase space decay (gseagen)
"TRK_ST_FAKECORSIKA":
21, # fake particle from corant/CORSIKA to add parent information (gseagen)
"TRK_ST_FAKECORSIKA_DEC_MU_START":
22, # fake particle from CORSIKA: decaying mu at start (gseagen)
"TRK_ST_FAKECORSIKA_DEC_MU_END":
23, # fake particle from CORSIKA: decaying mu at end (gseagen)
"TRK_ST_FAKECORSIKA_ETA_2GAMMA":
24, # fake particle from CORSIKA: eta -> 2 gamma (gseagen)
"TRK_ST_FAKECORSIKA_ETA_3PI0":
25, # fake particle from CORSIKA: eta -> 3 pi0 (gseagen)
"TRK_ST_FAKECORSIKA_ETA_PIP_PIM_PI0":
26, # fake particle from CORSIKA: eta -> pi+ pi- pi0 (gseagen)
"TRK_ST_FAKECORSIKA_ETA_2PI_GAMMA":
27, # fake particle from CORSIKA: eta -> pi+ pi- gamma (gseagen)
"TRK_ST_FAKECORSIKA_CHERENKOV_GAMMA":
28, # fake particle from CORSIKA: Cherenkov photons on particle output file (gseagen)
"TRK_ST_PROPLEPTON":
1001, # lepton propagated that reaches the can (gseagen)
"TRK_ST_PROPDECLEPTON":
2001 # lepton propagated and decayed before got to the can (gseagen)
} }
W2LIST_LOOKUP = { W2LIST_LOOKUP = {
...@@ -558,7 +586,7 @@ def write_detector_file(gibuu_output, ...@@ -558,7 +586,7 @@ def write_detector_file(gibuu_output,
nu_in_trk.dir.set(*direction) nu_in_trk.dir.set(*direction)
nu_in_trk.E = event.lepIn_E nu_in_trk.E = event.lepIn_E
nu_in_trk.t = timestamp nu_in_trk.t = timestamp
nu_in_trk.status = PARTICLE_MC_STATUS["InitialState"] nu_in_trk.status = PARTICLE_MC_STATUS["TRK_ST_PRIMARYNEUTRINO"]
evt.mc_trks.push_back(nu_in_trk) evt.mc_trks.push_back(nu_in_trk)
if tau_secondaries is not None: if tau_secondaries is not None:
...@@ -577,11 +605,11 @@ def write_detector_file(gibuu_output, ...@@ -577,11 +605,11 @@ def write_detector_file(gibuu_output,
lep_out_trk.dir.set(*p_dir) lep_out_trk.dir.set(*p_dir)
lep_out_trk.E = event.lepOut_E lep_out_trk.E = event.lepOut_E
lep_out_trk.t = timestamp lep_out_trk.t = timestamp
lep_out_trk.status = PARTICLE_MC_STATUS["StableFinalState"] lep_out_trk.status = PARTICLE_MC_STATUS["TRK_ST_FINALSTATE"]
evt.mc_trks.push_back(lep_out_trk) evt.mc_trks.push_back(lep_out_trk)
add_particles(event, vtx_pos, R, mc_trk_id, timestamp, add_particles(event, vtx_pos, R, mc_trk_id, timestamp,
PARTICLE_MC_STATUS["StableFinalState"]) PARTICLE_MC_STATUS["TRK_ST_FINALSTATE"])
tree.Fill() tree.Fill()
outfile.Write() outfile.Write()
outfile.Close() outfile.Close()
......
...@@ -98,7 +98,8 @@ class TestAANET(unittest.TestCase): ...@@ -98,7 +98,8 @@ class TestAANET(unittest.TestCase):
evt = self.fobj.events[0] evt = self.fobj.events[0]
np.testing.assert_array_equal(evt.mc_tracks.pdgid, np.testing.assert_array_equal(evt.mc_tracks.pdgid,
[12, 11, 2212, 111, 211, -211]) [12, 11, 2212, 111, 211, -211])
np.testing.assert_array_equal(evt.mc_tracks.status, [0, 1, 1, 1, 1, 1]) np.testing.assert_array_equal(evt.mc_tracks.status,
[100, 1, 1, 1, 1, 1])
np.testing.assert_array_almost_equal(evt.mc_tracks.E, [ np.testing.assert_array_almost_equal(evt.mc_tracks.E, [
11.90433897, 2.1818, 1.45689677, 0.49284856, 8.33975778, 0.28362369 11.90433897, 2.1818, 1.45689677, 0.49284856, 8.33975778, 0.28362369
]) ])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment