LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
cmtool::CBAlgoStartInCone Class Reference

#include "CBAlgoStartInCone.h"

Inheritance diagram for cmtool::CBAlgoStartInCone:
cmtool::CBoolAlgoBase cmtool::CMAlgoBase

Public Member Functions

 CBAlgoStartInCone ()
 Default constructor. More...
 
virtual ~CBAlgoStartInCone ()
 Default destructor. More...
 
virtual bool Bool (const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
 Merging Algorithm is Here. More...
 
void reconfigure ()
 Method to re-configure the instance. More...
 
void SetMinHits (size_t n)
 Set Minimum number of hits for cone-cluster. More...
 
void SetMinLen (double l)
 Set Minimum number of hits for cone-cluster. More...
 
void SetVerbose (bool verbosity)
 Set Verbosity of messages. More...
 
void SetDebug (bool debug)
 Set Debug for messages. More...
 
void SetAngleCompat (double deg)
 Set Angle Compatibility betweeen the clusters. More...
 
void SetLengthReach (double frac)
 Set Length Reach: How for out the cone extends as percent of cluster length. More...
 
virtual void Reset ()
 Function to reset the algorithm instance called within CMergeManager/CMatchManager's Reset() ... maybe implemented via child class. 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 ()
 
virtual void Report ()
 
void SetAnaFile (TFile *fout)
 Setter function for an output plot TFile pointer. More...
 

Protected Attributes

double _wire_2_cm
 
double _time_2_cm
 
size_t _NhitsMin
 Conversion factors ogtten from GeometryUtilities. More...
 
double _lenMin
 Larger cluster which determines cone must have this many hits. More...
 
bool _verbose
 Larger cluster which determines cone must be at least this long. More...
 
bool _debug
 
double _angleCompat
 
double _lengthReach
 Two clusters must have direction within this value of each other. More...
 
TFile * _fout
 TFile pointer to an output file. More...
 

Detailed Description

If start point of Cluster B in Cone region of Cluster A then merge

Definition at line 28 of file CBAlgoStartInCone.h.

Constructor & Destructor Documentation

cmtool::CBAlgoStartInCone::CBAlgoStartInCone ( )

Default constructor.

Definition at line 8 of file CBAlgoStartInCone.cxx.

References _time_2_cm, _wire_2_cm, reconfigure(), SetAngleCompat(), SetDebug(), SetLengthReach(), SetMinHits(), SetMinLen(), util::GeometryUtilities::TimeToCm(), and util::GeometryUtilities::WireToCm().

9  {
10  // Nothing to be done in the base class
11  this->reconfigure();
12 
14  _wire_2_cm = geou.WireToCm();
15  _time_2_cm = geou.TimeToCm();
16 
17  SetMinHits(40);
18  SetMinLen(10);
19  SetDebug(false);
20  SetAngleCompat(90.);
21  SetLengthReach(1.0);
22 
23  }
void SetAngleCompat(double deg)
Set Angle Compatibility betweeen the clusters.
Double_t TimeToCm() const
Double_t WireToCm() const
void SetMinHits(size_t n)
Set Minimum number of hits for cone-cluster.
void SetLengthReach(double frac)
Set Length Reach: How for out the cone extends as percent of cluster length.
void SetDebug(bool debug)
Set Debug for messages.
void SetMinLen(double l)
Set Minimum number of hits for cone-cluster.
void reconfigure()
Method to re-configure the instance.
virtual cmtool::CBAlgoStartInCone::~CBAlgoStartInCone ( )
inlinevirtual

Default destructor.

Definition at line 36 of file CBAlgoStartInCone.h.

References Bool(), and reconfigure().

36 {};

Member Function Documentation

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

Merging Algorithm is Here.

Reimplemented from cmtool::CBoolAlgoBase.

Definition at line 33 of file CBAlgoStartInCone.cxx.

References _angleCompat, _debug, _lengthReach, _lenMin, _NhitsMin, and _verbose.

Referenced by ~CBAlgoStartInCone().

35  {
36 
37  //apply filter on hit number and length immediately
38  if ( ( (cluster1.GetParams().length < _lenMin) and (cluster1.GetHitVector().size() < _NhitsMin) )
39  and ( (cluster2.GetParams().length < _lenMin) and (cluster2.GetHitVector().size() < _NhitsMin) ) )
40  return false;
41 
42  //A cluster has an associated cone defined as the cone originating
43  //at the start point of that cluster opening out in the direction
44  //of the end point with an angle equal to the opening angle
45  //If cluster A (B) has a start point within the volume defined
46  //by the cone of cluster B (A), and if cluster B (A) is good enough
47  // (enough hits, charge, length...) then the two are merged.
48 
49  double w_start1 = cluster1.GetParams().start_point.w;// * _wire_2_cm;
50  double t_start1 = cluster1.GetParams().start_point.t;// * _time_2_cm;
51  double angle1 = cluster1.GetParams().angle_2d;
52  double opening1 = cluster1.GetParams().opening_angle * (180./3.14);
53  double len1 = cluster1.GetParams().length;
54 
55  double w_start2 = cluster2.GetParams().start_point.w;// * _wire_2_cm;
56  double t_start2 = cluster2.GetParams().start_point.t;// * _time_2_cm;
57  double angle2 = cluster2.GetParams().angle_2d;
58  double opening2 = cluster2.GetParams().opening_angle * (180./3.14);
59  double len2 = cluster2.GetParams().length;
60 
61  //check for angle compatibility: the direction of the two clusters must be within
62  //this range of each other
63  if ( abs(angle2-angle1) > _angleCompat ){
64  if (_debug) { std::cout << "Directions too different....do not merge" << std::endl; }
65  return false;
66  }
67 
68  if (_debug){
69  std::cout << "Cluster 1:" << std::endl;
70  std::cout << "\tStart: ( " << w_start1 << ", " << t_start1 << " )" << std::endl;
71  std::cout << "\tAngle: " << angle1 << std::endl;
72  std::cout << "\tOpening Angle: " << opening1 << std::endl;
73  std::cout << "\tLength: " << len1 << std::endl;
74  std::cout << "Cluster 2:" << std::endl;
75  std::cout << "\tStart: ( " << w_start2 << ", " << t_start2 << " )" << std::endl;
76  std::cout << "\tAngle: " << angle2 << std::endl;
77  std::cout << "\tOpening Angle: " << opening2 << std::endl;
78  std::cout << "\tLength: " << len2 << std::endl;
79  std::cout << std::endl;
80  }
81 
82  //find if start point of A (B) in cone of B (A)
83  //do this by translating point A (B) such that
84  //start point of B (A) is at origin and + axis
85  //towards end point of B (A)
86  double w_start1_transl = w_start1 - w_start2;
87  double t_start1_transl = t_start1 - t_start2;
88  double w_start2_transl = w_start2 - w_start1;
89  double t_start2_transl = t_start2 - t_start1;
90 
91  double w_start1_rot = w_start1_transl*cos(angle2*3.14/180.) + t_start1_transl*sin(angle2*3.14/180.);
92  double t_start1_rot = - w_start1_transl*sin(angle2*3.14/180.) + t_start1_transl*cos(angle2*3.14/180.);
93  double w_start2_rot = w_start2_transl*cos(angle1*3.14/180.) + t_start2_transl*sin(angle1*3.14/180.);
94  double t_start2_rot = - w_start2_transl*sin(angle1*3.14/180.) + t_start2_transl*cos(angle1*3.14/180.);
95 
96  if (_debug){
97  std::cout << "\tStart Rot 1: ( " << w_start1_rot << ", " << t_start1_rot << " )" << std::endl;
98  std::cout << "\tStart Rot 2: ( " << w_start2_rot << ", " << t_start2_rot << " )" << std::endl;
99  }
100 
101  if ( (w_start1_rot < len2*_lengthReach ) and (w_start1_rot > 0) and
102  ( abs(t_start1_rot) < (abs(w_start1_rot*sin(opening2*3.14/180.))) ) and
103  (len2 > _lenMin) and
104  (cluster2.GetHitVector().size() > _NhitsMin) ){
105  if (_verbose) { std::cout << "Start point of Cluster 1 in cone of Cluster 2!" << std::endl; }
106  return true;
107  }
108  if ( (w_start2_rot < len1*_lengthReach ) and (w_start2_rot > 0) and
109  ( abs(t_start2_rot) < (abs(w_start2_rot*sin(opening1*3.14/180.))) ) and
110  (len1 > _lenMin) and
111  (cluster1.GetHitVector().size() > _NhitsMin) ){
112  if (_verbose) { std::cout << "Start point of Cluster 2 in cone of Cluster 1!" << std::endl; }
113  return true;
114  }
115 
116  return false;
117  }
bool _verbose
Larger cluster which determines cone must be at least this long.
size_t _NhitsMin
Conversion factors ogtten from GeometryUtilities.
double _lenMin
Larger cluster which determines cone must have this many hits.
const cluster_params & GetParams() const
double _lengthReach
Two clusters must have direction within this value of each other.
double t
Definition: PxUtils.h:11
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 w
Definition: PxUtils.h:10
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::CBAlgoStartInCone::reconfigure ( )

Method to re-configure the instance.

Definition at line 26 of file CBAlgoStartInCone.cxx.

Referenced by CBAlgoStartInCone(), and ~CBAlgoStartInCone().

26  {
27 
28  //not sure what needs to be reset/reconfigured for this algo
29 
30  }//end reconfigure function
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::CBAlgoStartInCone::SetAngleCompat ( double  deg)
inline

Set Angle Compatibility betweeen the clusters.

Definition at line 58 of file CBAlgoStartInCone.h.

References _angleCompat.

Referenced by CBAlgoStartInCone().

void cmtool::CBAlgoStartInCone::SetDebug ( bool  debug)
inline

Set Debug for messages.

Definition at line 55 of file CBAlgoStartInCone.h.

References _debug, and tca::debug.

Referenced by CBAlgoStartInCone().

55 { _debug = debug; }
DebugStuff debug
Definition: DebugStruct.cxx:4
void cmtool::CBAlgoStartInCone::SetLengthReach ( double  frac)
inline

Set Length Reach: How for out the cone extends as percent of cluster length.

Definition at line 61 of file CBAlgoStartInCone.h.

References _lengthReach.

Referenced by CBAlgoStartInCone().

61 { _lengthReach = frac; }
double _lengthReach
Two clusters must have direction within this value of each other.
void cmtool::CBAlgoStartInCone::SetMinHits ( size_t  n)
inline

Set Minimum number of hits for cone-cluster.

Definition at line 46 of file CBAlgoStartInCone.h.

References _NhitsMin, and n.

Referenced by CBAlgoStartInCone().

46 { _NhitsMin = n; }
size_t _NhitsMin
Conversion factors ogtten from GeometryUtilities.
Char_t n[5]
void cmtool::CBAlgoStartInCone::SetMinLen ( double  l)
inline

Set Minimum number of hits for cone-cluster.

Definition at line 49 of file CBAlgoStartInCone.h.

References _lenMin.

Referenced by CBAlgoStartInCone().

49 { _lenMin = l; }
double _lenMin
Larger cluster which determines cone must have this many hits.
void cmtool::CBAlgoStartInCone::SetVerbose ( bool  verbosity)
inlinevirtual

Set Verbosity of messages.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 52 of file CBAlgoStartInCone.h.

References _verbose.

52 { _verbose = verbosity; }
bool _verbose
Larger cluster which determines cone must be at least this long.

Member Data Documentation

double cmtool::CBAlgoStartInCone::_angleCompat
protected

Definition at line 71 of file CBAlgoStartInCone.h.

Referenced by Bool(), and SetAngleCompat().

bool cmtool::CBAlgoStartInCone::_debug
protected

Definition at line 70 of file CBAlgoStartInCone.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::CBAlgoStartInCone::_lengthReach
protected

Two clusters must have direction within this value of each other.

Definition at line 72 of file CBAlgoStartInCone.h.

Referenced by Bool(), and SetLengthReach().

double cmtool::CBAlgoStartInCone::_lenMin
protected

Larger cluster which determines cone must have this many hits.

Definition at line 68 of file CBAlgoStartInCone.h.

Referenced by Bool(), and SetMinLen().

size_t cmtool::CBAlgoStartInCone::_NhitsMin
protected

Conversion factors ogtten from GeometryUtilities.

Definition at line 67 of file CBAlgoStartInCone.h.

Referenced by Bool(), and SetMinHits().

double cmtool::CBAlgoStartInCone::_time_2_cm
protected

Definition at line 65 of file CBAlgoStartInCone.h.

Referenced by CBAlgoStartInCone().

bool cmtool::CBAlgoStartInCone::_verbose
protected

Larger cluster which determines cone must be at least this long.

Definition at line 69 of file CBAlgoStartInCone.h.

Referenced by Bool(), and SetVerbose().

double cmtool::CBAlgoStartInCone::_wire_2_cm
protected

Definition at line 65 of file CBAlgoStartInCone.h.

Referenced by CBAlgoStartInCone().


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