All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
cmtool::CBAlgoOutOfConeSeparate Class Reference

#include <CBAlgoOutOfConeSeparate.h>

Inheritance diagram for cmtool::CBAlgoOutOfConeSeparate:
cmtool::CBoolAlgoBase cmtool::CMAlgoBase

Public Member Functions

 CBAlgoOutOfConeSeparate ()
 Default constructor. More...
 
virtual ~CBAlgoOutOfConeSeparate ()
 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 SetMaxAngleFar (float angle)
 Set Max Angle Separation for separation for far away clusters. More...
 
void SetStartAngleFalloff (float d)
 Set Distance at which cone-acceptance angle starts falling off as 1/distance. Value should be distance^2 in cm^2. 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 _MaxAngleFar
 
float _MinLen
 
float _FallOff
 
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

Definition at line 26 of file CBAlgoOutOfConeSeparate.h.

Constructor & Destructor Documentation

cmtool::CBAlgoOutOfConeSeparate::CBAlgoOutOfConeSeparate ( )

Default constructor.

Definition at line 8 of file CBAlgoOutOfConeSeparate.cxx.

8  : CBoolAlgoBase()
9  //----------------------------------------
10  {
11 
12  SetDebug(false);
13  SetMaxAngleSep(20.);
14  SetMinLength(15.);
15  SetMinHits(20);
16  SetStartAngleFalloff(2800); // in cm^2
17 
18  }
void SetMinLength(float len)
Set Minimum length for &quot;big&quot; cluster.
void SetStartAngleFalloff(float d)
Set Distance at which cone-acceptance angle starts falling off as 1/distance. Value should be distanc...
void SetDebug(bool on)
Set Debug Mode on or off.
void SetMaxAngleSep(float angle)
Set Max Angle Separation for separation.
CBoolAlgoBase()
Default constructor.
Definition: CBoolAlgoBase.h:32
void SetMinHits(size_t n)
SetMinimum number of hits for small cluster.
virtual cmtool::CBAlgoOutOfConeSeparate::~CBAlgoOutOfConeSeparate ( )
inlinevirtual

Default destructor.

Definition at line 34 of file CBAlgoOutOfConeSeparate.h.

34 {};

Member Function Documentation

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

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 = cluster2.GetHitVector().size();
39 
40  double startseparation = (w_start2-w_start1)*(w_start2-w_start1) + (t_start2-t_start1)*(t_start2-t_start1);
41  //convert sepration to be instead of just angle -> angle/distance^n (n=1 for now)
42  SetMaxAngleFar(_MaxAngle*(_FallOff/startseparation)); //distance^2 of 400 cm^2 taken as "standard"
43  if ( _MaxAngleFar > 90. )
44  _MaxAngleFar = 90.;
45 
46  //if either cluster has less than _minHits don't even try...
47  if ( (hits1 < _minHits) or (hits2 < _minHits)
48  or (angle1 < -360) or (angle2 < -360) )
49  return false;
50 
51  if (_debug){
52  std::cout << "Cluster 1:" << std::endl;
53  std::cout << "\tStart: ( " << w_start1 << ", " << t_start1 << " )" << std::endl;
54  std::cout << "\tAngle: " << angle1 << std::endl;
55  std::cout << "\tLength: " << len1 << std::endl;
56  std::cout << "\tN Hits: " << hits1 << std::endl;
57 
58  std::cout << "Cluster 2:" << std::endl;
59  std::cout << "\tStart: ( " << w_start2 << ", " << t_start2 << " )" << std::endl;
60  std::cout << "\tAngle: " << angle2 << std::endl;
61  std::cout << "\tLength: " << len2 << std::endl;
62  std::cout << "\tN Hits: " << hits2 << std::endl;
63 
64  std::cout << "Start Point Separation: " << startseparation << std::endl;
65  }
66 
67  //cluster 1 needs to be long enough (i.e. good) and cluster 2 must have minimum number of hits
68  double angle;
69  double separation;
70 
71  if ( startseparation == 0 ) //do not prohibit merging if start point identical
72  return false;
73 
74  //first calculate angle of line in 2D plane connectng the two start points
75  if ( (t_start2-t_start1) == 0 )
76  angle = 0.;
77  else {
78  double slope = (t_start2-t_start1)/(w_start2-w_start1);
79  angle = atan(slope)*180./3.14;
80  }
81 
82  separation = abs(angle-angle1);
83 
84  if (_debug){
85  std::cout << "Angle S1--S2: " << angle << std::endl;
86  std::cout << "Angle1--S2: " << separation << std::endl;
87  }
88  if ( ( ( ( (separation > _MaxAngle) and (separation < 180-_MaxAngle) ) or
89  ( (separation > 180+_MaxAngle) and (separation< 360-_MaxAngle) ) )
90  or ( ( (separation > _MaxAngleFar) and (separation < 180-_MaxAngleFar) ) or
91  ( (separation > 180+_MaxAngleFar) and (separation< 360-_MaxAngleFar) ) ) )
92  and (hits2 > _minHits)
93  and (len1 > _MinLen) ){
94  if (_verbose) { std::cout << "Separate! cluster 1 BIG" << std::endl << std::endl; }
95  return true;
96  }
97 
98  //now change direction of angle so that it points from cluster 2 (big) to cluster 1 (small)
99  angle += 180.;
100  angle = (int)(angle) % 360;
101 
102  separation = abs(angle-angle2);
103  //separation *= (400./startseparation); //distance^2 of 400 cm^2 taken as "standard"
104  if (_debug){
105  std::cout << "Angle S2--S1: " << angle << std::endl;
106  std::cout << "Angle2--S1: " << separation << std::endl;
107  }
108  if ( ( ( ( (separation > _MaxAngle) and (separation < 180-_MaxAngle) ) or
109  ( (separation > 180+_MaxAngle) and (separation< 360-_MaxAngle) ) )
110  or ( ( (separation > _MaxAngleFar) and (separation < 180-_MaxAngleFar) ) or
111  ( (separation > 180+_MaxAngleFar) and (separation< 360-_MaxAngleFar) ) ) )
112  and (hits1 > _minHits)
113  and (len2 > _MinLen) ){
114  if (_verbose) { std::cout << "Separate! cluster 2 BIG" << std::endl << std::endl; }
115  return true;
116  }
117 
118  return false;
119  }
T abs(T value)
const cluster_params & GetParams() const
double t
Definition: PxUtils.h:11
const std::vector< util::PxHit > & GetHitVector() const
return match has_match and(match.match_pdg==11 or match.match_pdg==-11)
util::PxPoint start_point
start point
Definition: ClusterParams.h:23
double angle_2d
Angle of axis in wire/hit view.
Definition: ClusterParams.h:39
double w
Definition: PxUtils.h:10
void SetMaxAngleFar(float angle)
Set Max Angle Separation for separation for far away clusters.
finds tracks best matching by angle
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is &gt;= kPer...
Definition: CMAlgoBase.h:102
BEGIN_PROLOG could also be cout
virtual void cmtool::CBAlgoOutOfConeSeparate::Report ( )
inlinevirtual

Function to report what's going on per merging.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 65 of file CBAlgoOutOfConeSeparate.h.

65 {}
virtual void cmtool::CBAlgoOutOfConeSeparate::Reset ( )
inlinevirtual

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

Reimplemented from cmtool::CMAlgoBase.

Definition at line 62 of file CBAlgoOutOfConeSeparate.h.

62 {}
void cmtool::CBAlgoOutOfConeSeparate::SetDebug ( bool  on)
inline

Set Debug Mode on or off.

Definition at line 44 of file CBAlgoOutOfConeSeparate.h.

void cmtool::CBAlgoOutOfConeSeparate::SetMaxAngleFar ( float  angle)
inline

Set Max Angle Separation for separation for far away clusters.

Definition at line 50 of file CBAlgoOutOfConeSeparate.h.

50 { _MaxAngleFar = angle; }
finds tracks best matching by angle
void cmtool::CBAlgoOutOfConeSeparate::SetMaxAngleSep ( float  angle)
inline

Set Max Angle Separation for separation.

Definition at line 47 of file CBAlgoOutOfConeSeparate.h.

47 { _MaxAngle = angle; }
finds tracks best matching by angle
void cmtool::CBAlgoOutOfConeSeparate::SetMinHits ( size_t  n)
inline

SetMinimum number of hits for small cluster.

Definition at line 59 of file CBAlgoOutOfConeSeparate.h.

void cmtool::CBAlgoOutOfConeSeparate::SetMinLength ( float  len)
inline

Set Minimum length for "big" cluster.

Definition at line 56 of file CBAlgoOutOfConeSeparate.h.

void cmtool::CBAlgoOutOfConeSeparate::SetStartAngleFalloff ( float  d)
inline

Set Distance at which cone-acceptance angle starts falling off as 1/distance. Value should be distance^2 in cm^2.

Definition at line 53 of file CBAlgoOutOfConeSeparate.h.

Member Data Documentation

bool cmtool::CBAlgoOutOfConeSeparate::_debug
protected

Definition at line 69 of file CBAlgoOutOfConeSeparate.h.

float cmtool::CBAlgoOutOfConeSeparate::_FallOff
protected

Definition at line 73 of file CBAlgoOutOfConeSeparate.h.

float cmtool::CBAlgoOutOfConeSeparate::_MaxAngle
protected

Definition at line 70 of file CBAlgoOutOfConeSeparate.h.

float cmtool::CBAlgoOutOfConeSeparate::_MaxAngleFar
protected

Definition at line 71 of file CBAlgoOutOfConeSeparate.h.

size_t cmtool::CBAlgoOutOfConeSeparate::_minHits
protected

Definition at line 74 of file CBAlgoOutOfConeSeparate.h.

float cmtool::CBAlgoOutOfConeSeparate::_MinLen
protected

Definition at line 72 of file CBAlgoOutOfConeSeparate.h.


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