src/graphnet/data/i3extractor.py
def muon_stopped(truth, borders, horizontal_pad=100.0, vertical_pad=100.0):
    """
    Calculates where a simulated muon stops and if this is inside the detectors fiducial volume.
    IMPORTANT: The final position of the muon is saved in truth extractor/databases as position_x,position_y and position_z.
               This is analogoues to the neutrinos whose interaction vertex is saved under the same name.

    Args:
        truth (dict) : dictionary of already extracted values
        borders (tuple) : first entry xy outline, second z min/max depth. See I3TruthExtractor for hard-code example.
        horizontal_pad (float) : shrink xy plane further with exclusion zone
        vertical_pad (float) : further shrink detector depth with exclusion height

    Returns:
        dictionary (dict) : containing the x,y,z co-ordinates of final muon position and contained boolean (0 or 1)
    """
    # to do:remove hard-coded border coords and replace with GCD file contents using string no's
    border = mpath.Path(borders[0])

    start_pos = np.array(
        [truth["position_x"], truth["position_y"], truth["position_z"]]
    )

    travel_vec = -1 * np.array(
        [
            truth["track_length"]
            * np.cos(truth["azimuth"])
            * np.sin(truth["zenith"]),
            truth["track_length"]
            * np.sin(truth["azimuth"])
            * np.sin(truth["zenith"]),
            truth["track_length"] * np.cos(truth["zenith"]),
        ]
    )

    end_pos = start_pos + travel_vec

    stopped_xy = border.contains_point(
        (end_pos[0], end_pos[1]), radius=-horizontal_pad
    )
    stopped_z = (end_pos[2] > borders[1][0] + vertical_pad) * (
        end_pos[2] < borders[1][1] - vertical_pad
    )

    return {
        "x": end_pos[0],
        "y": end_pos[1],
        "z": end_pos[2],
        "stopped": (stopped_xy * stopped_z),
    }

    Calculates where a simulated muon stops and if this is inside the detectors fiducial volume.
    IMPORTANT: The final position of the muon is saved in truth extractor/databases as position_x,position_y and position_z.
               This is analogoues to the neutrinos whose interaction vertex is saved under the same name.

    Args:
        truth (dict) : dictionary of already extracted values
        borders (tuple) : first entry xy outline, second z min/max depth. See I3TruthExtractor for hard-code example.
        horizontal_pad (float) : shrink xy plane further with exclusion zone
        vertical_pad (float) : further shrink detector depth with exclusion height

    Returns:
        dictionary (dict) : containing the x,y,z co-ordinates of final muon position and contained boolean (0 or 1)
    
Calculates where a simulated muon stops and if this is inside the detectors fiducial volume.
IMPORTANT: The final position of the muon is saved in truth extractor/databases as position_x,position_y and position_z.
This is analogoues to the neutrinos whose interaction vertex is saved under the same name.
Calculates where a simulated muon stops and if this is inside the detectors fiducial volume . IMPORTANT : The final position of the muon is saved in truth extractor / databases as position_x position_y and position_z . This is analogoues to the neutrinos whose interaction vertex is saved under the same name .
def muon_stopped(truth, borders, horizontal_pad=100.0, vertical_pad=100.0):
    border = mpath.Path(borders[0])
    start_pos = np.array(
        [truth["position_x"], truth["position_y"], truth["position_z"]]
    )
    travel_vec = -1 * np.array(
        [
            truth["track_length"]
            * np.cos(truth["azimuth"])
            * np.sin(truth["zenith"]),
            truth["track_length"]
            * np.sin(truth["azimuth"])
            * np.sin(truth["zenith"]),
            truth["track_length"] * np.cos(truth["zenith"]),
        ]
    )
    end_pos = start_pos + travel_vec
    stopped_xy = border.contains_point(
        (end_pos[0], end_pos[1]), radius=-horizontal_pad
    )
    stopped_z = (end_pos[2] > borders[1][0] + vertical_pad) * (
        end_pos[2] < borders[1][1] - vertical_pad
    )
    return {
        "x": end_pos[0],
        "y": end_pos[1],
        "z": end_pos[2],
        "stopped": (stopped_xy * stopped_z),
    }
def muon_stopped ( truth , borders , horizontal_pad = 100.0 , vertical_pad = 100.0 ) : border = mpath . Path ( borders [ 0 ] ) start_pos = np . array ( [ truth [ "position_x" ] , truth [ "position_y" ] , truth [ "position_z" ] ] ) travel_vec = - 1 * np . array ( [ truth [ "track_length" ] * np . cos ( truth [ "azimuth" ] ) * np . sin ( truth [ "zenith" ] ) , truth [ "track_length" ] * np . sin ( truth [ "azimuth" ] ) * np . sin ( truth [ "zenith" ] ) , truth [ "track_length" ] * np . cos ( truth [ "zenith" ] ) , ] ) end_pos = start_pos + travel_vec stopped_xy = border . contains_point ( ( end_pos [ 0 ] , end_pos [ 1 ] ) , radius = - horizontal_pad ) stopped_z = ( end_pos [ 2 ] > borders [ 1 ] [ 0 ] + vertical_pad ) * ( end_pos [ 2 ] < borders [ 1 ] [ 1 ] - vertical_pad ) return { "x" : end_pos [ 0 ] , "y" : end_pos [ 1 ] , "z" : end_pos [ 2 ] , "stopped" : ( stopped_xy * stopped_z ) , }
Calculates where a simulated muon stops and if this is inside the detectors fiducial volume.
Calculates where a simulated muon stops and if this is inside the detectors fiducial volume .
"""
    Calculates where a simulated muon stops and if this is inside the detectors fiducial volume.
    IMPORTANT: The final position of the muon is saved in truth extractor/databases as position_x,position_y and position_z.
               This is analogoues to the neutrinos whose interaction vertex is saved under the same name.

    Args:
        truth (dict) : dictionary of already extracted values
        borders (tuple) : first entry xy outline, second z min/max depth. See I3TruthExtractor for hard-code example.
        horizontal_pad (float) : shrink xy plane further with exclusion zone
        vertical_pad (float) : further shrink detector depth with exclusion height

    Returns:
        dictionary (dict) : containing the x,y,z co-ordinates of final muon position and contained boolean (0 or 1)
    """ # to do:remove hard-coded border coords and replace with GCD file contents using string no's
dictionary (dict) : containing the x,y,z co-ordinates of final muon position and contained boolean (0 or 1)
dictionary ( dict ) : containing the x y z co - ordinates of final muon position and contained boolean ( 0 or 1 )
truth
dictionary of already extracted values
dictionary of already extracted values
borders
first entry xy outline, second z min/max depth. See I3TruthExtractor for hard-code example.
first entry xy outline second z min / max depth . See I3TruthExtractor for hard - code example .
horizontal_pad
shrink xy plane further with exclusion zone
shrink xy plane further with exclusion zone
vertical_pad
further shrink detector depth with exclusion height
further shrink detector depth with exclusion height