Public Member Functions | Protected Attributes | List of all members
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...
 
- 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 EventBegin (const std::vector< cluster::ClusterParamsAlg > &)
 
virtual void EventEnd ()
 
virtual void IterationBegin (const std::vector< cluster::ClusterParamsAlg > &)
 
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
 
- 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

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 26 of file CBAlgoAngleSeparate.h.

Constructor & Destructor Documentation

cmtool::CBAlgoAngleSeparate::CBAlgoAngleSeparate ( )

Default constructor.

Definition at line 8 of file CBAlgoAngleSeparate.cxx.

8  : CBoolAlgoBase()
9  //----------------------------------------
10  {
11 
12  SetDebug(false);
13  SetMaxAngleSep(20.);
14  SetMinLength(15.);
15  SetMinHits(20);
16 
17  }
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 34 of file CBAlgoAngleSeparate.h.

34 {};

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 20 of file CBAlgoAngleSeparate.cxx.

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

Function to report what's going on per merging.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 105 of file CBAlgoAngleSeparate.cxx.

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

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

Reimplemented from cmtool::CMAlgoBase.

Definition at line 56 of file CBAlgoAngleSeparate.h.

56 {}
void cmtool::CBAlgoAngleSeparate::SetDebug ( bool  on)
inline

Set Debug Mode on or off.

Definition at line 44 of file CBAlgoAngleSeparate.h.

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

Set Max Angle Separation for separation.

Definition at line 47 of file CBAlgoAngleSeparate.h.

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

SetMinimum number of hits for small cluster.

Definition at line 53 of file CBAlgoAngleSeparate.h.

53 { _minHits = n; }
std::void_t< T > n
void cmtool::CBAlgoAngleSeparate::SetMinLength ( float  len)
inline

Set Minimum length for "big" cluster.

Definition at line 50 of file CBAlgoAngleSeparate.h.

Member Data Documentation

bool cmtool::CBAlgoAngleSeparate::_debug
protected

Definition at line 63 of file CBAlgoAngleSeparate.h.

float cmtool::CBAlgoAngleSeparate::_MaxAngle
protected

Definition at line 64 of file CBAlgoAngleSeparate.h.

size_t cmtool::CBAlgoAngleSeparate::_minHits
protected

Definition at line 66 of file CBAlgoAngleSeparate.h.

float cmtool::CBAlgoAngleSeparate::_MinLen
protected

Definition at line 65 of file CBAlgoAngleSeparate.h.


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