LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
cluster::ClusterMergeAlg Class Reference

#include "ClusterMergeAlg.h"

Public Member Functions

 ClusterMergeAlg (fhicl::ParameterSet const &pset)
 Default constructor with fhicl parameters. More...
 
void VerboseMode (bool on)
 Method to set verbose mode. More...
 
void ReportConfig () const
 Method to report the current configuration. More...
 
void SetAngleCut (double angle)
 Method to set cut value in degrees for angle compatibility test. More...
 
void SetSquaredDistanceCut (double d)
 Method to set cut value in cm^2 for distance compatibility test. More...
 
void AppendClusterInfo (const recob::Cluster &in_cluster, const std::vector< art::Ptr< recob::Hit >> &in_hit_v)
 Method to add a cluster information for processing. More...
 
void AppendClusterInfo (const art::Ptr< recob::Cluster > in_cluster, const std::vector< art::Ptr< recob::Hit >> &in_hit_v)
 Method to add a cluster information for processing. More...
 
void ClearEventInfo ()
 Method to clear event-wise information (both input cluster info & output merged cluster sets) More...
 
void ProcessMergeAlg ()
 
const std::vector< std::vector< unsigned int > > GetClusterSets () const
 Method to extract resulting set of cluster IDs for merging computed by ProcessMergeAlg() function. More...
 
bool CompareClusters (const cluster_merge_info &clus_info_A, const cluster_merge_info &clus_info_B)
 Method to compare a compatibility between two clusters. More...
 
bool Angle2DCompatibility (const cluster_merge_info &clus_info_A, const cluster_merge_info &clus_info_B) const
 
bool ShortestDistanceCompatibility (const cluster_merge_info &clus_info_A, const cluster_merge_info &clus_info_B) const
 
double ShortestDistanceSquared (double point_x, double point_y, double start_x, double start_y, double end_x, double end_y) const
 
void PrintClusterVars (cluster_merge_info clus_info) const
 
int isInClusterSets (unsigned int index) const
 

Protected Member Functions

void SetWire2Cm (double f)
 Method to set a conversion factor from wire to cm scale. More...
 
void SetTime2Cm (double f)
 Method to set a conversion factor from time to cm scale. More...
 
void ClearOutputInfo ()
 Method to clear output merged cluster sets (_cluster_sets_v) More...
 
void ClearInputInfo ()
 Method to clear input cluster information. More...
 
void ClearTTreeInfo ()
 Method to clear quality control TTree variables. More...
 
void PrepareTTree ()
 Method to prepare quality control TTree. More...
 
void PrepareDetParams ()
 Method to prepare detector parameters. More...
 
void AppendHitInfo (cluster_merge_info &ci, const std::vector< art::Ptr< recob::Hit >> &in_hit_v)
 Method to fill hit-array-related information. More...
 
void BuildClusterSets (const cluster_merge_info &clus_info_A, const cluster_merge_info &clus_info_B)
 
void FinalizeClusterSets ()
 
int AppendToClusterSets (unsigned int cluster_index, int merged_index=-1)
 A function to add a cluster to a merged sets (_cluster_sets_v) More...
 

Protected Attributes

bool _verbose
 Verbose mode boolean. More...
 
bool _det_params_prepared
 Boolean to keep track of detector parameter preparation. More...
 
TTree * _merge_tree
 Quality Control TTree pointer. More...
 
std::vector< int > _cluster_merged_index
 
std::vector< std::vector< unsigned int > > _cluster_sets_v
 
std::vector< cluster::cluster_merge_info_u_clusters
 Input U-plane clusters' information. More...
 
std::vector< cluster::cluster_merge_info_v_clusters
 Input V-plane clusters' information. More...
 
std::vector< cluster::cluster_merge_info_w_clusters
 Input W-plane clusters' information. More...
 
double _wire_2_cm
 Conversion factor from wire number to cm scale. More...
 
double _time_2_cm
 Conversion factor from time to cm scale. More...
 
double _max_allowed_2D_angle_diff
 
double _max_2D_dist2
 
double _min_distance_unit
 

Detailed Description

Definition at line 77 of file ClusterMergeAlg.h.

Constructor & Destructor Documentation

cluster::ClusterMergeAlg::ClusterMergeAlg ( fhicl::ParameterSet const &  pset)

Default constructor with fhicl parameters.

Member Function Documentation

bool cluster::ClusterMergeAlg::Angle2DCompatibility ( const cluster_merge_info clus_info_A,
const cluster_merge_info clus_info_B 
) const

Function to compare the 2D angles of two clusters and return true if they are within the maximum allowed parameter. Includes shifting by 180 for backwards clusters. This is called within CompareClusters().

void cluster::ClusterMergeAlg::AppendClusterInfo ( const recob::Cluster in_cluster,
const std::vector< art::Ptr< recob::Hit >> &  in_hit_v 
)

Method to add a cluster information for processing.

void cluster::ClusterMergeAlg::AppendClusterInfo ( const art::Ptr< recob::Cluster in_cluster,
const std::vector< art::Ptr< recob::Hit >> &  in_hit_v 
)

Method to add a cluster information for processing.

void cluster::ClusterMergeAlg::AppendHitInfo ( cluster_merge_info ci,
const std::vector< art::Ptr< recob::Hit >> &  in_hit_v 
)
protected

Method to fill hit-array-related information.

int cluster::ClusterMergeAlg::AppendToClusterSets ( unsigned int  cluster_index,
int  merged_index = -1 
)
protected

A function to add a cluster to a merged sets (_cluster_sets_v)

void cluster::ClusterMergeAlg::BuildClusterSets ( const cluster_merge_info clus_info_A,
const cluster_merge_info clus_info_B 
)
protected

For a given pair of clusters, this function calls CompareClusters() and append to the resulting merged cluster sets (_cluster_sets_v) by calling AppendToClusterSets() when they are compatible.

void cluster::ClusterMergeAlg::ClearEventInfo ( )

Method to clear event-wise information (both input cluster info & output merged cluster sets)

void cluster::ClusterMergeAlg::ClearInputInfo ( )
protected

Method to clear input cluster information.

void cluster::ClusterMergeAlg::ClearOutputInfo ( )
protected

Method to clear output merged cluster sets (_cluster_sets_v)

void cluster::ClusterMergeAlg::ClearTTreeInfo ( )
protected

Method to clear quality control TTree variables.

bool cluster::ClusterMergeAlg::CompareClusters ( const cluster_merge_info clus_info_A,
const cluster_merge_info clus_info_B 
)

Method to compare a compatibility between two clusters.

void cluster::ClusterMergeAlg::FinalizeClusterSets ( )
protected

Function to loop through _cluster_sets_v and add in the un-mergable clusters individually, because BuildClusterSets wouldn't have included them anywhere

const std::vector<std::vector<unsigned int> > cluster::ClusterMergeAlg::GetClusterSets ( ) const
inline

Method to extract resulting set of cluster IDs for merging computed by ProcessMergeAlg() function.

Definition at line 114 of file ClusterMergeAlg.h.

114 { return _cluster_sets_v; };
std::vector< std::vector< unsigned int > > _cluster_sets_v
int cluster::ClusterMergeAlg::isInClusterSets ( unsigned int  index) const

Utility function to check if an index is already somewhere inside of _cluster_sets_v vector returns the location of the element vector in _cluster_sets_v that contains the index and returns -1 if the index is not in _cluster_sets_v anywhere

void cluster::ClusterMergeAlg::PrepareDetParams ( )
protected

Method to prepare detector parameters.

void cluster::ClusterMergeAlg::PrepareTTree ( )
protected

Method to prepare quality control TTree.

void cluster::ClusterMergeAlg::PrintClusterVars ( cluster_merge_info  clus_info) const

Function to print to screen a specific cluser's info from ClusterPrepAna module. Used for debugging.

void cluster::ClusterMergeAlg::ProcessMergeAlg ( )

Method to execute the algorithm. All parameter configuration + adding input cluster information should be done before calling this function. This function generate a resulting set of cluster IDs for merging, which can be accessed through GetClusterSets() function.

void cluster::ClusterMergeAlg::ReportConfig ( ) const

Method to report the current configuration.

void cluster::ClusterMergeAlg::SetAngleCut ( double  angle)
inline

Method to set cut value in degrees for angle compatibility test.

Definition at line 90 of file ClusterMergeAlg.h.

void cluster::ClusterMergeAlg::SetSquaredDistanceCut ( double  d)
inline

Method to set cut value in cm^2 for distance compatibility test.

Definition at line 93 of file ClusterMergeAlg.h.

References d, and lar::dump::vector().

93 { _max_2D_dist2 = d; }
Float_t d
Definition: plot.C:235
void cluster::ClusterMergeAlg::SetTime2Cm ( double  f)
inlineprotected

Method to set a conversion factor from time to cm scale.

Definition at line 166 of file ClusterMergeAlg.h.

References f, and lar::dump::vector().

166 { _time_2_cm = f; }
double _time_2_cm
Conversion factor from time to cm scale.
TFile f
Definition: plotHisto.C:6
void cluster::ClusterMergeAlg::SetWire2Cm ( double  f)
inlineprotected

Method to set a conversion factor from wire to cm scale.

Definition at line 163 of file ClusterMergeAlg.h.

References f.

163 { _wire_2_cm = f; }
double _wire_2_cm
Conversion factor from wire number to cm scale.
TFile f
Definition: plotHisto.C:6
bool cluster::ClusterMergeAlg::ShortestDistanceCompatibility ( const cluster_merge_info clus_info_A,
const cluster_merge_info clus_info_B 
) const

Function to compare the 2D distance of two clusters and return true if they are within the maximum allowed distance.The distance-squared is computed by another function, ShortestDistanceSquared(). This is called within CompareClusters().

double cluster::ClusterMergeAlg::ShortestDistanceSquared ( double  point_x,
double  point_y,
double  start_x,
double  start_y,
double  end_x,
double  end_y 
) const

Function to compute a distance between a 2D point (point_x, point_y) to a 2D finite line segment (start_x, start_y) => (end_x, end_y).

void cluster::ClusterMergeAlg::VerboseMode ( bool  on)
inline

Method to set verbose mode.

Definition at line 84 of file ClusterMergeAlg.h.

84 { _verbose = on; }
bool _verbose
Verbose mode boolean.

Member Data Documentation

std::vector<int> cluster::ClusterMergeAlg::_cluster_merged_index
protected

Book-keeping vector which length is same as input cluster array's length. The stored value is the merged cluster sets' index (_cluster_sets_v). For instance, given 5 clusters (0, 1, 2, 3, 4) as an input among which 1,2,3 are to be merged. _cluster_merged_index may hold contents like [1,0,0,0,2] when _cluster_sets_v contents are [[1,2,3],[0],[4]].

Definition at line 214 of file ClusterMergeAlg.h.

std::vector<std::vector<unsigned int> > cluster::ClusterMergeAlg::_cluster_sets_v
protected

The result container of ProcessMergeAlg() function. The structure is such that the inner vector holds the cluster IDs to be merged into one cluster. Naturally we expect multiple merged clusters, hence it's a vector of vector.

Definition at line 221 of file ClusterMergeAlg.h.

bool cluster::ClusterMergeAlg::_det_params_prepared
protected

Boolean to keep track of detector parameter preparation.

Definition at line 204 of file ClusterMergeAlg.h.

double cluster::ClusterMergeAlg::_max_2D_dist2
protected

Definition at line 230 of file ClusterMergeAlg.h.

double cluster::ClusterMergeAlg::_max_allowed_2D_angle_diff
protected

Definition at line 229 of file ClusterMergeAlg.h.

TTree* cluster::ClusterMergeAlg::_merge_tree
protected

Quality Control TTree pointer.

Definition at line 205 of file ClusterMergeAlg.h.

double cluster::ClusterMergeAlg::_min_distance_unit
protected

Definition at line 231 of file ClusterMergeAlg.h.

double cluster::ClusterMergeAlg::_time_2_cm
protected

Conversion factor from time to cm scale.

Definition at line 228 of file ClusterMergeAlg.h.

std::vector<cluster::cluster_merge_info> cluster::ClusterMergeAlg::_u_clusters
protected

Input U-plane clusters' information.

Definition at line 223 of file ClusterMergeAlg.h.

std::vector<cluster::cluster_merge_info> cluster::ClusterMergeAlg::_v_clusters
protected

Input V-plane clusters' information.

Definition at line 224 of file ClusterMergeAlg.h.

bool cluster::ClusterMergeAlg::_verbose
protected

Verbose mode boolean.

Definition at line 203 of file ClusterMergeAlg.h.

std::vector<cluster::cluster_merge_info> cluster::ClusterMergeAlg::_w_clusters
protected

Input W-plane clusters' information.

Definition at line 225 of file ClusterMergeAlg.h.

double cluster::ClusterMergeAlg::_wire_2_cm
protected

Conversion factor from wire number to cm scale.

Definition at line 227 of file ClusterMergeAlg.h.


The documentation for this class was generated from the following file: