Class TrackOTFit

Class Documentation

class TrackOTFit

Least squares fit of vertex location to prong clusters.

Public Functions

TrackOTFit()
virtual ~TrackOTFit()
void fit(std::vector<std::vector<float>> &initial_track, std::vector<std::vector<float>> &track_pts_w_feat_v)

fit points [unfinished function right now]

Parameters
  • initial_track: Initial track points, consisting of a start and end point
  • track_pts_w_feat_v: vector of space points (vector<float>) to fit to

Public Static Functions

float d2_segment_point(const std::vector<float> &seg_start, const std::vector<float> &seg_end, const std::vector<float> &testpt)

calculate the squared-distance from a line segment

Use line-distance formala if test point projects onto the segment. Use point-point distance if projects outside the segment

Parameters
  • seg_start: Start spacepoint defining segment
  • seg_end: End spacepoint defining segment
  • testpt: Test spacepoint

std::vector<float> grad_d2_wrt_segend(const std::vector<float> &seg_start, const std::vector<float> &seg_end, const std::vector<float> &testpt)

calculate gradient of squared distance with respect to end-point position

Parameters
  • seg_start: Segment start point
  • seg_end: Segment end point
  • testpt: Test point

void getLossAndGradient(const std::vector<std::vector<float>> &initial_track, const std::vector<std::vector<float>> &track_pts_w_feat_v, float &loss, std::vector<float> &grad)

calculate loss and gradient without weighting points

Parameters
  • initial_track: Initial track points, consisting of a start and end point
  • track_pts_w_feat_v: vector of space points (vector<float>) to fit to
  • loss: The final total loss which is the average squared-distance
  • grad: The average gradient for all points

void getWeightedLossAndGradient(const std::vector<std::vector<float>> &initial_track, const std::vector<std::vector<float>> &track_pts_w_feat_v, float &loss, float &totweight, std::vector<float> &grad)

calculate loss and gradient with weights

For the vectors in track_pts_w_feat_v, the first 3 entries are (x,y,z). The weight for a given spacepoint is calculated by multiplying all vector values for entries [3:] and above.

Parameters
  • initial_track: Initial track points, consisting of a start and end point
  • track_pts_w_feat_v: vector of space points (vector<float>) to fit to
  • loss: The final total loss which is the average squared-distance
  • tot_weight: The total weight
  • grad: The weighted average gradient for all points