Skip to content

Commit

Permalink
Use telescope combination for hardware trigger.
Browse files Browse the repository at this point in the history
  • Loading branch information
aleberti committed Aug 30, 2023
1 parent 37f6f9b commit 27f61f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion magicctapipe/io/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BaseEventInfoContainer(Container):
pointing_az = Field(DEFAULT_RAD, "Azimuth of the pointing direction", unit="rad")
n_pixels = Field(DEFAULT_VALUE, "Number of pixels after the image cleaning")
n_islands = Field(DEFAULT_VALUE, "Number of islands after the image cleaning")
tels_with_trigger = Field(None, "Boolean np array (True = telescope triggered by event)")
tels_with_trigger = Field(None, "Integer indicating the combination of telescopes that triggered")


class RealEventInfoContainer(BaseEventInfoContainer):
Expand Down
13 changes: 6 additions & 7 deletions magicctapipe/scripts/lst1_magic/magic_calib_to_dl1.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from ctapipe_io_magic import MAGICEventSource
from magicctapipe.image import MAGICClean
from magicctapipe.io import RealEventInfoContainer, SimEventInfoContainer, format_object
from magicctapipe.io.io import TEL_COMBINATIONS
from magicctapipe.utils import calculate_disp, calculate_impact

__all__ = ["magic_calib_to_dl1"]
Expand Down Expand Up @@ -337,17 +338,15 @@ def magic_calib_to_dl1(input_file, output_dir, config, process_run=False):
event_info.tel_id = 3 # MAGIC-II

if event.trigger.tels_with_trigger == [1, 2]:
tels_with_trigger_magic_lst = [2, 3]
tels_with_trigger_magic_lst = list(TEL_COMBINATIONS.values()).index([2, 3]) # M1+M2
elif event.trigger.tels_with_trigger == [2, 3]:
tels_with_trigger_magic_lst = [1, 3]
tels_with_trigger_magic_lst = list(TEL_COMBINATIONS.values()).index([1, 3]) # M2+LST
elif event.trigger.tels_with_trigger == [1, 3]:
tels_with_trigger_magic_lst = [1, 2]
tels_with_trigger_magic_lst = list(TEL_COMBINATIONS.values()).index([1, 2]) # M1+LST
elif event.trigger.tels_with_trigger == [1, 2, 3]:
tels_with_trigger_magic_lst = [1, 2, 3]
tels_with_trigger_magic_lst = list(TEL_COMBINATIONS.values()).index([1, 2, 3]) # M1+M2+LST

tels_with_trigger_mask = subarray_magic.tel_ids_to_mask(tels_with_trigger_magic_lst)

event_info.tels_with_trigger = tels_with_trigger_mask
event_info.tels_with_trigger = tels_with_trigger_magic_lst

# Save the parameters to the output file
writer.write(
Expand Down

0 comments on commit 27f61f5

Please sign in to comment.