LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
|
#include "CMergeBookKeeper.h"
Public Member Functions | |
CMergeBookKeeper (unsigned short nclusters=0) | |
Default constructor. More... | |
virtual | ~CMergeBookKeeper () |
Default destructor. More... | |
void | Reset (unsigned short nclusters=0) |
Reset method. More... | |
void | ProhibitMerge (unsigned short index1, unsigned short index2) |
Method to set a pair of clusters to prohibit from merging. More... | |
bool | MergeAllowed (unsigned short index1, unsigned short index2) |
Method to inqury if a combination is prohibited to merge. More... | |
void | Merge (unsigned short index1, unsigned short index2) |
Method to merge 2 clusters via index numbers. More... | |
std::vector< unsigned short > | GetMergedSet (unsigned short index1) const |
bool | IsMerged (unsigned short index1, unsigned short index2) const |
void | PassResult (std::vector< std::vector< unsigned short > > &result) const |
std::vector< std::vector< unsigned short > > | GetResult () const |
void | Combine (const CMergeBookKeeper &another) |
void | Report () const |
Public Attributes | |
T | elements |
STL member. More... | |
Protected Attributes | |
std::vector< std::vector< bool > > | _prohibit_merge |
size_t | _out_cluster_count |
Number of output clusters. More... | |
A utility class for CMergeManager which merge clusters using merging algorithms. One of major task for CMergeManager is to keep track of which clusters to be merged in the original input. CMergeBookKeeper handles this part. It works with indexes. The user (primarily CMergeManager) provides number of clusters to CMergeBookKeeper's constructor. Then it can ask CMergeBookKeeper to merge two specific clusters by specifying index number of the cluster which has to be smaller than the previously specified number of clusters. CMergeBookKeeper keeps track of which clusters are asked to merge together, and it can be asked to return a vector of merged cluster indexes.
Definition at line 35 of file CMergeBookKeeper.h.
cmtool::CMergeBookKeeper::CMergeBookKeeper | ( | unsigned short | nclusters = 0 | ) |
Default constructor.
Definition at line 8 of file CMergeBookKeeper.cxx.
References Reset().
|
inlinevirtual |
Default destructor.
Definition at line 43 of file CMergeBookKeeper.h.
References GetMergedSet(), IsMerged(), Merge(), MergeAllowed(), PassResult(), ProhibitMerge(), Reset(), and lar::dump::vector().
void cmtool::CMergeBookKeeper::Combine | ( | const CMergeBookKeeper & | another | ) |
Method to combine with another CMergeBookKeeper instance.
Definition at line 276 of file CMergeBookKeeper.cxx.
References Merge(), PassResult(), and target.
Referenced by cmtool::CMergeManager::EventEnd(), GetResult(), and cmtool::CMergeHelper::Process().
std::vector< unsigned short > cmtool::CMergeBookKeeper::GetMergedSet | ( | unsigned short | index1 | ) | const |
Method to retrieve a vector of cluster indexes which is merged with the input cluster index. All indexes here are regarding the original cluster index.
Definition at line 251 of file CMergeBookKeeper.cxx.
Referenced by ~CMergeBookKeeper().
|
inline |
Definition at line 79 of file CMergeBookKeeper.h.
References Combine(), PassResult(), and Report().
Referenced by cluster::ClusterMergeHelper::Process(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and cmtool::CMergeManager::RunMerge().
bool cmtool::CMergeBookKeeper::IsMerged | ( | unsigned short | index1, |
unsigned short | index2 | ||
) | const |
Method to ask if a given 2 clusters are already merged. This method is expected to be much faster than obtaining a merged cluster sets from GetMergedIndexes and check if two clusters are merged.
Definition at line 242 of file CMergeBookKeeper.cxx.
Referenced by ~CMergeBookKeeper().
void cmtool::CMergeBookKeeper::Merge | ( | unsigned short | index1, |
unsigned short | index2 | ||
) |
Method to merge 2 clusters via index numbers.
Definition at line 75 of file CMergeBookKeeper.cxx.
References _out_cluster_count, and _prohibit_merge.
Referenced by Combine(), cmtool::CMergeManager::RunMerge(), and ~CMergeBookKeeper().
bool cmtool::CMergeBookKeeper::MergeAllowed | ( | unsigned short | index1, |
unsigned short | index2 | ||
) |
Method to inqury if a combination is prohibited to merge.
Definition at line 51 of file CMergeBookKeeper.cxx.
References _prohibit_merge.
Referenced by cmtool::CMergeManager::RunMerge(), and ~CMergeBookKeeper().
void cmtool::CMergeBookKeeper::PassResult | ( | std::vector< std::vector< unsigned short > > & | result | ) | const |
A method to get the full result. The return is a vector of merged cluster indexes (which is a vector of original cluster indexes).
Definition at line 266 of file CMergeBookKeeper.cxx.
References _out_cluster_count.
Referenced by Combine(), GetResult(), cmtool::CMergeManager::IterationProcess(), and ~CMergeBookKeeper().
void cmtool::CMergeBookKeeper::ProhibitMerge | ( | unsigned short | index1, |
unsigned short | index2 | ||
) |
Method to set a pair of clusters to prohibit from merging.
Definition at line 28 of file CMergeBookKeeper.cxx.
References _prohibit_merge.
Referenced by cmtool::CMergeManager::RunSeparate(), and ~CMergeBookKeeper().
void cmtool::CMergeBookKeeper::Report | ( | ) | const |
Definition at line 220 of file CMergeBookKeeper.cxx.
References _prohibit_merge.
Referenced by GetResult().
void cmtool::CMergeBookKeeper::Reset | ( | unsigned short | nclusters = 0 | ) |
Reset method.
Definition at line 13 of file CMergeBookKeeper.cxx.
References _out_cluster_count, _prohibit_merge, and clear().
Referenced by CMergeBookKeeper(), cmtool::CMergeManager::EventBegin(), cmtool::CMergeManager::IterationProcess(), cmtool::CMergeManager::Reset(), and ~CMergeBookKeeper().
|
protected |
Number of output clusters.
Definition at line 102 of file CMergeBookKeeper.h.
Referenced by Merge(), PassResult(), and Reset().
|
protected |
A 2D-map vector that stores pair of clusters for which merging is prohibited
Definition at line 99 of file CMergeBookKeeper.h.
Referenced by Merge(), MergeAllowed(), ProhibitMerge(), Report(), and Reset().
|
inherited |
STL member.