32 const ::cluster::ClusterParamsAlg &cluster2)
46 double w_start1 = cluster1.GetParams().start_point.w;
47 double t_start1 = cluster1.GetParams().start_point.t;
48 double w_end1 = cluster1.GetParams().end_point.w;
49 double t_end1 = cluster1.GetParams().end_point.t;
51 double w_start2 = cluster2.GetParams().start_point.w;
52 double t_start2 = cluster2.GetParams().start_point.t;
53 double w_end2 = cluster2.GetParams().end_point.w;
54 double t_end2 = cluster2.GetParams().end_point.t;
57 std::cout <<
"Start point Cluster 1: (" << cluster1.GetParams().start_point.w <<
", " << cluster1.GetParams().start_point.t <<
")" <<
std::endl;
58 std::cout <<
"End point Cluster 2: (" << cluster1.GetParams().end_point.w <<
", " << cluster1.GetParams().end_point.t <<
")" <<
std::endl;
59 std::cout <<
"Start point Cluster 1: (" << cluster2.GetParams().start_point.w <<
", " << cluster2.GetParams().start_point.t <<
")" <<
std::endl;
60 std::cout <<
"End point Cluster 2: (" << cluster2.GetParams().end_point.w <<
", " << cluster2.GetParams().end_point.t <<
")" <<
std::endl;
82 shortest_distance2 = (shortest_distance2_tmp < shortest_distance2) ?
83 shortest_distance2_tmp : shortest_distance2;
90 shortest_distance2 = (shortest_distance2_tmp < shortest_distance2) ?
91 shortest_distance2_tmp : shortest_distance2;
98 shortest_distance2 = (shortest_distance2_tmp < shortest_distance2) ?
99 shortest_distance2_tmp : shortest_distance2;
105 if(compatible) std::cout<<Form(
" Compatible in distance (%g).\n",shortest_distance2);
106 else std::cout<<Form(
" NOT compatible in distance (%g).\n",shortest_distance2);
116 double start_x,
double start_y,
117 double end_x,
double end_y )
const {
125 double distance_squared = -1;
128 double length_squared =
pow((end_x - start_x), 2) +
pow((end_y - start_y), 2);
134 std::cout << Form(
" Provided very short line segment: (%g,%g) => (%g,%g)",
135 start_x,start_y,end_x,end_y) <<
std::endl;
136 std::cout <<
" Likely this means one of two clusters have start & end point identical." <<
std::endl;
137 std::cout <<
" Check the cluster output!" <<
std::endl;
139 std::cout << Form(
" At this time, the algorithm uses a point (%g,%g)",start_x,start_y) <<
std::endl;
140 std::cout <<
" to represent this cluster's location." <<
std::endl;
143 return (
pow((point_x - start_x),2) +
pow((point_y - start_y),2));
147 double t = ( (point_x - start_x)*(end_x - start_x) + (point_y - start_y)*(end_y - start_y) ) / length_squared;
149 if(t<0.0) distance_squared =
pow((point_x - start_x), 2) +
pow((point_y - start_y), 2);
151 else if (t>1.0) distance_squared =
pow((point_x - end_x), 2) +
pow(point_y - end_y, 2);
153 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);
155 return distance_squared;
Class def header for a class CBAlgoShortestDistSmallCluster.
Double_t TimeToCm() const
Double_t WireToCm() const
QTextStream & endl(QTextStream &s)