LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
CBAlgoPolyOverlap.cxx
Go to the documentation of this file.
2 
3 namespace cmtool {
4 
6  {
7  // Nothing to be done in the base class
8  SetDebug(false);
9  SetMinNumHits(0);
10 
11  this->reconfigure();
12  }
13 
15  {
16 
17  //not sure what needs to be reset/reconfigured for this algo
18 
19  } //end reconfigure function
20 
21  bool CBAlgoPolyOverlap::Bool(const ::cluster::ClusterParamsAlg& cluster1,
22  const ::cluster::ClusterParamsAlg& cluster2)
23  {
24 
25  if ((cluster1.GetParams().N_Hits < _min_hits) || (cluster2.GetParams().N_Hits < _min_hits))
26  return false;
27 
28  //if either has < 3 sides do not merge!
29  if ((cluster1.GetParams().PolyObject.Size() < 2) or
30  (cluster2.GetParams().PolyObject.Size() < 2)) {
31  return false;
32  }
33  if (_debug and cluster1.GetParams().N_Hits > 10 and cluster2.GetParams().N_Hits > 10) {
34  std::cout << "Cluster 1:" << std::endl;
35  std::cout << "\tN_Hits: " << cluster1.GetParams().N_Hits << std::endl;
36  std::cout << "\tN Sides:" << cluster1.GetParams().PolyObject.Size() << std::endl;
37  for (unsigned int n = 0; n < cluster1.GetParams().PolyObject.Size(); n++)
38  std::cout << "\t\t\t(" << cluster1.GetParams().PolyObject.Point(n).first << ", "
39  << cluster1.GetParams().PolyObject.Point(n).second << ")" << std::endl;
40  std::cout << "Cluster 2:" << std::endl;
41  std::cout << "\tN_Hits: " << cluster2.GetParams().N_Hits << std::endl;
42  std::cout << "\tN Sides:" << cluster2.GetParams().PolyObject.Size() << std::endl;
43  for (unsigned int n = 0; n < cluster2.GetParams().PolyObject.Size(); n++)
44  std::cout << "\t\t\t(" << cluster2.GetParams().PolyObject.Point(n).first << ", "
45  << cluster2.GetParams().PolyObject.Point(n).second << ")" << std::endl;
46  }
47 
48  //if the two polygons overlap even partially
49  //then return true! --> MERGE!
50  if (cluster1.GetParams().PolyObject.PolyOverlapSegments(cluster2.GetParams().PolyObject)) {
51  if (_verbose) { std::cout << "Overlap...merging!" << std::endl; }
52  return true;
53  }
54  return false;
55  }
56 
57 }
void SetMinNumHits(size_t nhits)
CBAlgoPolyOverlap()
Default constructor.
virtual bool Bool(const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
Char_t n[5]
Class def header for a class CBAlgoPolyOverlap.
void reconfigure()
Method to re-configure the instance.
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is >= kPer...
Definition: CMAlgoBase.h:82