LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 > &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...
 
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 9 of file CBAlgoStartTrack.cxx.

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

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

Default destructor.

Definition at line 36 of file CBAlgoStartTrack.h.

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

36 {};

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 57 of file CBAlgoStartTrack.cxx.

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

Referenced by ~CBAlgoStartTrack().

60  {
61 
62  if(cluster1.GetHitVector().size() < _min_hits ||
63  cluster2.GetHitVector().size() < _min_hits )
64  return false;
65 
66  bool FirstTrackSecondBlob = false;
67  bool SecondTrackFirstBlob = false;
68 
69  if(IsStartTrack(cluster1) && IsOverlappingBlob(cluster2))
70  FirstTrackSecondBlob = true;
71  if(IsStartTrack(cluster2) && IsOverlappingBlob(cluster1))
72  SecondTrackFirstBlob = true;
73 
74  if(_debug){
75  if(FirstTrackSecondBlob){
76  std::cout<<"*********************************************"<<std::endl;
77  std::cout<<"First track second blob! First has params:"<<std::endl;
78  std::cout<<"Angle 2D = "<<cluster1.GetParams().angle_2d<<std::endl;
79  std::cout<<"Opening Angle = "<<cluster1.GetParams().opening_angle<<std::endl;
80  std::cout<<"Sum charge = "<<cluster1.GetParams().sum_charge<<std::endl;
81  std::cout<<"Length = "<<cluster1.GetParams().length<<std::endl;
82  std::cout<<"Width = "<<cluster1.GetParams().width<<std::endl;
83  std::cout<<"N_Hits = "<<cluster1.GetHitVector().size()<<std::endl;
84  std::cout<<"eigenvalue_principal = "<<cluster1.GetParams().eigenvalue_principal<<std::endl;
85  std::cout<<"Second has params:"<<std::endl;
86  std::cout<<"Angle 2D = "<<cluster2.GetParams().angle_2d<<std::endl;
87  std::cout<<"Opening Angle = "<<cluster2.GetParams().opening_angle<<std::endl;
88  std::cout<<"Sum charge = "<<cluster2.GetParams().sum_charge<<std::endl;
89  std::cout<<"Length = "<<cluster2.GetParams().length<<std::endl;
90  std::cout<<"Width = "<<cluster2.GetParams().width<<std::endl;
91  std::cout<<"N_Hits = "<<cluster2.GetHitVector().size()<<std::endl;
92  std::cout<<"eigenvalue_principal = "<<cluster2.GetParams().eigenvalue_principal<<std::endl;
93 
94  }
95 
96 
97  }
98 
99  //if cluster1 looks like a track and cluster2 looks like a blob
100  if (FirstTrackSecondBlob)
101  {
102  std::pair<float,float> trackEndPoint =
103  std::pair<float,float>( cluster1.GetParams().end_point.w, cluster1.GetParams().end_point.t );
104 
105  //if the tracklike cluster's endpoint is inside polygon of blob
106  if(cluster2.GetParams().PolyObject.PointInside(trackEndPoint))
107  return true;
108  else
109  return false;
110  }
111 
112  //if cluster2 looks like a track and cluster1 looks like a blob
113  else if (SecondTrackFirstBlob)
114  {
115  std::pair<float,float> trackEndPoint =
116  std::pair<float,float>( cluster2.GetParams().end_point.w, cluster2.GetParams().end_point.t );
117 
118  //if the tracklike cluster's endpoint is inside polygon of blob
119  if(cluster1.GetParams().PolyObject.PointInside(trackEndPoint))
120  return true;
121  else
122  return false;
123  }
124 
125  else
126  return false;
127 
128  //the reason for not just using (one track one blob) and
129  //polyoverlap for this is that
130  //this was merging BNB events where the track is clearly in a different
131  //direction than the blob
132 
133  //this will fail when the tracklike cluster is reconstructed backwards
134  //(looks like it's a track going into a blob, rather than exiting)
135 
136 
137  }
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
double sum_charge
Sum charge of hits in ADC.
Definition: ClusterParams.h:27
double t
Definition: PxUtils.h:11
const std::vector< util::PxHit > & GetHitVector() const
double angle_2d
Angle of axis in wire/hit view.
Definition: ClusterParams.h:40
double w
Definition: PxUtils.h:10
bool IsStartTrack(const ::cluster::ClusterParamsAlg &cluster)
util::PxPoint end_point
end point
Definition: ClusterParams.h:25
bool PointInside(const std::pair< float, float > &point) const
Definition: Polygon2D.cxx:249
double opening_angle
Width of angular distubtion wrt vertx.
Definition: ClusterParams.h:41
bool IsOverlappingBlob(const ::cluster::ClusterParamsAlg &cluster)
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;}
bool cmtool::CBAlgoStartTrack::IsOverlappingBlob ( const ::cluster::ClusterParamsAlg cluster)

Definition at line 156 of file CBAlgoStartTrack.cxx.

References _min_EP, _min_opening_angle, and _min_width.

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

157  {
158  if(cluster.GetParams().width > _min_width &&
161  return true;
162  else
163  return false;
164  }
double eigenvalue_principal
the principal eigenvalue from PCA
Definition: ClusterParams.h:47
const cluster_params & GetParams() const
double opening_angle
Width of angular distubtion wrt vertx.
Definition: ClusterParams.h:41
bool cmtool::CBAlgoStartTrack::IsStartTrack ( const ::cluster::ClusterParamsAlg cluster)

Definition at line 147 of file CBAlgoStartTrack.cxx.

References _min_EP.

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

148  {
149  if(cluster.GetParams().eigenvalue_principal > _min_EP)
150  return true;
151  else
152  return false;
153 
154  }
double eigenvalue_principal
the principal eigenvalue from PCA
Definition: ClusterParams.h:47
const cluster_params & GetParams() const
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::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 140 of file CBAlgoStartTrack.cxx.

Referenced by ~CBAlgoStartTrack().

142  {
143 
144  }
void cmtool::CBAlgoStartTrack::Reset ( )
virtual

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

Reimplemented from cmtool::CMAlgoBase.

Definition at line 22 of file CBAlgoStartTrack.cxx.

Referenced by ~CBAlgoStartTrack().

24  {
25 
26  }
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::CBAlgoStartTrack::SetDebug ( bool  flag)
inline

Definition at line 88 of file CBAlgoStartTrack.h.

References _debug.

Referenced by CBAlgoStartTrack().

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

Definition at line 84 of file CBAlgoStartTrack.h.

References _min_EP, and fhicl::detail::atom::value().

Referenced by CBAlgoStartTrack().

84 { _min_EP = value; }
std::string value(boost::any const &)
void cmtool::CBAlgoStartTrack::SetMinHits ( size_t  value)
inline

Definition at line 86 of file CBAlgoStartTrack.h.

References _min_hits, and fhicl::detail::atom::value().

Referenced by CBAlgoStartTrack().

86 { _min_hits = value; }
std::string value(boost::any const &)
void cmtool::CBAlgoStartTrack::SetMinOpeningAngle ( double  value)
inline

Definition at line 82 of file CBAlgoStartTrack.h.

References _min_opening_angle, and fhicl::detail::atom::value().

Referenced by CBAlgoStartTrack().

std::string value(boost::any const &)
void cmtool::CBAlgoStartTrack::SetMinWidth ( double  value)
inline

Definition at line 80 of file CBAlgoStartTrack.h.

References _min_width, and fhicl::detail::atom::value().

Referenced by CBAlgoStartTrack().

80 { _min_width = value; }
std::string value(boost::any const &)
virtual void cmtool::CMAlgoBase::SetVerbose ( bool  doit = true)
inlinevirtualinherited

Member Data Documentation

bool cmtool::CBAlgoStartTrack::_debug
protected

Definition at line 94 of file CBAlgoStartTrack.h.

Referenced by Bool(), and SetDebug().

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().

double cmtool::CBAlgoStartTrack::_min_EP
protected

Definition at line 93 of file CBAlgoStartTrack.h.

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

size_t cmtool::CBAlgoStartTrack::_min_hits
protected

Definition at line 92 of file CBAlgoStartTrack.h.

Referenced by Bool(), and SetMinHits().

double cmtool::CBAlgoStartTrack::_min_opening_angle
protected

Definition at line 93 of file CBAlgoStartTrack.h.

Referenced by IsOverlappingBlob(), and SetMinOpeningAngle().

double cmtool::CBAlgoStartTrack::_min_width
protected

Definition at line 93 of file CBAlgoStartTrack.h.

Referenced by IsOverlappingBlob(), and SetMinWidth().


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