|
LDMX Software
|
A templated agglomerative clustering algorithm. More...
#include <TemplatedClusterFinder.h>
Public Types | |
| using | ClusterType = WorkingCluster<HitType> |
Public Member Functions | |
| void | add (const HitType &hit) |
| Add a hit to be clustered using its stored position. | |
| void | add (const HitType *hit) |
| Add a hit to be clustered using its stored position. | |
| void | add (const HitType *hit, double x, double y, double z) |
| Add a hit with explicit position (e.g., from geometry). | |
| void | cluster (double seed_threshold, double cutoff) |
| Run the clustering algorithm. | |
| double | getYMax () const |
| Get the final weight (minimum distance between remaining clusters). | |
| int | getNSeeds () const |
| Get the number of seed clusters found. | |
| int | getNLoops () const |
| Get the number of iterations performed. | |
| std::map< int, double > | getWeights () const |
| Get the transition weights (cluster count -> minimum weight at that step). | |
| std::vector< ClusterType > | getClusters () const |
| Get the final clusters after filtering by seed threshold. | |
| std::vector< ClusterType > | getAllClusters () const |
| Get all clusters including empty ones (for debugging). | |
Static Public Member Functions | |
| static bool | compClusters (const ClusterType &a, const ClusterType &b) |
| Compare clusters by energy (descending order). | |
Private Attributes | |
| WeightClass | wgt_ |
| double | finalwgt_ {0} |
| int | nseeds_ {0} |
| int | loops_ {0} |
| std::map< int, double > | transition_weights_ |
| std::vector< ClusterType > | clusters_ |
| std::vector< ClusterType > | final_clusters_ |
A templated agglomerative clustering algorithm.
This class implements a hierarchical agglomerative clustering algorithm for calorimeter hits. It is templated on:
The algorithm works by:
| HitType | The type of hit (e.g., EcalHit, HcalHit) |
| WeightClass | A functor with operator()(const WorkingCluster<HitType>&, const WorkingCluster<HitType>&) -> double |
Definition at line 37 of file TemplatedClusterFinder.h.
| using recon::TemplatedClusterFinder< HitType, WeightClass >::ClusterType = WorkingCluster<HitType> |
Definition at line 39 of file TemplatedClusterFinder.h.
|
inline |
Add a hit to be clustered using its stored position.
| hit | Reference to the hit to add |
Definition at line 46 of file TemplatedClusterFinder.h.
Referenced by ecal::EcalClusterProducer::produce(), and hcal::HcalClusterProducer::produce().
|
inline |
Add a hit to be clustered using its stored position.
| hit | Pointer to the hit to add |
Definition at line 53 of file TemplatedClusterFinder.h.
|
inline |
Add a hit with explicit position (e.g., from geometry).
| hit | Pointer to the hit to add |
| x | X position |
| y | Y position |
| z | Z position |
Definition at line 67 of file TemplatedClusterFinder.h.
References recon::WorkingCluster< HitType >::add(), and recon::TemplatedClusterFinder< HitType, WeightClass >::cluster().
|
inline |
Run the clustering algorithm.
| seed_threshold | Minimum energy for a cluster to be considered a seed |
| cutoff | Maximum weight (distance) for merging two clusters |
Definition at line 88 of file TemplatedClusterFinder.h.
References recon::TemplatedClusterFinder< HitType, WeightClass >::compClusters().
Referenced by recon::TemplatedClusterFinder< HitType, WeightClass >::add(), ecal::EcalClusterProducer::produce(), and hcal::HcalClusterProducer::produce().
|
inlinestatic |
Compare clusters by energy (descending order).
Definition at line 78 of file TemplatedClusterFinder.h.
References recon::WorkingCluster< HitType >::energy().
Referenced by recon::TemplatedClusterFinder< HitType, WeightClass >::cluster().
|
inline |
Get all clusters including empty ones (for debugging).
Definition at line 185 of file TemplatedClusterFinder.h.
|
inline |
Get the final clusters after filtering by seed threshold.
Definition at line 180 of file TemplatedClusterFinder.h.
Referenced by ecal::EcalClusterProducer::produce(), and hcal::HcalClusterProducer::produce().
|
inline |
Get the number of iterations performed.
Definition at line 170 of file TemplatedClusterFinder.h.
|
inline |
Get the number of seed clusters found.
Definition at line 165 of file TemplatedClusterFinder.h.
Referenced by ecal::EcalClusterProducer::produce().
|
inline |
Get the transition weights (cluster count -> minimum weight at that step).
Definition at line 175 of file TemplatedClusterFinder.h.
Referenced by ecal::EcalClusterProducer::produce().
|
inline |
Get the final weight (minimum distance between remaining clusters).
Definition at line 160 of file TemplatedClusterFinder.h.
|
private |
Definition at line 193 of file TemplatedClusterFinder.h.
|
private |
Definition at line 194 of file TemplatedClusterFinder.h.
|
private |
Definition at line 189 of file TemplatedClusterFinder.h.
|
private |
Definition at line 191 of file TemplatedClusterFinder.h.
|
private |
Definition at line 190 of file TemplatedClusterFinder.h.
|
private |
Definition at line 192 of file TemplatedClusterFinder.h.
|
private |
Definition at line 188 of file TemplatedClusterFinder.h.