CBAlgoMergeTinyWithBig.h
Go to the documentation of this file.
1 /**
2  * \file CBAlgoMergeTinyWithBig.h
3  *
4  * \ingroup CMTool
5  *
6  * \brief Class def header for a class CBAlgoMergeTinyWithBig
7  *
8  * @author davidkaleko
9  */
10 
11 /** \addtogroup CMTool
12 
13  @{*/
14 #ifndef RECOTOOL_CBALGOMERGETINYWITHBIG_H
15 #define RECOTOOL_CBALGOMERGETINYWITHBIG_H
16 
19 
20 namespace cmtool {
21  /**
22  \class CBAlgoMergeTinyWithBig
23  User implementation for CBoolAlgoBase class
24  doxygen documentation!
25 
26  This algo looks for tiny clusters and looks to merge them with
27  big clusters. It uses code from PolyShortestDist and says if
28  the small cluster is close(ish) to the big one, merge it.
29 
30  */
32 
33  public:
34 
35  /// Default constructor
37 
38  /// Default destructor
40 
41  //
42  // Author should be aware of 3 functions at least: Bool, Report, and Reset.
43  // More possibly-useful functions can be later part but commented out.
44  // All of these functions are virtual and defined in the base class.
45  //
46 
47  /**
48  Core function: given the CPAN input, return whether a cluster should be
49  merged or not.
50  */
51  virtual bool Bool(const ::cluster::ClusterParamsAlg &cluster1,
52  const ::cluster::ClusterParamsAlg &cluster2);
53 
54  /**
55  Optional function: called after each Merge() function call by CMergeManager IFF
56  CMergeManager is run with verbosity level kPerMerging. Maybe useful for debugging.
57  */
58  virtual void Report();
59 
60  /// Function to reset the algorithm instance ... maybe implemented via child class
61  virtual void Reset();
62 
63 
64 
65  /**
66  Optional function: called at the beginning of 1st iteration. This is called per event.
67  */
68  //virtual void EventBegin(const std::vector<cluster::ClusterParamsAlg> &clusters);
69 
70  /**
71  Optional function: called at the end of event ... after the last merging iteration is over.
72  */
73  //virtual void EventEnd();
74 
75  /**
76  Optional function: called at the beggining of each iteration over all pairs of clusters.
77  This provides all clusters' information in case the algorithm need them. Note this
78  is called per iteration which may be more than once per event.
79  */
80  //virtual void IterationBegin(const std::vector<cluster::ClusterParamsAlg> &clusters);
81 
82  /**
83  Optional function: called at the end of each iteration over all pairs of clusters.
84  */
85  //virtual void IterationEnd();
86 
87  //both clusters must have > this # of hits to be considered for merging
88  void SetMinHitsBig(size_t nhits) { _min_hits_big = nhits; }
89 
90  void SetMaxHitsBig(size_t nhits) { _max_hits_big = nhits; }
91 
92  void SetMinHitsSmall(size_t nhits) { _min_hits_small = nhits; }
93 
94  void SetMaxHitsSmall(size_t nhits) { _max_hits_small = nhits; }
95 
97 
98  void SetDebug(bool flag) { _debug = flag; }
99 
100  private:
101 
103 
105 
106  bool _debug;
107 
108  };
109 }
110 #endif
111 /** @} */ // end of doxygen group
Class def header for algorithm classes for CMergeManager.
virtual void Reset()
Function to reset the algorithm instance ... maybe implemented via child class.
CBAlgoMergeTinyWithBig()
Default constructor.
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
virtual ~CBAlgoMergeTinyWithBig()
Default destructor.
virtual bool Bool(const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)