34 const ::cluster::ClusterParamsAlg &cluster2)
42 double w_start1 = cluster1.GetParams().start_point.w;
43 double t_start1 = cluster1.GetParams().start_point.t;
44 double w_end1 = cluster1.GetParams().end_point.w;
45 double t_end1 = cluster1.GetParams().end_point.t;
47 double w_start2 = cluster2.GetParams().start_point.w;
48 double t_start2 = cluster2.GetParams().start_point.t;
49 double w_end2 = cluster2.GetParams().end_point.w;
50 double t_end2 = cluster2.GetParams().end_point.t;
53 std::cout <<
"Start point Cluster 1: (" << cluster1.GetParams().start_point.w <<
", " << cluster1.GetParams().start_point.t <<
")" <<
std::endl;
54 std::cout <<
"End point Cluster 2: (" << cluster1.GetParams().end_point.w <<
", " << cluster1.GetParams().end_point.t <<
")" <<
std::endl;
55 std::cout <<
"Start point Cluster 1: (" << cluster2.GetParams().start_point.w <<
", " << cluster2.GetParams().start_point.t <<
")" <<
std::endl;
56 std::cout <<
"End point Cluster 2: (" << cluster2.GetParams().end_point.w <<
", " << cluster2.GetParams().end_point.t <<
")" <<
std::endl;
78 shortest_distance2 = (shortest_distance2_tmp < shortest_distance2) ?
79 shortest_distance2_tmp : shortest_distance2;
86 shortest_distance2 = (shortest_distance2_tmp < shortest_distance2) ?
87 shortest_distance2_tmp : shortest_distance2;
94 shortest_distance2 = (shortest_distance2_tmp < shortest_distance2) ?
95 shortest_distance2_tmp : shortest_distance2;
101 if(compatible) std::cout<<Form(
" Compatible in distance (%g).\n",shortest_distance2);
102 else std::cout<<Form(
" NOT compatible in distance (%g).\n",shortest_distance2);
112 double start_x,
double start_y,
113 double end_x,
double end_y )
const {
121 double distance_squared = -1;
124 double length_squared =
pow((end_x - start_x), 2) +
pow((end_y - start_y), 2);
130 std::cout << Form(
" Provided very short line segment: (%g,%g) => (%g,%g)",
131 start_x,start_y,end_x,end_y) <<
std::endl;
132 std::cout <<
" Likely this means one of two clusters have start & end point identical." <<
std::endl;
133 std::cout <<
" Check the cluster output!" <<
std::endl;
135 std::cout << Form(
" At this time, the algorithm uses a point (%g,%g)",start_x,start_y) <<
std::endl;
136 std::cout <<
" to represent this cluster's location." <<
std::endl;
139 return (
pow((point_x - start_x),2) +
pow((point_y - start_y),2));
143 double t = ( (point_x - start_x)*(end_x - start_x) + (point_y - start_y)*(end_y - start_y) ) / length_squared;
145 if(t<0.0) distance_squared =
pow((point_x - start_x), 2) +
pow((point_y - start_y), 2);
147 else if (t>1.0) distance_squared =
pow((point_x - end_x), 2) +
pow(point_y - end_y, 2);
149 else distance_squared =
pow((point_x - (start_x + t*(end_x - start_x))), 2) +
pow((point_y - (start_y + t*(end_y - start_y))),2);
151 return distance_squared;
Double_t TimeToCm() const
Double_t WireToCm() const
Class def header for a class CBAlgoShortestDist.
QTextStream & endl(QTextStream &s)