LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
CMergeBookKeeper.h
Go to the documentation of this file.
1 
14 #ifndef RECOTOOL_CMERGEBOOKKEEPER_H
15 #define RECOTOOL_CMERGEBOOKKEEPER_H
16 
17 #include <cstddef>
18 #include <vector>
19 
20 namespace cmtool {
21 
33  class CMergeBookKeeper : public std::vector<unsigned short> {
34 
35  public:
37  CMergeBookKeeper(unsigned short nclusters = 0);
38 
40  void Reset(unsigned short nclusters = 0);
41 
43  void ProhibitMerge(unsigned short index1, unsigned short index2);
44 
46  bool MergeAllowed(unsigned short index1, unsigned short index2);
47 
49  void Merge(unsigned short index1, unsigned short index2);
50 
56  std::vector<unsigned short> GetMergedSet(unsigned short index1) const;
57 
64  bool IsMerged(unsigned short index1, unsigned short index2) const;
65 
70  void PassResult(std::vector<std::vector<unsigned short>>& result) const;
71 
72  std::vector<std::vector<unsigned short>> GetResult() const
73  {
74  std::vector<std::vector<unsigned short>> result;
75  PassResult(result);
76  return result;
77  }
78 
83  void Combine(const CMergeBookKeeper& another);
84 
85  void Report() const;
86 
87  protected:
91  std::vector<std::vector<bool>> _prohibit_merge;
92 
95  };
96 
97 }
98 
99 #endif
100  // end of doxygen group
void ProhibitMerge(unsigned short index1, unsigned short index2)
Method to set a pair of clusters to prohibit from merging.
std::vector< std::vector< unsigned short > > GetResult() const
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
std::vector< unsigned short > GetMergedSet(unsigned short index1) const
CMergeBookKeeper(unsigned short nclusters=0)
Default constructor.
size_t _out_cluster_count
Number of output clusters.
std::vector< std::vector< bool > > _prohibit_merge
void PassResult(std::vector< std::vector< unsigned short >> &result) const
void Combine(const CMergeBookKeeper &another)
void Merge(unsigned short index1, unsigned short index2)
Method to merge 2 clusters via index numbers.
bool MergeAllowed(unsigned short index1, unsigned short index2)
Method to inqury if a combination is prohibited to merge.
bool IsMerged(unsigned short index1, unsigned short index2) const
void Reset(unsigned short nclusters=0)
Reset method.