LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 <iostream>
18 #include <vector>
19 #include <TString.h>
20 #include "CMTException.h"
21 
22 namespace cmtool {
23 
35  class CMergeBookKeeper : public std::vector<unsigned short>{
36 
37  public:
38 
40  CMergeBookKeeper(unsigned short nclusters=0);
41 
43  virtual ~CMergeBookKeeper(){};
44 
46  void Reset(unsigned short nclusters=0);
47 
49  void ProhibitMerge(unsigned short index1, unsigned short index2);
50 
52  bool MergeAllowed(unsigned short index1, unsigned short index2);
53 
55  void Merge(unsigned short index1, unsigned short index2);
56 
62  std::vector<unsigned short> GetMergedSet(unsigned short index1) const;
63 
70  bool IsMerged(unsigned short index1, unsigned short index2) const;
71 
76  void PassResult(std::vector<std::vector<unsigned short> > &result) const;
77 
78 
79  std::vector<std::vector<unsigned short> > GetResult() const
80  {
81  std::vector<std::vector<unsigned short> > result;
82  PassResult(result);
83  return result;
84  }
85 
90  void Combine(const CMergeBookKeeper &another);
91 
92  void Report() const;
93 
94  protected:
95 
99  std::vector<std::vector<bool> > _prohibit_merge;
100 
103 
104  };
105 
106 }
107 
108 #endif
109  // end of doxygen group
110 
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:265
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
Class def header for exception classes in CMTException.
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.
void PassResult(std::vector< std::vector< unsigned short > > &result) const
bool IsMerged(unsigned short index1, unsigned short index2) const
virtual ~CMergeBookKeeper()
Default destructor.
void Reset(unsigned short nclusters=0)
Reset method.