LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 > &)
 
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...
 

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

Constructor & Destructor Documentation

cmtool::CBAlgoPolyOverlap::CBAlgoPolyOverlap ( )

Default constructor.

Definition at line 5 of file CBAlgoPolyOverlap.cxx.

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

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:31
void reconfigure()
Method to re-configure the instance.
virtual cmtool::CBAlgoPolyOverlap::~CBAlgoPolyOverlap ( )
inlinevirtual

Default destructor.

Definition at line 32 of file CBAlgoPolyOverlap.h.

References Bool().

32 {};

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

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

Referenced by ~CBAlgoPolyOverlap().

23  {
24 
25  if ((cluster1.GetParams().N_Hits < _min_hits) || (cluster2.GetParams().N_Hits < _min_hits))
26  return false;
27 
28  //if either has < 3 sides do not merge!
29  if ((cluster1.GetParams().PolyObject.Size() < 2) or
30  (cluster2.GetParams().PolyObject.Size() < 2)) {
31  return false;
32  }
33  if (_debug and cluster1.GetParams().N_Hits > 10 and cluster2.GetParams().N_Hits > 10) {
34  std::cout << "Cluster 1:" << std::endl;
35  std::cout << "\tN_Hits: " << cluster1.GetParams().N_Hits << std::endl;
36  std::cout << "\tN Sides:" << cluster1.GetParams().PolyObject.Size() << std::endl;
37  for (unsigned int n = 0; n < cluster1.GetParams().PolyObject.Size(); n++)
38  std::cout << "\t\t\t(" << cluster1.GetParams().PolyObject.Point(n).first << ", "
39  << cluster1.GetParams().PolyObject.Point(n).second << ")" << std::endl;
40  std::cout << "Cluster 2:" << std::endl;
41  std::cout << "\tN_Hits: " << cluster2.GetParams().N_Hits << std::endl;
42  std::cout << "\tN Sides:" << cluster2.GetParams().PolyObject.Size() << std::endl;
43  for (unsigned int n = 0; n < cluster2.GetParams().PolyObject.Size(); n++)
44  std::cout << "\t\t\t(" << cluster2.GetParams().PolyObject.Point(n).first << ", "
45  << cluster2.GetParams().PolyObject.Point(n).second << ")" << std::endl;
46  }
47 
48  //if the two polygons overlap even partially
49  //then return true! --> MERGE!
50  if (cluster1.GetParams().PolyObject.PolyOverlapSegments(cluster2.GetParams().PolyObject)) {
51  if (_verbose) { std::cout << "Overlap...merging!" << std::endl; }
52  return true;
53  }
54  return false;
55  }
Polygon2D PolyObject
Polygon Object...see Polygon2D.hh.
Definition: ClusterParams.h:21
const std::pair< float, float > & Point(unsigned int p) const
Definition: Polygon2D.cxx:158
unsigned int Size() const
Create Intersection Polygon.
Definition: Polygon2D.h:41
bool PolyOverlapSegments(const Polygon2D &poly2) const
Definition: Polygon2D.cxx:247
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:82
virtual void cmtool::CMAlgoBase::EventBegin ( const std::vector< cluster::ClusterParamsAlg > &  )
inlinevirtualinherited

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

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

Definition at line 45 of file CMAlgoBase.h.

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

45 {}
virtual void cmtool::CMAlgoBase::EventEnd ( )
inlinevirtualinherited

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

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

Definition at line 50 of file CMAlgoBase.h.

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

50 {}
virtual void cmtool::CMAlgoBase::IterationBegin ( const std::vector< cluster::ClusterParamsAlg > &  )
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::CPAlgoArray, and cmtool::CBAlgoArray.

Definition at line 57 of file CMAlgoBase.h.

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

57 {}
virtual void cmtool::CMAlgoBase::IterationEnd ( )
inlinevirtualinherited

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

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

Definition at line 62 of file CMAlgoBase.h.

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

62 {}
void cmtool::CBAlgoPolyOverlap::reconfigure ( )

Method to re-configure the instance.

Definition at line 14 of file CBAlgoPolyOverlap.cxx.

Referenced by CBAlgoPolyOverlap(), and SetMinNumHits().

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

Setter function for an output plot TFile pointer.

Definition at line 72 of file CMAlgoBase.h.

References cmtool::CMAlgoBase::_fout.

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

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

Definition at line 41 of file CBAlgoPolyOverlap.h.

References _debug, and tca::debug.

Referenced by CBAlgoPolyOverlap().

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

Definition at line 44 of file CBAlgoPolyOverlap.h.

References _min_hits, and reconfigure().

Referenced by CBAlgoPolyOverlap().

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

Setter function for verbosity.

Reimplemented in cmtool::CBAlgoArray, and cmtool::CFAlgoTimeOverlap.

Definition at line 75 of file CMAlgoBase.h.

References cmtool::CMAlgoBase::_verbose.

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

75 { _verbose = doit; }
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is >= kPer...
Definition: CMAlgoBase.h:82

Member Data Documentation

bool cmtool::CBAlgoPolyOverlap::_debug
private

Definition at line 50 of file CBAlgoPolyOverlap.h.

Referenced by Bool(), and SetDebug().

TFile* cmtool::CMAlgoBase::_fout
protectedinherited

TFile pointer to an output file.

Definition at line 79 of file CMAlgoBase.h.

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

size_t cmtool::CBAlgoPolyOverlap::_min_hits
private

Definition at line 51 of file CBAlgoPolyOverlap.h.

Referenced by Bool(), and SetMinNumHits().


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