@@ -472,6 +472,10 @@ def __init__(
472472 "cam_coord_offset_x" ,
473473 "cam_coord_offset_y" ,
474474 "cam_coord_distance" ,
475+ "true_core_x" ,
476+ "true_core_y" ,
477+ "true_h_first_int" ,
478+ "true_x_max"
475479 ]
476480 )
477481 elif self .process_type == ProcessType .Observation :
@@ -605,6 +609,8 @@ def _construct_mono_example_identifiers(self):
605609 events = self ._transform_to_sky_spher_offsets (events )
606610 # Add the logarithm of the true energy in TeV
607611 events = self ._transform_to_log_energy (events )
612+ # Add the impact radius
613+ events = self ._transform_to_impact_radius (events )
608614 # Add the true shower primary class to the table based on the filename
609615 # is signal or background input file list
610616 true_shower_primary_class = (
@@ -779,6 +785,8 @@ def _multiplicity_cut_subarray(table, key_colnames):
779785 if self .process_type == ProcessType .Simulation :
780786 # Add the logarithm of the true energy in TeV
781787 events = self ._transform_to_log_energy (events )
788+ # Add the impact radius
789+ events = self ._transform_to_impact_radius (events )
782790 # Add the true shower primary class to the table based on the filename
783791 # is signal or background input file list
784792 true_shower_primary_class = (
@@ -894,6 +902,30 @@ def _transform_to_log_energy(self, table):
894902 table .add_column (np .log10 (table ["true_energy" ]), name = "log_true_energy" )
895903 return table
896904
905+ def _transform_to_impact_radius (self , table ) -> Table :
906+ """
907+ Transform core coordinates to impact radius.
908+
909+ This method calculates the impact radius from the core coordinates
910+ in the provided table. The impact radius is the distance from the
911+ true core position to the subarray center.
912+
913+ Parameters:
914+ -----------
915+ table : astropy.table.Table
916+ A Table containing the true core coordinates.
917+
918+ Returns:
919+ --------
920+ table : astropy.table.Table
921+ A Table with the impact radius added as a new column.
922+ """
923+ # Calculate the impact radius
924+ impact_radius = np .sqrt (table ["true_core_x" ]** 2 + table ["true_core_y" ]** 2 )
925+ # Add the impact radius to the table
926+ table .add_column (impact_radius , name = "impact_radius" )
927+ return table
928+
897929 def _transform_to_cam_coord_offsets (self , table ) -> Table :
898930 """
899931 Transform Alt/Az coordinates to camera coordinate offsets w.r.t. the telescope pointing.
0 commit comments