Public Member Functions | Protected Attributes | List of all members
cmtool::CBAlgoTrackSeparate Class Reference

#include <CBAlgoTrackSeparate.h>

Inheritance diagram for cmtool::CBAlgoTrackSeparate:
cmtool::CBoolAlgoBase cmtool::CMAlgoBase

Public Member Functions

 CBAlgoTrackSeparate ()
 Default constructor. More...
 
virtual ~CBAlgoTrackSeparate ()
 Default destructor. More...
 
virtual bool Bool (const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
 
void SetVerbose (bool on)
 Setter function for verbosity. More...
 
void SetDebug (bool on)
 
void SetMinNumHits (size_t n)
 
void SetMinAngleDiff (float anglesep)
 
void SetMaxOpeningAngle (float maxangle)
 
void SetMinLength (float minlength)
 
void SetMinPolyHitDensity (float mindensity)
 
void SetMaxWidth (float maxwidth)
 
void SetUseEP (bool flag)
 
void SetEPCutoff (float epcut)
 
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 ()
 Default constructor. More...
 
virtual ~CMAlgoBase ()
 Default destructor. 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...
 

Protected Attributes

bool _verbose
 
bool _debug
 
bool _use_EP
 
float _ep_cut
 
size_t _MinNumHits
 
float _MinAngleDiff
 
float _MaxOpeningAngle
 
float _MinLength
 
float _MinDensity
 
float _MaxWidth
 
double _wire_2_cm
 
double _time_2_cm
 
- 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 24 of file CBAlgoTrackSeparate.h.

Constructor & Destructor Documentation

cmtool::CBAlgoTrackSeparate::CBAlgoTrackSeparate ( )

Default constructor.

Definition at line 8 of file CBAlgoTrackSeparate.cxx.

8  : CBoolAlgoBase()
9  //----------------------------------------
10  {
11 
12  //this just sets default values
13  SetVerbose(true);
14  SetDebug(true);
15 
16  //1e9 is huge; everything will be merged
17  SetMinNumHits(30);
18  SetMinAngleDiff(15.); //in degrees
19  SetMaxOpeningAngle(12.0); //in deg (parameter in rad!!)
20  SetMinLength(10.);
22  SetMaxWidth(10.);
23 
24 
25  //NOTE! Using this flag means all of the other crap
26  //(minNumHits, anglediff, openingangle, blah blah)
27  //is totally irrelevant. if we stick with this flag as the algo,
28  //we probably want to delete all of the old method
29  SetUseEP(true);
30  SetEPCutoff(0.99000);
32  _wire_2_cm = geou.WireToCm();
33  _time_2_cm = geou.TimeToCm();
34 
35  }
Double_t TimeToCm() const
Double_t WireToCm() const
void SetMaxWidth(float maxwidth)
CBoolAlgoBase()
Default constructor.
Definition: CBoolAlgoBase.h:32
void SetVerbose(bool on)
Setter function for verbosity.
void SetMinPolyHitDensity(float mindensity)
void SetMaxOpeningAngle(float maxangle)
void SetMinLength(float minlength)
void SetMinAngleDiff(float anglesep)
virtual cmtool::CBAlgoTrackSeparate::~CBAlgoTrackSeparate ( )
inlinevirtual

Default destructor.

Definition at line 32 of file CBAlgoTrackSeparate.h.

32 {};

Member Function Documentation

bool cmtool::CBAlgoTrackSeparate::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 38 of file CBAlgoTrackSeparate.cxx.

41  {
42  //if you are using EP method for this algo:
43  if(_use_EP){
44  if(cluster1.GetParams().eigenvalue_principal > _ep_cut &&
45  cluster2.GetParams().eigenvalue_principal > _ep_cut)
46  return true;
47  }
48  //if you are using the original method for this algo:
49  else{
50 
51  //two clusters are considered un-mergable if:
52  //1) both have more than _MinNumHits
53  //2) opening angle for both < _MAxOpeningAngle
54  //3) diff. in direction of both < _MinAngleDiff
55 
56  size_t N_Hits1 = cluster1.GetHitVector().size();
57  size_t N_Hits2 = cluster2.GetHitVector().size();
58  auto start_point1 = cluster1.GetParams().start_point;
59  auto start_point2 = cluster2.GetParams().start_point;
60  double angle_2d1 = cluster1.GetParams().angle_2d;
61  double angle_2d2 = cluster2.GetParams().angle_2d;
62  double opening_angle1 = cluster1.GetParams().opening_angle;
63  double opening_angle2 = cluster2.GetParams().opening_angle;
64  Polygon2D PolyObject1 = cluster1.GetParams().PolyObject;
65  Polygon2D PolyObject2 = cluster2.GetParams().PolyObject;
66  double length1 = cluster1.GetParams().length;
67  double length2 = cluster2.GetParams().length;
68  double width1 = cluster1.GetParams().width;
69  double width2 = cluster2.GetParams().width;
70 
71  //first filter out low hits clusters
72  if ( (N_Hits1 > _MinNumHits) and
73  (N_Hits2 > _MinNumHits) ) {
74  if (_debug) {
75  std::cout << "Cluster1 Num Hits: " << N_Hits1 << std::endl;
76  std::cout << "\t Start: (" << start_point1.w << " " << start_point1.t << " )" << std::endl;
77  std::cout << "\t Opening ANgle " << opening_angle1*(360/(2*3.14)) << std::endl;
78  std::cout << "\t Angle2D: " << angle_2d1 << std::endl;
79  std::cout << "\t Length: " << length1 << std::endl;
80  std::cout << "\t Width: " << width1 << std::endl;
81  std::cout << "Cluster2 Num Hits: " << N_Hits2 << std::endl;
82  std::cout << "\t Start: (" << start_point2.w << " " << start_point2.t << " )" << std::endl;
83  std::cout << "\t Opening ANgle " << opening_angle2*(360/(2*3.14)) << std::endl;
84  std::cout << "\t Angle2D: " << angle_2d2 << std::endl;
85  std::cout << "\t Length: " << length2 << std::endl;
86  std::cout << "\t Width: " << width2 << std::endl;
87  }
88  if ( (N_Hits1 > _MinNumHits) and
89  (N_Hits2 > _MinNumHits) and
90  ( abs(angle_2d1 - angle_2d2) > _MinAngleDiff ) and
91  //( PolyObject1.Area()/N_Hits1 > _MinDensity ) and
92  //( PolyObject2.Area()/N_Hits2 > _MinDensity ) and
93  (opening_angle1 < _MaxOpeningAngle/(360/(2*3.14))) and
94  (opening_angle2 < _MaxOpeningAngle/(360/(2*3.14))) and
95  (width1 < _MaxWidth) and
96  (width2 < _MaxWidth) and
97  (length1 > _MinLength) and
98  (length2 > _MinLength) ){
99  if (_verbose) { std::cout << "*****************************************Separate with TrackSeparate!" << std::endl; }
100  return true;
101  }
102  }
103  }
104 
105  return false;
106 
107  }
T abs(T value)
QTextStream & endl(QTextStream &s)
void cmtool::CBAlgoTrackSeparate::Report ( )
virtual

Function to report what's going on per merging.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 110 of file CBAlgoTrackSeparate.cxx.

112  {
113  }
virtual void cmtool::CBAlgoTrackSeparate::Reset ( void  )
inlinevirtual

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

Reimplemented from cmtool::CMAlgoBase.

Definition at line 62 of file CBAlgoTrackSeparate.h.

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

Definition at line 43 of file CBAlgoTrackSeparate.h.

void cmtool::CBAlgoTrackSeparate::SetEPCutoff ( float  epcut)
inline

Definition at line 59 of file CBAlgoTrackSeparate.h.

void cmtool::CBAlgoTrackSeparate::SetMaxOpeningAngle ( float  maxangle)
inline

Definition at line 49 of file CBAlgoTrackSeparate.h.

void cmtool::CBAlgoTrackSeparate::SetMaxWidth ( float  maxwidth)
inline

Definition at line 55 of file CBAlgoTrackSeparate.h.

55 { _MaxWidth = maxwidth; }
void cmtool::CBAlgoTrackSeparate::SetMinAngleDiff ( float  anglesep)
inline

Definition at line 47 of file CBAlgoTrackSeparate.h.

47 { _MinAngleDiff = anglesep; }
void cmtool::CBAlgoTrackSeparate::SetMinLength ( float  minlength)
inline

Definition at line 51 of file CBAlgoTrackSeparate.h.

51 { _MinLength = minlength; }
void cmtool::CBAlgoTrackSeparate::SetMinNumHits ( size_t  n)
inline

Definition at line 45 of file CBAlgoTrackSeparate.h.

45 { _MinNumHits = n; }
std::void_t< T > n
void cmtool::CBAlgoTrackSeparate::SetMinPolyHitDensity ( float  mindensity)
inline

Definition at line 53 of file CBAlgoTrackSeparate.h.

53 { _MinDensity = mindensity; }
void cmtool::CBAlgoTrackSeparate::SetUseEP ( bool  flag)
inline

Definition at line 57 of file CBAlgoTrackSeparate.h.

void cmtool::CBAlgoTrackSeparate::SetVerbose ( bool  doit)
inlinevirtual

Setter function for verbosity.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 41 of file CBAlgoTrackSeparate.h.

Member Data Documentation

bool cmtool::CBAlgoTrackSeparate::_debug
protected

Definition at line 70 of file CBAlgoTrackSeparate.h.

float cmtool::CBAlgoTrackSeparate::_ep_cut
protected

Definition at line 72 of file CBAlgoTrackSeparate.h.

float cmtool::CBAlgoTrackSeparate::_MaxOpeningAngle
protected

Definition at line 75 of file CBAlgoTrackSeparate.h.

float cmtool::CBAlgoTrackSeparate::_MaxWidth
protected

Definition at line 78 of file CBAlgoTrackSeparate.h.

float cmtool::CBAlgoTrackSeparate::_MinAngleDiff
protected

Definition at line 74 of file CBAlgoTrackSeparate.h.

float cmtool::CBAlgoTrackSeparate::_MinDensity
protected

Definition at line 77 of file CBAlgoTrackSeparate.h.

float cmtool::CBAlgoTrackSeparate::_MinLength
protected

Definition at line 76 of file CBAlgoTrackSeparate.h.

size_t cmtool::CBAlgoTrackSeparate::_MinNumHits
protected

Definition at line 73 of file CBAlgoTrackSeparate.h.

double cmtool::CBAlgoTrackSeparate::_time_2_cm
protected

Definition at line 80 of file CBAlgoTrackSeparate.h.

bool cmtool::CBAlgoTrackSeparate::_use_EP
protected

Definition at line 71 of file CBAlgoTrackSeparate.h.

bool cmtool::CBAlgoTrackSeparate::_verbose
protected

Definition at line 69 of file CBAlgoTrackSeparate.h.

double cmtool::CBAlgoTrackSeparate::_wire_2_cm
protected

Definition at line 79 of file CBAlgoTrackSeparate.h.


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