CMAlgoBase.h
Go to the documentation of this file.
1 /**
2  * \file CMAlgoBase.h
3  *
4  * \ingroup CMTool
5  *
6  * \brief Class def header for a class CMAlgoBase
7  *
8  * @author kazuhiro
9  */
10 
11 /** \addtogroup CMTool
12 
13  @{*/
14 #ifndef RECOTOOL_CMALGOBASE_H
15 #define RECOTOOL_CMALGOBASE_H
16 
18 #include <vector>
19 
20 class TFile;
21 
22 namespace cmtool {
23 
24  /**
25  \class CMAlgoBase
26  An abstract base class for merging/mathcing algorithm. Having this base class helps
27  to have a better overall design of various merging for iterative approach.
28  The algorithms are run through CMergeManager.
29  */
30  class CMAlgoBase {
31  public:
33  {
34  _fout = 0;
35  _verbose = false;
36  }
37  virtual ~CMAlgoBase() = default;
38 
39  /// Function to reset the algorithm instance called within CMergeManager/CMatchManager's Reset() ... maybe implemented via child class
40  virtual void
42  {}
43 
44  /**
45  Optional function: called at the beginning of 1st iteration. This is called per event.
46  */
47  virtual void
48  EventBegin(const std::vector<cluster::ClusterParamsAlg>&)
49  {}
50 
51  /**
52  Optional function: called at the end of event ... after the last merging iteration is over.
53  */
54  virtual void
56  {}
57 
58  /**
59  Optional function: called at the beggining of each iteration over all pairs of clusters.
60  This provides all clusters' information in case the algorithm need them. Note this
61  is called per iteration which may be more than once per event.
62  */
63  virtual void
64  IterationBegin(const std::vector<cluster::ClusterParamsAlg>&)
65  {}
66 
67  /**
68  Optional function: called at the end of each iteration over all pairs of clusters.
69  */
70  virtual void
72  {}
73 
74  /**
75  Optional function: called after Bool() function is called for all possible cluster
76  pairs by CMergeManager/CMatchManager IFF run with verbosity level kPerIteration.
77  Maybe useful for debugging.
78  */
79  virtual void
81  {}
82 
83  /// Setter function for an output plot TFile pointer
84  void
85  SetAnaFile(TFile* fout)
86  {
87  _fout = fout;
88  }
89 
90  /// Setter function for verbosity
91  virtual void
92  SetVerbose(bool doit = true)
93  {
94  _verbose = doit;
95  }
96 
97  protected:
98  /// TFile pointer to an output file
99  TFile* _fout;
100 
101  /// Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager's verbosity level is >= kPerMerging
102  bool _verbose;
103  };
104 
105 }
106 
107 #endif
108 /** @} */ // end of doxygen group
virtual void Report()
Definition: CMAlgoBase.h:80
TFile * _fout
TFile pointer to an output file.
Definition: CMAlgoBase.h:99
virtual void EventEnd()
Definition: CMAlgoBase.h:55
virtual void Reset()
Function to reset the algorithm instance called within CMergeManager/CMatchManager&#39;s Reset() ...
Definition: CMAlgoBase.h:41
virtual ~CMAlgoBase()=default
void SetAnaFile(TFile *fout)
Setter function for an output plot TFile pointer.
Definition: CMAlgoBase.h:85
virtual void SetVerbose(bool doit=true)
Setter function for verbosity.
Definition: CMAlgoBase.h:92
virtual void IterationBegin(const std::vector< cluster::ClusterParamsAlg > &)
Definition: CMAlgoBase.h:64
virtual void IterationEnd()
Definition: CMAlgoBase.h:71
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is >= kPer...
Definition: CMAlgoBase.h:102
virtual void EventBegin(const std::vector< cluster::ClusterParamsAlg > &)
Definition: CMAlgoBase.h:48