CBAlgoStartInPoly.cxx
Go to the documentation of this file.
1 #include "CBAlgoStartInPoly.h"
2 
4 
5 namespace cmtool {
6 
8  {
9  // Nothing to be done in the base class
10  this->reconfigure();
11 
13  _wire_2_cm = geou.WireToCm();
14  _time_2_cm = geou.TimeToCm();
15 
16  SetDebug(true);
17  SetMinHitsCut(40);
18 
19  }
20 
21 
23 
24  //not sure what needs to be reset/reconfigured for this algo
25 
26  }//end reconfigure function
27 
28 
29  bool CBAlgoStartInPoly::Bool(const ::cluster::ClusterParamsAlg &cluster1,
30  const ::cluster::ClusterParamsAlg &cluster2)
31  {
32 
33  //skip if both polygons do not have minimum number of hits
34  if ( ( (cluster1.GetHitVector().size() > _MinHits) and
35  (cluster2.GetHitVector().size() > _MinHits) ) or
36  ( (cluster1.GetParams().PolyObject.Size() < 2) or
37  (cluster2.GetParams().PolyObject.Size() < 2) ) )
38  return false;
39 
40 
41  //If start point of one cluster is inside the other's polygon
42  //boundary --> then merge!
43 
44  float w_start1 = cluster1.GetParams().start_point.w;// * _wire_2_cm;
45  float t_start1 = cluster1.GetParams().start_point.t;// * _time_2_cm;
46 
47  float w_start2 = cluster2.GetParams().start_point.w;// * _wire_2_cm;
48  float t_start2 = cluster2.GetParams().start_point.t;// * _time_2_cm;
49 
50 
51  //make Point() for the two start points
52  std::pair<float,float> start1;
53  std::pair<float,float> start2;
54  start1 = std::make_pair( w_start1, t_start1);
55  start2 = std::make_pair( w_start2, t_start2);
56 
57 
58  if (_debug){
59  std::cout << "\tStart1: (" << w_start1 << ", " << t_start1 << " )" << std::endl;
60  std::cout << "\tN Sides2:" << cluster2.GetParams().PolyObject.Size() << std::endl;
61  for (unsigned int n=0; n < cluster2.GetParams().PolyObject.Size(); n++)
62  std::cout << "\t\t\t(" << cluster2.GetParams().PolyObject.Point(n).first << ", "
63  << cluster2.GetParams().PolyObject.Point(n).first << " )" << std::endl;
64  std::cout << "\tStart2: (" << w_start2 << ", " << t_start2 << " )" << std::endl;
65  std::cout << "\tN Sides2:" << cluster1.GetParams().PolyObject.Size() << std::endl;
66  for (unsigned int n=0; n < cluster1.GetParams().PolyObject.Size(); n++)
67  std::cout << "\t\t\t(" << cluster1.GetParams().PolyObject.Point(n).first << ", "
68  << cluster1.GetParams().PolyObject.Point(n).first << " )" << std::endl;
69  }
70 
71 
72  //check if start point for cluster1 is in Polygon of cluster2
73  if ( ( cluster2.GetParams().PolyObject.PointInside( start1) ) and (cluster1.GetHitVector().size() > _MinHits) ){
74  if (_verbose) {
75  std::cout << "Start point of Cluster 1 in Polygon of Cluster 2!" << std::endl;
76  }
77  return true;
78  }
79  //check if start point for cluster1 is in Polygon of cluster2
80  if ( ( cluster1.GetParams().PolyObject.PointInside( start2) ) and (cluster1.GetHitVector().size() > _MinHits) ){
81  if (_verbose) {
82  std::cout << "Start point of Cluster 2 in Polygon of Cluster 1!" << std::endl;
83  }
84  return true;
85  }
86 
87  return false;
88  }
89 
90 
91 }
Class def header for a class CBAlgoStartInPoly.
size_t _MinHits
Conversion factors ogtten from GeometryUtilities.
Double_t TimeToCm() const
Double_t WireToCm() const
CBAlgoStartInPoly()
Default constructor.
void reconfigure()
Method to re-configure the instance.
bool _debug
Minimum number of hits for cluster whose start point is being considered. We want it to be a good sta...
std::void_t< T > n
Definition: cfalgo.cc:3
void SetMinHitsCut(size_t n)
Method to set cut value on minimum number of hits considered.
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is >= kPer...
Definition: CMAlgoBase.h:89
QTextStream & endl(QTextStream &s)
virtual bool Bool(const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
Merging Algorithm is Here.