LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
cmtool::CBAlgoStartTrack Class Reference

#include "CBAlgoStartTrack.h"

Inheritance diagram for cmtool::CBAlgoStartTrack:
cmtool::CBoolAlgoBase cmtool::CMAlgoBase

Public Member Functions

 CBAlgoStartTrack ()
 Default constructor. More...
 
virtual ~CBAlgoStartTrack ()
 Default destructor. More...
 
virtual bool Bool (const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
 
virtual void Report ()
 
virtual void Reset ()
 Function to reset the algorithm instance ... maybe implemented via child class. More...
 
bool IsStartTrack (const ::cluster::ClusterParamsAlg &cluster)
 
bool IsOverlappingBlob (const ::cluster::ClusterParamsAlg &cluster)
 
void SetMinWidth (double value)
 
void SetMinOpeningAngle (double value)
 
void SetMinEP (double value)
 
void SetMinHits (size_t value)
 
void SetDebug (bool flag)
 
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

size_t _min_hits
 
double _min_width
 
double _min_opening_angle
 
double _min_EP
 
bool _debug
 
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

User implementation for CBoolAlgoBase class doxygen documentation!

Definition at line 28 of file CBAlgoStartTrack.h.

Constructor & Destructor Documentation

cmtool::CBAlgoStartTrack::CBAlgoStartTrack ( )

Default constructor.

Definition at line 6 of file CBAlgoStartTrack.cxx.

References SetDebug(), SetMinEP(), SetMinHits(), SetMinOpeningAngle(), and SetMinWidth().

6  : CBoolAlgoBase()
7  //-------------------------------------------------------
8  {
9 
10  SetMinHits(10);
11  SetMinWidth(1.00000);
12  SetMinOpeningAngle(0.15000);
13  SetMinEP(0.99000);
14  SetDebug(false);
15  }
void SetMinWidth(double value)
CBoolAlgoBase()
Default constructor.
Definition: CBoolAlgoBase.h:31
void SetMinOpeningAngle(double value)
void SetMinEP(double value)
void SetMinHits(size_t value)
virtual cmtool::CBAlgoStartTrack::~CBAlgoStartTrack ( )
inlinevirtual

Default destructor.

Definition at line 35 of file CBAlgoStartTrack.h.

References Bool(), IsOverlappingBlob(), IsStartTrack(), Report(), and Reset().

35 {};

Member Function Documentation

bool cmtool::CBAlgoStartTrack::Bool ( const ::cluster::ClusterParamsAlg cluster1,
const ::cluster::ClusterParamsAlg cluster2 
)
virtual

Optional function: called at the beginning of 1st iteration. This is called per event. Optional function: called at the end of event ... after the last merging iteration is over. 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. Optional function: called at the end of each iteration over all pairs of clusters. Core function: given the CPAN input, return whether a cluster should be merged or not.

Reimplemented from cmtool::CBoolAlgoBase.

Definition at line 51 of file CBAlgoStartTrack.cxx.

References _debug, _min_hits, IsOverlappingBlob(), and IsStartTrack().

Referenced by ~CBAlgoStartTrack().

54  {
55 
56  if (cluster1.GetHitVector().size() < _min_hits || cluster2.GetHitVector().size() < _min_hits)
57  return false;
58 
59  bool FirstTrackSecondBlob = false;
60  bool SecondTrackFirstBlob = false;
61 
62  if (IsStartTrack(cluster1) && IsOverlappingBlob(cluster2)) FirstTrackSecondBlob = true;
63  if (IsStartTrack(cluster2) && IsOverlappingBlob(cluster1)) SecondTrackFirstBlob = true;
64 
65  if (_debug) {
66  if (FirstTrackSecondBlob) {
67  std::cout << "*********************************************" << std::endl;
68  std::cout << "First track second blob! First has params:" << std::endl;
69  std::cout << "Angle 2D = " << cluster1.GetParams().angle_2d << std::endl;
70  std::cout << "Opening Angle = " << cluster1.GetParams().opening_angle << std::endl;
71  std::cout << "Sum charge = " << cluster1.GetParams().sum_charge << std::endl;
72  std::cout << "Length = " << cluster1.GetParams().length << std::endl;
73  std::cout << "Width = " << cluster1.GetParams().width << std::endl;
74  std::cout << "N_Hits = " << cluster1.GetHitVector().size() << std::endl;
75  std::cout << "eigenvalue_principal = " << cluster1.GetParams().eigenvalue_principal
76  << std::endl;
77  std::cout << "Second has params:" << std::endl;
78  std::cout << "Angle 2D = " << cluster2.GetParams().angle_2d << std::endl;
79  std::cout << "Opening Angle = " << cluster2.GetParams().opening_angle << std::endl;
80  std::cout << "Sum charge = " << cluster2.GetParams().sum_charge << std::endl;
81  std::cout << "Length = " << cluster2.GetParams().length << std::endl;
82  std::cout << "Width = " << cluster2.GetParams().width << std::endl;
83  std::cout << "N_Hits = " << cluster2.GetHitVector().size() << std::endl;
84  std::cout << "eigenvalue_principal = " << cluster2.GetParams().eigenvalue_principal
85  << std::endl;
86  }
87  }
88 
89  //if cluster1 looks like a track and cluster2 looks like a blob
90  if (FirstTrackSecondBlob) {
91  std::pair<float, float> trackEndPoint =
92  std::pair<float, float>(cluster1.GetParams().end_point.w, cluster1.GetParams().end_point.t);
93 
94  //if the tracklike cluster's endpoint is inside polygon of blob
95  if (cluster2.GetParams().PolyObject.PointInside(trackEndPoint))
96  return true;
97  else
98  return false;
99  }
100 
101  //if cluster2 looks like a track and cluster1 looks like a blob
102  else if (SecondTrackFirstBlob) {
103  std::pair<float, float> trackEndPoint =
104  std::pair<float, float>(cluster2.GetParams().end_point.w, cluster2.GetParams().end_point.t);
105 
106  //if the tracklike cluster's endpoint is inside polygon of blob
107  if (cluster1.GetParams().PolyObject.PointInside(trackEndPoint))
108  return true;
109  else
110  return false;
111  }
112 
113  else
114  return false;
115 
116  //the reason for not just using (one track one blob) and
117  //polyoverlap for this is that
118  //this was merging BNB events where the track is clearly in a different
119  //direction than the blob
120 
121  //this will fail when the tracklike cluster is reconstructed backwards
122  //(looks like it's a track going into a blob, rather than exiting)
123  }
Polygon2D PolyObject
Polygon Object...see Polygon2D.hh.
Definition: ClusterParams.h:21
double eigenvalue_principal
the principal eigenvalue from PCA
Definition: ClusterParams.h:46
const cluster_params & GetParams() const
double sum_charge
Sum charge of hits in ADC.
Definition: ClusterParams.h:26
double t
Definition: PxUtils.h:10
const std::vector< util::PxHit > & GetHitVector() const
double angle_2d
Angle of axis in wire/hit view.
Definition: ClusterParams.h:39
double w
Definition: PxUtils.h:9
bool IsStartTrack(const ::cluster::ClusterParamsAlg &cluster)
util::PxPoint end_point
end point
Definition: ClusterParams.h:24
bool PointInside(const std::pair< float, float > &point) const
Definition: Polygon2D.cxx:271
double opening_angle
Width of angular distubtion wrt vertx.
Definition: ClusterParams.h:40
bool IsOverlappingBlob(const ::cluster::ClusterParamsAlg &cluster)
virtual void cmtool::CMAlgoBase::EventBegin ( const std::vector< cluster::ClusterParamsAlg > &  )
inlinevirtualinherited

Optional function: called at the beginning of 1st iteration. This is called per event.

Reimplemented in cmtool::CPAlgoArray, cmtool::CBAlgoArray, and cmtool::CBAlgoPolyShortestDist.

Definition at line 45 of file CMAlgoBase.h.

Referenced by cmtool::CMergeManager::EventBegin().

45 {}
virtual void cmtool::CMAlgoBase::EventEnd ( )
inlinevirtualinherited

Optional function: called at the end of event ... after the last merging iteration is over.

Reimplemented in cmtool::CPAlgoArray, and cmtool::CBAlgoArray.

Definition at line 50 of file CMAlgoBase.h.

Referenced by cmtool::CMatchManager::EventEnd(), and cmtool::CMergeManager::EventEnd().

50 {}
bool cmtool::CBAlgoStartTrack::IsOverlappingBlob ( const ::cluster::ClusterParamsAlg cluster)

Definition at line 138 of file CBAlgoStartTrack.cxx.

References _min_EP, _min_opening_angle, and _min_width.

Referenced by Bool(), and ~CBAlgoStartTrack().

139  {
140  if (cluster.GetParams().width > _min_width &&
143  return true;
144  else
145  return false;
146  }
double eigenvalue_principal
the principal eigenvalue from PCA
Definition: ClusterParams.h:46
const cluster_params & GetParams() const
double opening_angle
Width of angular distubtion wrt vertx.
Definition: ClusterParams.h:40
bool cmtool::CBAlgoStartTrack::IsStartTrack ( const ::cluster::ClusterParamsAlg cluster)

Definition at line 130 of file CBAlgoStartTrack.cxx.

References _min_EP.

Referenced by Bool(), and ~CBAlgoStartTrack().

131  {
132  if (cluster.GetParams().eigenvalue_principal > _min_EP)
133  return true;
134  else
135  return false;
136  }
double eigenvalue_principal
the principal eigenvalue from PCA
Definition: ClusterParams.h:46
const cluster_params & GetParams() const
virtual void cmtool::CMAlgoBase::IterationBegin ( const std::vector< cluster::ClusterParamsAlg > &  )
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::CPAlgoArray, and cmtool::CBAlgoArray.

Definition at line 57 of file CMAlgoBase.h.

Referenced by cmtool::CMatchManager::EventBegin(), cmtool::CMatchManager::IterationBegin(), and cmtool::CMergeManager::IterationBegin().

57 {}
virtual void cmtool::CMAlgoBase::IterationEnd ( )
inlinevirtualinherited

Optional function: called at the end of each iteration over all pairs of clusters.

Reimplemented in cmtool::CPAlgoArray, and cmtool::CBAlgoArray.

Definition at line 62 of file CMAlgoBase.h.

Referenced by cmtool::CMatchManager::IterationEnd(), and cmtool::CMergeManager::IterationEnd().

62 {}
void cmtool::CBAlgoStartTrack::Report ( )
virtual

Optional function: called after each Merge() function call by CMergeManager IFF CMergeManager is run with verbosity level kPerMerging. Maybe useful for debugging.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 126 of file CBAlgoStartTrack.cxx.

Referenced by ~CBAlgoStartTrack().

128  {}
void cmtool::CBAlgoStartTrack::Reset ( )
virtual

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

Reimplemented from cmtool::CMAlgoBase.

Definition at line 18 of file CBAlgoStartTrack.cxx.

Referenced by ~CBAlgoStartTrack().

20  {}
void cmtool::CMAlgoBase::SetAnaFile ( TFile *  fout)
inlineinherited

Setter function for an output plot TFile pointer.

Definition at line 72 of file CMAlgoBase.h.

References cmtool::CMAlgoBase::_fout.

Referenced by cmtool::CMergeManager::EventBegin().

72 { _fout = fout; }
TFile * _fout
TFile pointer to an output file.
Definition: CMAlgoBase.h:79
void cmtool::CBAlgoStartTrack::SetDebug ( bool  flag)
inline

Definition at line 87 of file CBAlgoStartTrack.h.

References _debug.

Referenced by CBAlgoStartTrack().

87 { _debug = flag; }
void cmtool::CBAlgoStartTrack::SetMinEP ( double  value)
inline

Definition at line 83 of file CBAlgoStartTrack.h.

References _min_EP, and value.

Referenced by CBAlgoStartTrack().

83 { _min_EP = value; }
double value
Definition: spectrum.C:18
void cmtool::CBAlgoStartTrack::SetMinHits ( size_t  value)
inline

Definition at line 85 of file CBAlgoStartTrack.h.

References _min_hits, and value.

Referenced by CBAlgoStartTrack().

85 { _min_hits = value; }
double value
Definition: spectrum.C:18
void cmtool::CBAlgoStartTrack::SetMinOpeningAngle ( double  value)
inline

Definition at line 81 of file CBAlgoStartTrack.h.

References _min_opening_angle, and value.

Referenced by CBAlgoStartTrack().

double value
Definition: spectrum.C:18
void cmtool::CBAlgoStartTrack::SetMinWidth ( double  value)
inline

Definition at line 79 of file CBAlgoStartTrack.h.

References _min_width, and value.

Referenced by CBAlgoStartTrack().

79 { _min_width = value; }
double value
Definition: spectrum.C:18
virtual void cmtool::CMAlgoBase::SetVerbose ( bool  doit = true)
inlinevirtualinherited

Setter function for verbosity.

Reimplemented in cmtool::CBAlgoArray, and cmtool::CFAlgoTimeOverlap.

Definition at line 75 of file CMAlgoBase.h.

References cmtool::CMAlgoBase::_verbose.

Referenced by cmtool::CMatchManager::EventBegin(), and cmtool::CMergeManager::EventBegin().

75 { _verbose = doit; }
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is >= kPer...
Definition: CMAlgoBase.h:82

Member Data Documentation

bool cmtool::CBAlgoStartTrack::_debug
protected

Definition at line 92 of file CBAlgoStartTrack.h.

Referenced by Bool(), and SetDebug().

TFile* cmtool::CMAlgoBase::_fout
protectedinherited

TFile pointer to an output file.

Definition at line 79 of file CMAlgoBase.h.

Referenced by cmtool::CMAlgoBase::CMAlgoBase(), and cmtool::CMAlgoBase::SetAnaFile().

double cmtool::CBAlgoStartTrack::_min_EP
protected

Definition at line 91 of file CBAlgoStartTrack.h.

Referenced by IsOverlappingBlob(), IsStartTrack(), and SetMinEP().

size_t cmtool::CBAlgoStartTrack::_min_hits
protected

Definition at line 90 of file CBAlgoStartTrack.h.

Referenced by Bool(), and SetMinHits().

double cmtool::CBAlgoStartTrack::_min_opening_angle
protected

Definition at line 91 of file CBAlgoStartTrack.h.

Referenced by IsOverlappingBlob(), and SetMinOpeningAngle().

double cmtool::CBAlgoStartTrack::_min_width
protected

Definition at line 91 of file CBAlgoStartTrack.h.

Referenced by IsOverlappingBlob(), and SetMinWidth().


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