All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CBAlgoCenterOfMass.h
Go to the documentation of this file.
1 /**
2  * \file CBAlgoCenterOfMass.h
3  *
4  * \ingroup CMTool
5  *
6  * \brief Class def header for a class CBAlgoCenterOfMass
7  *
8  * @author david caratelli
9  */
10 
11 /** \addtogroup CMTool
12 
13  @{*/
14 #ifndef RECOTOOL_CBALGOCENTEROFMASS_H
15 #define RECOTOOL_CBALGOCENTEROFMASS_H
16 
19 
20 namespace cmtool {
21  /**
22  \class CBAlgoCenterOfMass
23  Designed mainly for small clusters (< 10 hits):
24  Find Cluster's center of mass weighing by Q
25  Then see if COM is in polygon/cone of a big cluster
26  If so -> merge
27  */
29 
30  public:
31 
32  /// Default constructor
34 
35  /// Default destructor
36  virtual ~CBAlgoCenterOfMass(){};
37 
38  /**
39  Core function: given the ClusterParamsAlg input, return whether a cluster should be
40  merged or not.
41  */
42  virtual bool Bool(const ::cluster::ClusterParamsAlg &cluster1,
43  const ::cluster::ClusterParamsAlg &cluster2);
44 
45  /// Function to reset the algorithm instance ... maybe implemented via child class
46  virtual void Reset(){}
47 
48  /// Function to report what's going on per merging iteration
49  virtual void Report();
50 
51  /// Function to set Debug mode of output
52  void SetDebug(bool on) { _debug = on; }
53 
54  /// Function to set Max hits for small clsuters
55  void SetMaxHitsSmallClus(size_t n) { _maxHits = n; }
56 
57  /// Function to se Min hits for big clusters
58  void SetMinHitsBigClus(size_t n) { _minHits = n; }
59 
60  /// Function to set Max Distance for COM to be from start-end
61  void SetMaxDistance(double d) { _MaxDist = d; }
62 
63  /// Use COM in Poly algo to decide merging
64  void UseCOMInPoly(bool on) { _COMinPolyAlg = on; }
65 
66  /// Use COM in Poly algo to decide merging
67  void UseCOMInCone(bool on) { _COMinConeAlg = on; }
68 
69  /// Use COM in Poly algo to decide merging
70  void UseCOMNearClus(bool on) { _COMNearClus = on; }
71 
72  /// Set Length Reach: How for out the cone extends as percent of cluster length
73  void SetLengthReach(double frac){ _lengthReach = frac; }
74 
75  double ShortestDistanceSquared(double point_x, double point_y,
76  double start_x, double start_y,
77  double end_x, double end_y ) const;
78 
79 
80  protected:
81 
82  bool _debug;
83  size_t _minHits;
84  size_t _maxHits;
85  double _MaxDist;
86  double _lengthReach; ///How four out - as percent of cluster length - cone will extend from start point
90  };
91 }
92 
93 #endif
94 /** @} */ // end of doxygen group
Class def header for algorithm classes for CMergeManager.
virtual ~CBAlgoCenterOfMass()
Default destructor.
void SetLengthReach(double frac)
Set Length Reach: How for out the cone extends as percent of cluster length.
void SetMaxDistance(double d)
Function to set Max Distance for COM to be from start-end.
void UseCOMInCone(bool on)
Use COM in Poly algo to decide merging.
void UseCOMNearClus(bool on)
Use COM in Poly algo to decide merging.
void UseCOMInPoly(bool on)
Use COM in Poly algo to decide merging.
CBAlgoCenterOfMass()
Default constructor.
void SetDebug(bool on)
Function to set Debug mode of output.
virtual void Reset()
Function to reset the algorithm instance ... maybe implemented via child class.
void SetMaxHitsSmallClus(size_t n)
Function to set Max hits for small clsuters.
virtual bool Bool(const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
double ShortestDistanceSquared(double point_x, double point_y, double start_x, double start_y, double end_x, double end_y) const
virtual void Report()
Function to report what&#39;s going on per merging iteration.
void SetMinHitsBigClus(size_t n)
Function to se Min hits for big clusters.
bool _COMinPolyAlg
How four out - as percent of cluster length - cone will extend from start point.