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
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
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]