Public Member Functions | Protected Attributes | List of all members
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...
 
- 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 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...
 
- 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

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

Definition at line 26 of file CBAlgoStartInCone.h.

Constructor & Destructor Documentation

cmtool::CBAlgoStartInCone::CBAlgoStartInCone ( )

Default constructor.

Definition at line 7 of file CBAlgoStartInCone.cxx.

8  {
9  // Nothing to be done in the base class
10  this->reconfigure();
11 
13  _wire_2_cm = geou.WireToCm();
14  _time_2_cm = geou.TimeToCm();
15 
16  SetMinHits(40);
17  SetMinLen(10);
18  SetDebug(false);
19  SetAngleCompat(90.);
20  SetLengthReach(1.0);
21 
22  }
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 34 of file CBAlgoStartInCone.h.

34 {};

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 32 of file CBAlgoStartInCone.cxx.

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

Method to re-configure the instance.

Definition at line 25 of file CBAlgoStartInCone.cxx.

25  {
26 
27  //not sure what needs to be reset/reconfigured for this algo
28 
29  }//end reconfigure function
void cmtool::CBAlgoStartInCone::SetAngleCompat ( double  deg)
inline

Set Angle Compatibility betweeen the clusters.

Definition at line 56 of file CBAlgoStartInCone.h.

56 { _angleCompat = deg; }
static const double deg
Definition: Units.h:167
void cmtool::CBAlgoStartInCone::SetDebug ( bool  debug)
inline

Set Debug for messages.

Definition at line 53 of file CBAlgoStartInCone.h.

void cmtool::CBAlgoStartInCone::SetLengthReach ( double  frac)
inline

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

Definition at line 59 of file CBAlgoStartInCone.h.

59 { _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 44 of file CBAlgoStartInCone.h.

44 { _NhitsMin = n; }
size_t _NhitsMin
Conversion factors ogtten from GeometryUtilities.
std::void_t< T > n
void cmtool::CBAlgoStartInCone::SetMinLen ( double  l)
inline

Set Minimum number of hits for cone-cluster.

Definition at line 47 of file CBAlgoStartInCone.h.

47 { _lenMin = l; }
static QStrList * l
Definition: config.cpp:1044
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 50 of file CBAlgoStartInCone.h.

50 { _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 69 of file CBAlgoStartInCone.h.

bool cmtool::CBAlgoStartInCone::_debug
protected

Definition at line 68 of file CBAlgoStartInCone.h.

double cmtool::CBAlgoStartInCone::_lengthReach
protected

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

Definition at line 70 of file CBAlgoStartInCone.h.

double cmtool::CBAlgoStartInCone::_lenMin
protected

Larger cluster which determines cone must have this many hits.

Definition at line 66 of file CBAlgoStartInCone.h.

size_t cmtool::CBAlgoStartInCone::_NhitsMin
protected

Conversion factors ogtten from GeometryUtilities.

Definition at line 65 of file CBAlgoStartInCone.h.

double cmtool::CBAlgoStartInCone::_time_2_cm
protected

Definition at line 63 of file CBAlgoStartInCone.h.

bool cmtool::CBAlgoStartInCone::_verbose
protected

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

Definition at line 67 of file CBAlgoStartInCone.h.

double cmtool::CBAlgoStartInCone::_wire_2_cm
protected

Definition at line 63 of file CBAlgoStartInCone.h.


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