All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
14 
16 
17  //not sure what needs to be reset/reconfigured for this algo
18 
19  }//end reconfigure function
20 
21 
22  bool CBAlgoPolyOverlap::Bool(const ::cluster::ClusterParamsAlg &cluster1,
23  const ::cluster::ClusterParamsAlg &cluster2)
24  {
25 
26  if( (cluster1.GetParams().N_Hits < _min_hits) ||
27  (cluster2.GetParams().N_Hits < _min_hits) )
28  return false;
29 
30  //if either has < 3 sides do not merge!
31  if ( (cluster1.GetParams().PolyObject.Size() < 2) or
32  (cluster2.GetParams().PolyObject.Size() < 2) ){
33  return false;
34  }
35  if (_debug and cluster1.GetParams().N_Hits > 10 and cluster2.GetParams().N_Hits > 10) {
36  std::cout << "Cluster 1:" << std::endl;
37  std::cout << "\tN_Hits: " << cluster1.GetParams().N_Hits << std::endl;
38  std::cout << "\tN Sides:" << cluster1.GetParams().PolyObject.Size() << std::endl;
39  for (unsigned int n=0; n < cluster1.GetParams().PolyObject.Size(); n++)
40  std::cout << "\t\t\t(" << cluster1.GetParams().PolyObject.Point(n).first << ", "
41  << cluster1.GetParams().PolyObject.Point(n).second << ")" << std::endl;
42  std::cout << "Cluster 2:" << std::endl;
43  std::cout << "\tN_Hits: " << cluster2.GetParams().N_Hits << std::endl;
44  std::cout << "\tN Sides:" << cluster2.GetParams().PolyObject.Size() << std::endl;
45  for (unsigned int n=0; n < cluster2.GetParams().PolyObject.Size(); n++)
46  std::cout << "\t\t\t(" << cluster2.GetParams().PolyObject.Point(n).first << ", "
47  << cluster2.GetParams().PolyObject.Point(n).second << ")" << std::endl;
48  }
49 
50  //if the two polygons overlap even partially
51  //then return true! --> MERGE!
52  if ( cluster1.GetParams().PolyObject.PolyOverlapSegments(cluster2.GetParams().PolyObject) ){
53  if (_verbose) { std::cout << "Overlap...merging!" << std::endl; }
54  return true;
55  }
56  return false;
57 
58  }
59 
60 
61 }
void SetMinNumHits(size_t nhits)
CBAlgoPolyOverlap()
Default constructor.
return match has_match and(match.match_pdg==11 or match.match_pdg==-11)
virtual bool Bool(const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
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 &gt;= kPer...
Definition: CMAlgoBase.h:102
BEGIN_PROLOG could also be cout