LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
CBAlgoStartInPoly.cxx
Go to the documentation of this file.
1 #ifndef RECOTOOL_CBALGOSTARTINPOLY_CXX
2 #define RECOTOOL_CBALGOSTARTINPOLY_CXX
3 
4 #include "CBAlgoStartInPoly.h"
5 
6 namespace cmtool {
7 
9  {
10  // Nothing to be done in the base class
11  this->reconfigure();
12 
14  _wire_2_cm = geou.WireToCm();
15  _time_2_cm = geou.TimeToCm();
16 
17  SetDebug(true);
18  SetMinHitsCut(40);
19 
20  }
21 
22 
24 
25  //not sure what needs to be reset/reconfigured for this algo
26 
27  }//end reconfigure function
28 
29 
30  bool CBAlgoStartInPoly::Bool(const ::cluster::ClusterParamsAlg &cluster1,
31  const ::cluster::ClusterParamsAlg &cluster2)
32  {
33 
34  //skip if both polygons do not have minimum number of hits
35  if ( ( (cluster1.GetHitVector().size() > _MinHits) and
36  (cluster2.GetHitVector().size() > _MinHits) ) or
37  ( (cluster1.GetParams().PolyObject.Size() < 2) or
38  (cluster2.GetParams().PolyObject.Size() < 2) ) )
39  return false;
40 
41 
42  //If start point of one cluster is inside the other's polygon
43  //boundary --> then merge!
44 
45  float w_start1 = cluster1.GetParams().start_point.w;// * _wire_2_cm;
46  float t_start1 = cluster1.GetParams().start_point.t;// * _time_2_cm;
47 
48  float w_start2 = cluster2.GetParams().start_point.w;// * _wire_2_cm;
49  float t_start2 = cluster2.GetParams().start_point.t;// * _time_2_cm;
50 
51 
52  //make Point() for the two start points
53  std::pair<float,float> start1;
54  std::pair<float,float> start2;
55  start1 = std::make_pair( w_start1, t_start1);
56  start2 = std::make_pair( w_start2, t_start2);
57 
58 
59  if (_debug){
60  std::cout << "\tStart1: (" << w_start1 << ", " << t_start1 << " )" << std::endl;
61  std::cout << "\tN Sides2:" << cluster2.GetParams().PolyObject.Size() << std::endl;
62  for (unsigned int n=0; n < cluster2.GetParams().PolyObject.Size(); n++)
63  std::cout << "\t\t\t(" << cluster2.GetParams().PolyObject.Point(n).first << ", "
64  << cluster2.GetParams().PolyObject.Point(n).first << " )" << std::endl;
65  std::cout << "\tStart2: (" << w_start2 << ", " << t_start2 << " )" << std::endl;
66  std::cout << "\tN Sides2:" << cluster1.GetParams().PolyObject.Size() << std::endl;
67  for (unsigned int n=0; n < cluster1.GetParams().PolyObject.Size(); n++)
68  std::cout << "\t\t\t(" << cluster1.GetParams().PolyObject.Point(n).first << ", "
69  << cluster1.GetParams().PolyObject.Point(n).first << " )" << std::endl;
70  }
71 
72 
73  //check if start point for cluster1 is in Polygon of cluster2
74  if ( ( cluster2.GetParams().PolyObject.PointInside( start1) ) and (cluster1.GetHitVector().size() > _MinHits) ){
75  if (_verbose) {
76  std::cout << "Start point of Cluster 1 in Polygon of Cluster 2!" << std::endl;
77  }
78  return true;
79  }
80  //check if start point for cluster1 is in Polygon of cluster2
81  if ( ( cluster1.GetParams().PolyObject.PointInside( start2) ) and (cluster1.GetHitVector().size() > _MinHits) ){
82  if (_verbose) {
83  std::cout << "Start point of Cluster 2 in Polygon of Cluster 1!" << std::endl;
84  }
85  return true;
86  }
87 
88  return false;
89  }
90 
91 
92 }
93 
94 #endif
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...
Char_t n[5]
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:88
virtual bool Bool(const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
Merging Algorithm is Here.