All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
cmtool::CBAlgoPolyOverlap Class Reference

#include <CBAlgoPolyOverlap.h>

Inheritance diagram for cmtool::CBAlgoPolyOverlap:
cmtool::CBoolAlgoBase cmtool::CMAlgoBase

Public Member Functions

 CBAlgoPolyOverlap ()
 Default constructor. More...
 
virtual ~CBAlgoPolyOverlap ()
 Default destructor. More...
 
virtual bool Bool (const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
 
void SetDebug (bool debug)
 
void SetMinNumHits (size_t nhits)
 
void reconfigure ()
 Method to re-configure the instance. More...
 
- Public Member Functions inherited from cmtool::CBoolAlgoBase
 CBoolAlgoBase ()
 Default constructor. More...
 
virtual ~CBoolAlgoBase ()
 Default destructor. More...
 
- Public Member Functions inherited from cmtool::CMAlgoBase
 CMAlgoBase ()
 
virtual ~CMAlgoBase ()=default
 
virtual void Reset ()
 Function to reset the algorithm instance called within CMergeManager/CMatchManager's Reset() ... maybe implemented via child class. More...
 
virtual void EventBegin (const std::vector< cluster::ClusterParamsAlg > &)
 
virtual void EventEnd ()
 
virtual void IterationBegin (const std::vector< cluster::ClusterParamsAlg > &)
 
virtual void IterationEnd ()
 
virtual void Report ()
 
void SetAnaFile (TFile *fout)
 Setter function for an output plot TFile pointer. More...
 
virtual void SetVerbose (bool doit=true)
 Setter function for verbosity. More...
 

Private Attributes

bool _debug
 
size_t _min_hits
 

Additional Inherited Members

- Protected Attributes inherited from cmtool::CMAlgoBase
TFile * _fout
 TFile pointer to an output file. More...
 
bool _verbose
 Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager's verbosity level is >= kPerMerging. More...
 

Detailed Description

Definition at line 25 of file CBAlgoPolyOverlap.h.

Constructor & Destructor Documentation

cmtool::CBAlgoPolyOverlap::CBAlgoPolyOverlap ( )

Default constructor.

Definition at line 5 of file CBAlgoPolyOverlap.cxx.

5  : CBoolAlgoBase()
6  {
7  // Nothing to be done in the base class
8  SetDebug(false);
9  SetMinNumHits(0);
10 
11  this->reconfigure();
12  }
void SetMinNumHits(size_t nhits)
CBoolAlgoBase()
Default constructor.
Definition: CBoolAlgoBase.h:32
void reconfigure()
Method to re-configure the instance.
virtual cmtool::CBAlgoPolyOverlap::~CBAlgoPolyOverlap ( )
inlinevirtual

Default destructor.

Definition at line 33 of file CBAlgoPolyOverlap.h.

33 {};

Member Function Documentation

bool cmtool::CBAlgoPolyOverlap::Bool ( const ::cluster::ClusterParamsAlg cluster1,
const ::cluster::ClusterParamsAlg cluster2 
)
virtual

Core function: given the ClusterParamsAlg input, return whether a cluster should be merged or not.

Reimplemented from cmtool::CBoolAlgoBase.

Definition at line 22 of file CBAlgoPolyOverlap.cxx.

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  }
Polygon2D PolyObject
Polygon Object...see Polygon2D.hh.
Definition: ClusterParams.h:21
const std::pair< float, float > & Point(unsigned int p) const
Definition: Polygon2D.cxx:138
unsigned int Size() const
Create Intersection Polygon.
Definition: Polygon2D.h:42
bool PolyOverlapSegments(const Polygon2D &poly2) const
Definition: Polygon2D.cxx:230
const cluster_params & GetParams() const
return match has_match and(match.match_pdg==11 or match.match_pdg==-11)
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
void cmtool::CBAlgoPolyOverlap::reconfigure ( )

Method to re-configure the instance.

Definition at line 15 of file CBAlgoPolyOverlap.cxx.

15  {
16 
17  //not sure what needs to be reset/reconfigured for this algo
18 
19  }//end reconfigure function
void cmtool::CBAlgoPolyOverlap::SetDebug ( bool  debug)
inline
void cmtool::CBAlgoPolyOverlap::SetMinNumHits ( size_t  nhits)
inline

Definition at line 45 of file CBAlgoPolyOverlap.h.

45 { _min_hits = nhits; }

Member Data Documentation

bool cmtool::CBAlgoPolyOverlap::_debug
private

Definition at line 52 of file CBAlgoPolyOverlap.h.

size_t cmtool::CBAlgoPolyOverlap::_min_hits
private

Definition at line 53 of file CBAlgoPolyOverlap.h.


The documentation for this class was generated from the following files: