Skip to content

Commit

Permalink
DC2 true Xmax pos and wrong xmax value used by grandlib
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyjim committed Jan 13, 2025
1 parent 01ae81e commit 67247e2
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions grand/dataio/root_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ def get_obj_handling3dtraces(self):
l_idx = [self.idt2idx[idt] for idt in self.du_id]
o_tevent.init_network(self.du_xyz[l_idx])
o_tevent.network.name = self.tt_run.site
d_sim = self.get_simu_parameters()
o_tevent.network.xmax_pos = d_sim["FIX_xmax_pos"]
o_tevent.network.core_pos = d_sim["shower_core_pos"]
shw = self.tt_shower
xmax = shw.xmax_pos_shc
xmax = o_tevent.network.xmax_pos
dist_xmax = np.linalg.norm(xmax) / 1000
o_tevent.info_shower = f"||xmax_pos_shc||={dist_xmax:.1f} km;"
azi, zenith = shw.azimuth, shw.zenith
Expand All @@ -209,22 +212,23 @@ def get_simu_parameters(self):
:return: dictionary with some raw value of simulation parameters
"""
d_simu = {}
# raw
xmax_temp = self.tt_shower.xmax_pos_shc
d_simu["xmax_pos_shc"] = xmax_temp
# raw parameters
d_simu["azimuth"] = self.tt_shower.azimuth
d_simu["zenith"] = self.tt_shower.zenith
d_simu["energy_primary"] = self.tt_shower.energy_primary
d_simu["shower_core_pos"] = self.tt_shower.shower_core_pos
d_simu["magnetic_field"] = self.tt_shower.magnetic_field
origin_geoid = self.tt_run.origin_geoid
d_simu["origin_geoid"] = origin_geoid
# DC2 bug xmax_pos isn't filled
d_simu["xmax_pos"] = self.tt_shower.xmax_pos
logger.warn("DC2 FIX to define 'xmax_pos' in DU Frame")
d_simu["FIX_xmax_pos"] = (
xmax_temp + d_simu["shower_core_pos"] - np.array([0, 0, origin_geoid[2]])
)
xmax_temp = self.tt_shower.xmax_pos_shc
d_simu["xmax_pos_shc"] = xmax_temp
# FIX parameters
logger.warn("DC2 FIX to define 'xmax_pos' in DU Frame")
# DC2 FIX: Xmax don't the right value
# https://github.com/grand-mother/collab-issues/issues/34
d_simu["FIX_xmax_pos_grandlib"] = xmax_temp + d_simu["shower_core_pos"]
# DC2 FIX: correct value of Xmax
d_simu["FIX_xmax_pos"] = d_simu["FIX_xmax_pos_grandlib"] - np.array([0, 0, origin_geoid[2]])
return d_simu


Expand Down

0 comments on commit 67247e2

Please sign in to comment.