def compute_track_line(silicon_hit_lines):
    # Translate so we operate in a different coordinate system. Track begins at z = 0mm, Closest line at 50 000mm = 50m
    translate_hit_lines(
        silicon_hit_lines
    )  # Translated z. So the closest z to IP5 =  [-/+] 50m = [+/-] 50 000 mm

    # Constraints
    seed_x0 = get_seed_x0(silicon_hit_lines)
    bounds = get_bounds()

    # Computing solution
    global HIT_LINES
    HIT_LINES = silicon_hit_lines
    solution = least_squares(objective,
                             seed_x0,
                             bounds=bounds,
                             jac='2-point',
                             method='trf')
    track_line = Line(params=solution.x)  # solution.x = [x, y, dx, dy, dz]

    # Normalization
    track_line.normalize_line_vector()  # |[dx, dy, dz]| = 1.0
    normalize_point(
        track_line
    )  # We assumed silicon_hit_lines starts from [+/-] 50m. Move point to real "z" of first line.
    # We want track_line.z = FIRST_Z_FROM_IP
    untranslate_hit_lines(silicon_hit_lines)

    return track_line
예제 #2
0
    def get_tracks_in_det_no(solution, hit_lines):
        track_line = Line(params=solution.x)
        silicon_id_list = TrackProviderDfUtility.get_silicon_id_list(hit_lines)
        det_with_track = TrackProviderDfUtility.get_det_with_track_list(
            silicon_id_list, track_line)

        return len(det_with_track)
예제 #3
0
    def compute_line(self, rp_id, rp_hits_df):
        self.uv_skeleton.setup(rp_id, rp_hits_df, self.det_avg_geom_df,
                               self.rp_geom_df)
        pt0 = self.uv_skeleton.get_pt0()
        pt1 = self.uv_skeleton.get_pt1()

        return Line(start=pt0, end=pt1, silicon_id=rp_id * 10)
예제 #4
0
    def get_multitrack_line(self, honza_row):
        event_id = honza_row[EVENT]
        group_id = honza_row[GROUP]

        multitrack_row = self.multitrack_df[
            (self.multitrack_df[EVENT] == event_id)
            & (self.multitrack_df[GROUP] == group_id)]

        x = float(multitrack_row['x [mm]'])
        y = float(multitrack_row['y [mm]'])
        z = float(multitrack_row['z [mm]'])
        dx = float(multitrack_row['dx'])
        dy = float(multitrack_row['dy'])
        dz = float(multitrack_row['dz'])

        return Line(x, y, z, dx, dy, dz)
예제 #5
0
    def create_lines(self, current_hits_df):
        lines = []

        for idx, hit_info in current_hits_df.iterrows():
            silicon_id = compute_silicon_id(hit_info)
            silicon_info = self.extract_silicon_info(silicon_id)

            x = hit_line_x(hit_info, silicon_info)
            y = hit_line_y(hit_info, silicon_info)
            z = hit_line_z(silicon_info)
            dx = hit_line_dx(silicon_info)
            dy = hit_line_dy(silicon_info)
            dz = hit_line_dz()

            lines.append(Line(x, y, z, dx, dy, dz, silicon_id=silicon_id))

        return lines
def get_silicon_hit_lines(hit_positions_df):
    silicon_hit_lines = []

    for idx, hit_position_info in hit_positions_df.iterrows():
        silicon_id = get_silicon_id(hit_position_info)
        silicon_info = get_silicon_info(silicon_id)

        x = hit_line_x(hit_position_info, silicon_info)
        y = hit_line_y(hit_position_info, silicon_info)
        z = hit_line_z_in_mm(silicon_info)
        dx = hit_line_dx(silicon_info)
        dy = hit_line_dy(silicon_info)
        dz = hit_line_dz()

        silicon_hit_lines.append(Line(x, y, z, dx, dy, dz, silicon_id=silicon_id))

    return silicon_hit_lines
def objective(params):
    x, y, dx, dy, dz = params
    line = Line(x=x, y=y, dx=dx, dy=dy, dz=dz)  # Assume z = 0
    return np.sum([line.distance(other)
                   for other in HIT_LINES])  # Sum of distances
예제 #8
0
 def get_chi2(solution, hit_lines):
     # We assume that our track begins on z = LOWEST_ABS_SILICON_Z
     track = Line(params=solution.x,
                  z=HitLinesProviderConfig.LOWEST_ABS_SILICON_Z)
     return sum([(track.distance(hit_line) / SIGMA)**2
                 for hit_line in hit_lines])  # SUM OF DISTANCES
예제 #9
0
 def get_distances(solution, hit_lines):
     # We assume that our track begins on z = LOWEST_ABS_SILICON_Z
     track = Line(params=solution.x,
                  z=HitLinesProviderConfig.LOWEST_ABS_SILICON_Z)
     return [track.distance(line) for line in hit_lines]