LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
cmtool::CBAlgoStartInPoly Class Reference

#include "CBAlgoStartInPoly.h"

Inheritance diagram for cmtool::CBAlgoStartInPoly:
cmtool::CBoolAlgoBase cmtool::CMAlgoBase

Public Member Functions

 CBAlgoStartInPoly ()
 Default constructor. More...
 
virtual ~CBAlgoStartInPoly ()
 Default destructor. More...
 
void SetMinHitsCut (size_t n)
 Method to set cut value on minimum number of hits considered. More...
 
void SetDebug (bool debug)
 
virtual bool Bool (const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
 Merging Algorithm is Here. More...
 
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

double _wire_2_cm
 
double _time_2_cm
 
size_t _MinHits
 Conversion factors ogtten from GeometryUtilities. More...
 
bool _debug
 Minimum number of hits for cluster whose start point is being considered. We want it to be a good start point... More...
 
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 26 of file CBAlgoStartInPoly.h.

Constructor & Destructor Documentation

cmtool::CBAlgoStartInPoly::CBAlgoStartInPoly ( )

Default constructor.

Definition at line 8 of file CBAlgoStartInPoly.cxx.

References _time_2_cm, _wire_2_cm, reconfigure(), SetDebug(), SetMinHitsCut(), util::GeometryUtilities::TimeToCm(), and util::GeometryUtilities::WireToCm().

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  }
Double_t TimeToCm() const
Double_t WireToCm() const
void reconfigure()
Method to re-configure the instance.
void SetMinHitsCut(size_t n)
Method to set cut value on minimum number of hits considered.
virtual cmtool::CBAlgoStartInPoly::~CBAlgoStartInPoly ( )
inlinevirtual

Default destructor.

Definition at line 34 of file CBAlgoStartInPoly.h.

References _MinHits, n, and SetMinHitsCut().

34 {};

Member Function Documentation

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

Merging Algorithm is Here.

Reimplemented from cmtool::CBoolAlgoBase.

Definition at line 30 of file CBAlgoStartInPoly.cxx.

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

Referenced by SetDebug().

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  }
size_t _MinHits
Conversion factors ogtten from GeometryUtilities.
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 _debug
Minimum number of hits for cluster whose start point is being considered. We want it to be a good sta...
const cluster_params & GetParams() const
double t
Definition: PxUtils.h:11
const std::vector< util::PxHit > & GetHitVector() const
util::PxPoint start_point
start point
Definition: ClusterParams.h:24
double w
Definition: PxUtils.h:10
bool PointInside(const std::pair< float, float > &point) const
Definition: Polygon2D.cxx:249
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::CBAlgoStartInPoly::reconfigure ( )

Method to re-configure the instance.

Definition at line 23 of file CBAlgoStartInPoly.cxx.

Referenced by CBAlgoStartInPoly(), and SetDebug().

23  {
24 
25  //not sure what needs to be reset/reconfigured for this algo
26 
27  }//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::CBAlgoStartInPoly::SetDebug ( bool  debug)
inline

Definition at line 44 of file CBAlgoStartInPoly.h.

References _debug, Bool(), tca::debug, and reconfigure().

Referenced by CBAlgoStartInPoly().

44 { _debug = debug; }
bool _debug
Minimum number of hits for cluster whose start point is being considered. We want it to be a good sta...
DebugStuff debug
Definition: DebugStruct.cxx:4
void cmtool::CBAlgoStartInPoly::SetMinHitsCut ( size_t  n)
inline

Method to set cut value on minimum number of hits considered.

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

Definition at line 42 of file CBAlgoStartInPoly.h.

Referenced by CBAlgoStartInPoly(), and ~CBAlgoStartInPoly().

42 { _MinHits = n; }
size_t _MinHits
Conversion factors ogtten from GeometryUtilities.
Char_t n[5]
virtual void cmtool::CMAlgoBase::SetVerbose ( bool  doit = true)
inlinevirtualinherited

Member Data Documentation

bool cmtool::CBAlgoStartInPoly::_debug
protected

Minimum number of hits for cluster whose start point is being considered. We want it to be a good start point...

Definition at line 57 of file CBAlgoStartInPoly.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::CBAlgoStartInPoly::_MinHits
protected

Conversion factors ogtten from GeometryUtilities.

Definition at line 56 of file CBAlgoStartInPoly.h.

Referenced by Bool(), and ~CBAlgoStartInPoly().

double cmtool::CBAlgoStartInPoly::_time_2_cm
protected

Definition at line 55 of file CBAlgoStartInPoly.h.

Referenced by CBAlgoStartInPoly().

double cmtool::CBAlgoStartInPoly::_wire_2_cm
protected

Definition at line 55 of file CBAlgoStartInPoly.h.

Referenced by CBAlgoStartInPoly().


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