LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
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...
 
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 > &clusters)
 
virtual void EventEnd ()
 
virtual void IterationBegin (const std::vector< cluster::ClusterParamsAlg > &clusters)
 
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...
 

Protected Attributes

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...
 

Private Attributes

bool _debug
 
size_t _min_hits
 

Detailed Description

Definition at line 27 of file CBAlgoPolyOverlap.h.

Constructor & Destructor Documentation

cmtool::CBAlgoPolyOverlap::CBAlgoPolyOverlap ( )

Default constructor.

Definition at line 8 of file CBAlgoPolyOverlap.cxx.

References reconfigure(), SetDebug(), and SetMinNumHits().

8  : CBoolAlgoBase()
9  {
10  // Nothing to be done in the base class
11  SetDebug(false);
12  SetMinNumHits(0);
13 
14  this->reconfigure();
15  }
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 35 of file CBAlgoPolyOverlap.h.

References Bool().

35 {};

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 25 of file CBAlgoPolyOverlap.cxx.

References _debug, _min_hits, cmtool::CMAlgoBase::_verbose, and n.

Referenced by ~CBAlgoPolyOverlap().

27  {
28 
29  if( (cluster1.GetParams().N_Hits < _min_hits) ||
30  (cluster2.GetParams().N_Hits < _min_hits) )
31  return false;
32 
33  //if either has < 3 sides do not merge!
34  if ( (cluster1.GetParams().PolyObject.Size() < 2) or
35  (cluster2.GetParams().PolyObject.Size() < 2) ){
36  return false;
37  }
38  if (_debug and cluster1.GetParams().N_Hits > 10 and cluster2.GetParams().N_Hits > 10) {
39  std::cout << "Cluster 1:" << std::endl;
40  std::cout << "\tN_Hits: " << cluster1.GetParams().N_Hits << std::endl;
41  std::cout << "\tN Sides:" << cluster1.GetParams().PolyObject.Size() << std::endl;
42  for (unsigned int n=0; n < cluster1.GetParams().PolyObject.Size(); n++)
43  std::cout << "\t\t\t(" << cluster1.GetParams().PolyObject.Point(n).first << ", "
44  << cluster1.GetParams().PolyObject.Point(n).second << ")" << std::endl;
45  std::cout << "Cluster 2:" << std::endl;
46  std::cout << "\tN_Hits: " << cluster2.GetParams().N_Hits << std::endl;
47  std::cout << "\tN Sides:" << cluster2.GetParams().PolyObject.Size() << std::endl;
48  for (unsigned int n=0; n < cluster2.GetParams().PolyObject.Size(); n++)
49  std::cout << "\t\t\t(" << cluster2.GetParams().PolyObject.Point(n).first << ", "
50  << cluster2.GetParams().PolyObject.Point(n).second << ")" << std::endl;
51  }
52 
53  //if the two polygons overlap even partially
54  //then return true! --> MERGE!
55  if ( cluster1.GetParams().PolyObject.PolyOverlapSegments(cluster2.GetParams().PolyObject) ){
56  if (_verbose) { std::cout << "Overlap...merging!" << std::endl; }
57  return true;
58  }
59  return false;
60 
61  }
Polygon2D PolyObject
Polygon Object...see Polygon2D.hh.
Definition: ClusterParams.h:22
const std::pair< float, float > & Point(unsigned int p) const
Definition: Polygon2D.cxx:135
unsigned int Size() const
Create Intersection Polygon.
Definition: Polygon2D.h:47
bool PolyOverlapSegments(const Polygon2D &poly2) const
Definition: Polygon2D.cxx:227
const cluster_params & GetParams() const
Char_t n[5]
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is >= kPer...
Definition: CMAlgoBase.h:88
virtual void cmtool::CMAlgoBase::EventBegin ( const std::vector< cluster::ClusterParamsAlg > &  clusters)
inlinevirtualinherited

Optional function: called at the beginning of 1st iteration. This is called per event.

Reimplemented in cmtool::CFAlgoArray, cmtool::CPAlgoArray, cmtool::CBAlgoArray, and cmtool::CBAlgoPolyShortestDist.

Definition at line 45 of file CMAlgoBase.h.

Referenced by cmtool::CMergeManager::EventBegin().

46  { if(clusters.size()) return; }
virtual void cmtool::CMAlgoBase::EventEnd ( )
inlinevirtualinherited

Optional function: called at the end of event ... after the last merging iteration is over.

Reimplemented in cmtool::CFAlgoArray, cmtool::CPAlgoArray, and cmtool::CBAlgoArray.

Definition at line 51 of file CMAlgoBase.h.

Referenced by cmtool::CMatchManager::EventEnd(), and cmtool::CMergeManager::EventEnd().

52  {return;}
virtual void cmtool::CMAlgoBase::IterationBegin ( const std::vector< cluster::ClusterParamsAlg > &  clusters)
inlinevirtualinherited

Optional function: called at the beggining of each iteration over all pairs of clusters. This provides all clusters' information in case the algorithm need them. Note this is called per iteration which may be more than once per event.

Reimplemented in cmtool::CFAlgoArray, cmtool::CPAlgoArray, and cmtool::CBAlgoArray.

Definition at line 59 of file CMAlgoBase.h.

Referenced by cmtool::CMatchManager::EventBegin(), cmtool::CMatchManager::IterationBegin(), and cmtool::CMergeManager::IterationBegin().

60  { if(clusters.size()) return;}
virtual void cmtool::CMAlgoBase::IterationEnd ( )
inlinevirtualinherited

Optional function: called at the end of each iteration over all pairs of clusters.

Reimplemented in cmtool::CFAlgoArray, cmtool::CPAlgoArray, and cmtool::CBAlgoArray.

Definition at line 65 of file CMAlgoBase.h.

Referenced by cmtool::CMatchManager::IterationEnd(), and cmtool::CMergeManager::IterationEnd().

66  {return; }
void cmtool::CBAlgoPolyOverlap::reconfigure ( )

Method to re-configure the instance.

Definition at line 18 of file CBAlgoPolyOverlap.cxx.

Referenced by CBAlgoPolyOverlap(), and SetMinNumHits().

18  {
19 
20  //not sure what needs to be reset/reconfigured for this algo
21 
22  }//end reconfigure function
void cmtool::CMAlgoBase::SetAnaFile ( TFile *  fout)
inlineinherited

Setter function for an output plot TFile pointer.

Definition at line 77 of file CMAlgoBase.h.

References cmtool::CMAlgoBase::_fout.

Referenced by cmtool::CMergeManager::EventBegin().

77 { _fout = fout; }
TFile * _fout
TFile pointer to an output file.
Definition: CMAlgoBase.h:85
void cmtool::CBAlgoPolyOverlap::SetDebug ( bool  debug)
inline

Definition at line 44 of file CBAlgoPolyOverlap.h.

References _debug, and tca::debug.

Referenced by CBAlgoPolyOverlap().

44 { _debug = debug; }
DebugStuff debug
Definition: DebugStruct.cxx:4
void cmtool::CBAlgoPolyOverlap::SetMinNumHits ( size_t  nhits)
inline

Definition at line 47 of file CBAlgoPolyOverlap.h.

References _min_hits, and reconfigure().

Referenced by CBAlgoPolyOverlap().

47 { _min_hits = nhits; }
virtual void cmtool::CMAlgoBase::SetVerbose ( bool  doit = true)
inlinevirtualinherited

Member Data Documentation

bool cmtool::CBAlgoPolyOverlap::_debug
private

Definition at line 54 of file CBAlgoPolyOverlap.h.

Referenced by Bool(), and SetDebug().

TFile* cmtool::CMAlgoBase::_fout
protectedinherited

TFile pointer to an output file.

Definition at line 85 of file CMAlgoBase.h.

Referenced by cmtool::CMAlgoBase::CMAlgoBase(), and cmtool::CMAlgoBase::SetAnaFile().

size_t cmtool::CBAlgoPolyOverlap::_min_hits
private

Definition at line 55 of file CBAlgoPolyOverlap.h.

Referenced by Bool(), and SetMinNumHits().


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