24 const ::cluster::ClusterParamsAlg& cluster2)
32 if ((cluster1.GetHitVector().size() >
_minHits) and (cluster2.GetHitVector().size() <
_maxHits))
34 else if ((cluster2.GetHitVector().size() >
_minHits) and
35 (cluster1.GetHitVector().size() <
_maxHits))
56 std::vector<util::PxHit> hitss;
58 hitss = cluster1.GetHitVector();
59 hitssmall = hitss.size();
60 direc_angle = cluster2.GetParams().angle_2d;
61 opening_angle = cluster2.GetParams().opening_angle * (180. / 3.14);
62 length = cluster2.GetParams().length;
63 start_w = cluster2.GetParams().start_point.w;
64 start_t = cluster2.GetParams().start_point.t;
65 end_w = cluster2.GetParams().end_point.w;
66 end_t = cluster2.GetParams().end_point.t;
67 poly = cluster2.GetParams().PolyObject;
70 hitss = cluster2.GetHitVector();
71 hitssmall = hitss.size();
72 direc_angle = cluster1.GetParams().angle_2d;
73 opening_angle = cluster1.GetParams().opening_angle * (180. / 3.14);
74 length = cluster1.GetParams().length;
75 start_w = cluster1.GetParams().start_point.w;
76 start_t = cluster1.GetParams().start_point.t;
77 end_w = cluster1.GetParams().end_point.w;
78 end_t = cluster1.GetParams().end_point.t;
79 poly = cluster1.GetParams().PolyObject;
83 std::cout <<
"Big Cluster:" << std::endl;
84 std::cout <<
"\tOpening Angle: " << opening_angle << std::endl;
85 std::cout <<
"\tLength: " << length << std::endl;
86 std::cout <<
"\tStart Point: (" << start_w <<
", " << end_w <<
")" << std::endl;
87 std::cout <<
"\tDirection Angle: " << direc_angle << std::endl;
88 std::cout << std::endl;
91 for (
auto&
hit : hitss) {
92 COM_t_s +=
hit.t *
hit.charge;
93 COM_w_s +=
hit.w *
hit.charge;
100 std::cout <<
"Small Cluster: " << std::endl;
101 std::cout <<
"N Hits: " << hitssmall << std::endl;
102 std::cout <<
"COM: (w,t) -> (" << COM_w_s <<
", " << COM_t_s <<
")" << std::endl;
103 std::cout << std::endl;
107 std::pair<float, float> COM_s;
108 COM_s = std::make_pair(COM_w_s, COM_t_s);
111 double COM_w_rot = (COM_w_s - start_w) * cos(direc_angle * 3.14 / 180.) +
112 (COM_t_s - start_t) * sin(direc_angle * 3.14 / 180.);
113 double COM_t_rot = -(COM_w_s - start_w) * sin(direc_angle * 3.14 / 180.) +
114 (COM_t_s - start_t) * cos(direc_angle * 3.14 / 180.);
118 if (
_verbose) { std::cout <<
"Polygon Overlap -> Merge!" << std::endl << std::endl; }
123 (
abs(COM_t_rot) <
abs(COM_w_rot * sin(opening_angle * 3.14 / 180.)))) {
124 if (
_verbose) { std::cout <<
"COM in Cone -> Merge! " << std::endl; }
130 if (
_verbose) { std::cout <<
"COM close to start-end -> Merge!" << std::endl; }
156 double distance_squared = -1;
159 double length_squared = pow((end_x - start_x), 2) + pow((end_y - start_y), 2);
162 if (length_squared < 0.1) {
164 std::cout << std::endl;
165 std::cout << Form(
" Provided very short line segment: (%g,%g) => (%g,%g)",
171 std::cout <<
" Likely this means one of two clusters have start & end point identical." 173 std::cout <<
" Check the cluster output!" << std::endl;
174 std::cout << std::endl;
175 std::cout << Form(
" At this time, the algorithm uses a point (%g,%g)", start_x, start_y)
177 std::cout <<
" to represent this cluster's location." << std::endl;
178 std::cout << std::endl;
181 return (pow((point_x - start_x), 2) + pow((point_y - start_y), 2));
185 double t = ((point_x - start_x) * (end_x - start_x) + (point_y - start_y) * (end_y - start_y)) /
189 distance_squared = pow((point_x - start_x), 2) + pow((point_y - start_y), 2);
192 distance_squared = pow((point_x - end_x), 2) + pow(point_y - end_y, 2);
195 distance_squared = pow((point_x - (start_x + t * (end_x - start_x))), 2) +
196 pow((point_y - (start_y + t * (end_y - start_y))), 2);
198 return distance_squared;
constexpr auto abs(T v)
Returns the absolute value of the argument.
Detector simulation of raw signals on wires.
bool PointInside(const std::pair< float, float > &point) const
Class def header for a class CBAlgoCenterOfMass.