LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
#include "CMergeBookKeeper.h"
Public Member Functions | |
CMergeBookKeeper (unsigned short nclusters=0) | |
Default constructor. 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 33 of file CMergeBookKeeper.h.
cmtool::CMergeBookKeeper::CMergeBookKeeper | ( | unsigned short | nclusters = 0 | ) |
Default constructor.
Definition at line 10 of file CMergeBookKeeper.cxx.
References Reset().
void cmtool::CMergeBookKeeper::Combine | ( | const CMergeBookKeeper & | another | ) |
Method to combine with another CMergeBookKeeper instance.
Definition at line 261 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 237 of file CMergeBookKeeper.cxx.
References util::size().
|
inline |
Definition at line 72 of file CMergeBookKeeper.h.
References Combine(), PassResult(), and Report().
Referenced by cluster::ClusterMergeHelper::Process(), 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 229 of file CMergeBookKeeper.cxx.
References util::size().
void cmtool::CMergeBookKeeper::Merge | ( | unsigned short | index1, |
unsigned short | index2 | ||
) |
Method to merge 2 clusters via index numbers.
Definition at line 71 of file CMergeBookKeeper.cxx.
References _out_cluster_count, _prohibit_merge, and util::size().
Referenced by Combine(), and cmtool::CMergeManager::RunMerge().
bool cmtool::CMergeBookKeeper::MergeAllowed | ( | unsigned short | index1, |
unsigned short | index2 | ||
) |
Method to inqury if a combination is prohibited to merge.
Definition at line 50 of file CMergeBookKeeper.cxx.
References _prohibit_merge, and util::size().
Referenced by cmtool::CMergeManager::RunMerge().
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 251 of file CMergeBookKeeper.cxx.
References _out_cluster_count, and util::size().
Referenced by Combine(), GetResult(), and cmtool::CMergeManager::IterationProcess().
void cmtool::CMergeBookKeeper::ProhibitMerge | ( | unsigned short | index1, |
unsigned short | index2 | ||
) |
Method to set a pair of clusters to prohibit from merging.
Definition at line 29 of file CMergeBookKeeper.cxx.
References _prohibit_merge, and util::size().
Referenced by cmtool::CMergeManager::RunSeparate().
void cmtool::CMergeBookKeeper::Report | ( | ) | const |
Definition at line 207 of file CMergeBookKeeper.cxx.
References _prohibit_merge.
Referenced by GetResult().
void cmtool::CMergeBookKeeper::Reset | ( | unsigned short | nclusters = 0 | ) |
Reset method.
Definition at line 15 of file CMergeBookKeeper.cxx.
References _out_cluster_count, _prohibit_merge, and clear().
Referenced by CMergeBookKeeper(), cmtool::CMergeManager::EventBegin(), cmtool::CMergeManager::IterationProcess(), and cmtool::CMergeManager::Reset().
|
protected |
Number of output clusters.
Definition at line 94 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 91 of file CMergeBookKeeper.h.
Referenced by Merge(), MergeAllowed(), ProhibitMerge(), Report(), and Reset().
|
inherited |
STL member.