LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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...
 
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
 
TFile * _fout
 TFile pointer to an output file. More...
 

Detailed Description

Definition at line 25 of file CBAlgoTrackSeparate.h.

Constructor & Destructor Documentation

cmtool::CBAlgoTrackSeparate::CBAlgoTrackSeparate ( )

Default constructor.

Definition at line 9 of file CBAlgoTrackSeparate.cxx.

References _time_2_cm, _wire_2_cm, SetDebug(), SetEPCutoff(), SetMaxOpeningAngle(), SetMaxWidth(), SetMinAngleDiff(), SetMinLength(), SetMinNumHits(), SetMinPolyHitDensity(), SetUseEP(), SetVerbose(), util::GeometryUtilities::TimeToCm(), and util::GeometryUtilities::WireToCm().

9  : CBoolAlgoBase()
10  //----------------------------------------
11  {
12 
13  //this just sets default values
14  SetVerbose(true);
15  SetDebug(true);
16 
17  //1e9 is huge; everything will be merged
18  SetMinNumHits(30);
19  SetMinAngleDiff(15.); //in degrees
20  SetMaxOpeningAngle(12.0); //in deg (parameter in rad!!)
21  SetMinLength(10.);
23  SetMaxWidth(10.);
24 
25 
26  //NOTE! Using this flag means all of the other crap
27  //(minNumHits, anglediff, openingangle, blah blah)
28  //is totally irrelevant. if we stick with this flag as the algo,
29  //we probably want to delete all of the old method
30  SetUseEP(true);
31  SetEPCutoff(0.99000);
33  _wire_2_cm = geou.WireToCm();
34  _time_2_cm = geou.TimeToCm();
35 
36  }
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 33 of file CBAlgoTrackSeparate.h.

References Bool().

33 {};

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 39 of file CBAlgoTrackSeparate.cxx.

References _debug, _ep_cut, _MaxOpeningAngle, _MaxWidth, _MinAngleDiff, _MinLength, _MinNumHits, _use_EP, and _verbose.

Referenced by ~CBAlgoTrackSeparate().

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

Function to report what's going on per merging.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 111 of file CBAlgoTrackSeparate.cxx.

Referenced by Reset().

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

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

Reimplemented from cmtool::CMAlgoBase.

Definition at line 63 of file CBAlgoTrackSeparate.h.

References Report().

63 {}
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::CBAlgoTrackSeparate::SetDebug ( bool  on)
inline
void cmtool::CBAlgoTrackSeparate::SetEPCutoff ( float  epcut)
inline

Definition at line 60 of file CBAlgoTrackSeparate.h.

References _ep_cut.

Referenced by CBAlgoTrackSeparate().

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

Definition at line 56 of file CBAlgoTrackSeparate.h.

References _MaxWidth.

Referenced by CBAlgoTrackSeparate().

56 { _MaxWidth = maxwidth; }
void cmtool::CBAlgoTrackSeparate::SetMinAngleDiff ( float  anglesep)
inline
void cmtool::CBAlgoTrackSeparate::SetMinLength ( float  minlength)
inline
void cmtool::CBAlgoTrackSeparate::SetMinNumHits ( size_t  n)
inline

Definition at line 46 of file CBAlgoTrackSeparate.h.

References _MinNumHits, and n.

Referenced by CBAlgoTrackSeparate(), and cluster::SimpleClusterMerger::SimpleClusterMerger().

46 { _MinNumHits = n; }
Char_t n[5]
void cmtool::CBAlgoTrackSeparate::SetMinPolyHitDensity ( float  mindensity)
inline

Definition at line 54 of file CBAlgoTrackSeparate.h.

References _MinDensity.

Referenced by CBAlgoTrackSeparate().

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

Definition at line 58 of file CBAlgoTrackSeparate.h.

References _use_EP.

Referenced by CBAlgoTrackSeparate().

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

Setter function for verbosity.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 42 of file CBAlgoTrackSeparate.h.

References _verbose.

Referenced by CBAlgoTrackSeparate(), and cluster::SimpleClusterMerger::SimpleClusterMerger().

Member Data Documentation

bool cmtool::CBAlgoTrackSeparate::_debug
protected

Definition at line 71 of file CBAlgoTrackSeparate.h.

Referenced by Bool(), and SetDebug().

float cmtool::CBAlgoTrackSeparate::_ep_cut
protected

Definition at line 73 of file CBAlgoTrackSeparate.h.

Referenced by Bool(), and SetEPCutoff().

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::CBAlgoTrackSeparate::_MaxOpeningAngle
protected

Definition at line 76 of file CBAlgoTrackSeparate.h.

Referenced by Bool(), and SetMaxOpeningAngle().

float cmtool::CBAlgoTrackSeparate::_MaxWidth
protected

Definition at line 79 of file CBAlgoTrackSeparate.h.

Referenced by Bool(), and SetMaxWidth().

float cmtool::CBAlgoTrackSeparate::_MinAngleDiff
protected

Definition at line 75 of file CBAlgoTrackSeparate.h.

Referenced by Bool(), and SetMinAngleDiff().

float cmtool::CBAlgoTrackSeparate::_MinDensity
protected

Definition at line 78 of file CBAlgoTrackSeparate.h.

Referenced by SetMinPolyHitDensity().

float cmtool::CBAlgoTrackSeparate::_MinLength
protected

Definition at line 77 of file CBAlgoTrackSeparate.h.

Referenced by Bool(), and SetMinLength().

size_t cmtool::CBAlgoTrackSeparate::_MinNumHits
protected

Definition at line 74 of file CBAlgoTrackSeparate.h.

Referenced by Bool(), and SetMinNumHits().

double cmtool::CBAlgoTrackSeparate::_time_2_cm
protected

Definition at line 81 of file CBAlgoTrackSeparate.h.

Referenced by CBAlgoTrackSeparate().

bool cmtool::CBAlgoTrackSeparate::_use_EP
protected

Definition at line 72 of file CBAlgoTrackSeparate.h.

Referenced by Bool(), and SetUseEP().

bool cmtool::CBAlgoTrackSeparate::_verbose
protected

Definition at line 70 of file CBAlgoTrackSeparate.h.

Referenced by Bool(), and SetVerbose().

double cmtool::CBAlgoTrackSeparate::_wire_2_cm
protected

Definition at line 80 of file CBAlgoTrackSeparate.h.

Referenced by CBAlgoTrackSeparate().


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