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

#include "CBAlgoAngleSeparate.h"

Inheritance diagram for cmtool::CBAlgoAngleSeparate:
cmtool::CBoolAlgoBase cmtool::CMAlgoBase

Public Member Functions

 CBAlgoAngleSeparate ()
 Default constructor. More...
 
virtual ~CBAlgoAngleSeparate ()
 Default destructor. More...
 
virtual bool Bool (const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
 
void SetDebug (bool on)
 Set Debug Mode on or off. More...
 
void SetMaxAngleSep (float angle)
 Set Max Angle Separation for separation. More...
 
void SetMinLength (float len)
 Set Minimum length for "big" cluster. More...
 
void SetMinHits (size_t n)
 SetMinimum number of hits for small cluster. More...
 
virtual void Reset ()
 Function to reset the algorithm instance ... maybe implemented via child class. More...
 
virtual void Report ()
 Function to report what's going on per merging. 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 ()
 
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

bool _debug
 
float _MaxAngle
 
float _MinLen
 
size_t _minHits
 
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

Track Prohibit algorithm: if the angle between the direction of a cluster (end-start) and the line connecting the cluster's start point and the start point of t a second cluster is too large, then probihit merging between the two clusters. The first cluster needs to be a "good" and "large" cluster algorithm has performed

Definition at line 27 of file CBAlgoAngleSeparate.h.

Constructor & Destructor Documentation

cmtool::CBAlgoAngleSeparate::CBAlgoAngleSeparate ( )

Default constructor.

Definition at line 9 of file CBAlgoAngleSeparate.cxx.

References SetDebug(), SetMaxAngleSep(), SetMinHits(), and SetMinLength().

9  : CBoolAlgoBase()
10  //----------------------------------------
11  {
12 
13  SetDebug(false);
14  SetMaxAngleSep(20.);
15  SetMinLength(15.);
16  SetMinHits(20);
17 
18  }
CBoolAlgoBase()
Default constructor.
Definition: CBoolAlgoBase.h:32
void SetMaxAngleSep(float angle)
Set Max Angle Separation for separation.
void SetMinLength(float len)
Set Minimum length for "big" cluster.
void SetDebug(bool on)
Set Debug Mode on or off.
void SetMinHits(size_t n)
SetMinimum number of hits for small cluster.
virtual cmtool::CBAlgoAngleSeparate::~CBAlgoAngleSeparate ( )
inlinevirtual

Default destructor.

Definition at line 35 of file CBAlgoAngleSeparate.h.

References Bool().

35 {};

Member Function Documentation

bool cmtool::CBAlgoAngleSeparate::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 CBAlgoAngleSeparate.cxx.

References _debug, _MaxAngle, _minHits, _MinLen, and cmtool::CMAlgoBase::_verbose.

Referenced by ~CBAlgoAngleSeparate().

24  {
25 
26  double angle1 = cluster1.GetParams().angle_2d;
27  double angle2 = cluster2.GetParams().angle_2d;
28 
29  double w_start1 = cluster1.GetParams().start_point.w;
30  double t_start1 = cluster1.GetParams().start_point.t;
31  double w_start2 = cluster2.GetParams().start_point.w;
32  double t_start2 = cluster2.GetParams().start_point.t;
33 
34  double len1 = cluster1.GetParams().length;
35  double len2 = cluster2.GetParams().length;
36 
37  size_t hits1 = cluster1.GetHitVector().size();
38  size_t hits2 = cluster1.GetHitVector().size();
39 
40  //if either cluster has less than _minHits don't even try...
41  if ( (hits1 < _minHits) or (hits2 < _minHits)
42  or (angle1 < -360) or (angle2 < -360) )
43  return false;
44 
45  if (_debug){
46  std::cout << "Cluster 1:" << std::endl;
47  std::cout << "\tStart: ( " << w_start1 << ", " << t_start1 << " )" << std::endl;
48  std::cout << "\tAngle: " << angle1 << std::endl;
49  std::cout << "\tLength: " << len1 << std::endl;
50  std::cout << "\tN Hits: " << hits1 << std::endl;
51 
52  std::cout << "Cluster 2:" << std::endl;
53  std::cout << "\tStart: ( " << w_start2 << ", " << t_start2 << " )" << std::endl;
54  std::cout << "\tAngle: " << angle2 << std::endl;
55  std::cout << "\tLength: " << len2 << std::endl;
56  std::cout << "\tN Hits: " << hits2 << std::endl;
57  }
58 
59  //cluster 1 needs to be long enough (i.e. good) and cluster 2 must have minimum number of hits
60  double angle;
61  double separation;
62 
63  //first calculate angle of line in 2D plane connectng the two start points
64  if ( (t_start2-t_start1) == 0 )
65  angle = 0.;
66  else {
67  double slope = (t_start2-t_start1)/(w_start2-w_start1);
68  angle = atan(slope)*180./3.14;
69  }
70 
71  separation = abs(angle-angle1);
72  if (_debug){
73  std::cout << "Angle S1--S2: " << angle << std::endl;
74  std::cout << "Angle1--S2: " << separation << std::endl;
75  }
76  if ( ( ( (separation > _MaxAngle) and (separation < 180-_MaxAngle) ) or
77  ( (separation > 180+_MaxAngle) and (separation< 360-_MaxAngle) ) )
78  and (hits2 > _minHits)
79  and (len1 > _MinLen) ){
80  if (_verbose) { std::cout << "Separate! cluster 1 BIG" << std::endl << std::endl; }
81  return true;
82  }
83 
84  //now change direction of angle so that it points from cluster 2 (big) to cluster 1 (small)
85  angle += 180.;
86  angle = (int)(angle) % 360;
87  separation = abs(angle-angle2);
88  if (_debug){
89  std::cout << "Angle S2--S1: " << angle << std::endl;
90  std::cout << "Angle2--S1: " << separation << std::endl;
91  }
92  if ( ( ( (separation > _MaxAngle) and (separation < 180-_MaxAngle) ) or
93  ( (separation > 180+_MaxAngle) and (separation< 360-_MaxAngle) ) )
94  and (hits1 > _minHits)
95  and (len2 > _MinLen) ){
96  if (_verbose) { std::cout << "Separate! cluster 2 BIG" << std::endl << std::endl; }
97  return true;
98  }
99 
100  if (_debug) { std::cout << std::endl; }
101  return false;
102  }
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 angle_2d
Angle of axis in wire/hit view.
Definition: ClusterParams.h:40
double w
Definition: PxUtils.h:10
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::CBAlgoAngleSeparate::Report ( )
virtual

Function to report what's going on per merging.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 106 of file CBAlgoAngleSeparate.cxx.

Referenced by Reset().

108  {
109 
110  }
virtual void cmtool::CBAlgoAngleSeparate::Reset ( )
inlinevirtual

Function to reset the algorithm instance ... maybe implemented via child class.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 57 of file CBAlgoAngleSeparate.h.

References Report().

57 {}
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::CBAlgoAngleSeparate::SetDebug ( bool  on)
inline

Set Debug Mode on or off.

Definition at line 45 of file CBAlgoAngleSeparate.h.

References _debug.

Referenced by CBAlgoAngleSeparate().

void cmtool::CBAlgoAngleSeparate::SetMaxAngleSep ( float  angle)
inline

Set Max Angle Separation for separation.

Definition at line 48 of file CBAlgoAngleSeparate.h.

References _MaxAngle.

Referenced by CBAlgoAngleSeparate().

void cmtool::CBAlgoAngleSeparate::SetMinHits ( size_t  n)
inline

SetMinimum number of hits for small cluster.

Definition at line 54 of file CBAlgoAngleSeparate.h.

References _minHits, and n.

Referenced by CBAlgoAngleSeparate().

54 { _minHits = n; }
Char_t n[5]
void cmtool::CBAlgoAngleSeparate::SetMinLength ( float  len)
inline

Set Minimum length for "big" cluster.

Definition at line 51 of file CBAlgoAngleSeparate.h.

References _MinLen.

Referenced by CBAlgoAngleSeparate().

virtual void cmtool::CMAlgoBase::SetVerbose ( bool  doit = true)
inlinevirtualinherited

Member Data Documentation

bool cmtool::CBAlgoAngleSeparate::_debug
protected

Definition at line 64 of file CBAlgoAngleSeparate.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().

float cmtool::CBAlgoAngleSeparate::_MaxAngle
protected

Definition at line 65 of file CBAlgoAngleSeparate.h.

Referenced by Bool(), and SetMaxAngleSep().

size_t cmtool::CBAlgoAngleSeparate::_minHits
protected

Definition at line 67 of file CBAlgoAngleSeparate.h.

Referenced by Bool(), and SetMinHits().

float cmtool::CBAlgoAngleSeparate::_MinLen
protected

Definition at line 66 of file CBAlgoAngleSeparate.h.

Referenced by Bool(), and SetMinLength().


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